diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index e0a882dff294a4e7fff8f93ed7d9f1128ffb6bac..e1441e5c19faddbf617a2e3f1e07bbe8894ad3ce 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,29 +1,29 @@ -Cover Charge v0.3.12.120: web apps, plus the Cover Charge for Display tablet app for Android (downloads/android/, its SHA-256 is in downloads/android/SHA256.txt). No phone APKs were built for v0.1.2 to v0.3.12.120. +Cover Charge v0.3.12.121: web apps, plus the Cover Charge for Display tablet app for Android (downloads/android/, its SHA-256 is in downloads/android/SHA256.txt). No phone APKs were built for v0.1.2 to v0.3.12.121. SHA-256 of each web app's start page, service worker, manifest and logo: -7ae893ec42949cf05397648a60e0021568b3cbc18ae748c618bc9d71d98d4cf5 owner-app/index.html -81348a3ff01ef05993a53eec63967dc6059a08e3c37f945ecd54835b60b25d92 owner-app/sw.js +d88343a319ccaef868b48ad030a76fc309b9e9d57e49a4564dfe2ba801f741d0 owner-app/index.html +f9f952ca577777e526e25befd4ca1e7315256b7af899074ed7221d1ca8fe1d55 owner-app/sw.js e305c44d11a9c25f37372f3fa4d329d4ffb04df2edee6e7b4b9ac91f3875ac67 owner-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 owner-app/brand-logo.png -fa60e8ff3beed8ee67b2d1948121009ddc22f47cd6c60d7ba9460c5848b859d2 staff-app/index.html -bc91088ae00651188811154a87bc1d3a40bed2b6908a2144f3393caa0740c7ea staff-app/sw.js +20fca0c627bddf557969e1baa63b0ab845cd9d094fe0b947d7f3bd965f8e6374 staff-app/index.html +77c6f6d52cdd07f21dd5226855e13c116e790bc724dee73a07a3b10c18137d13 staff-app/sw.js bd1d310ebf8e2a80808e100c41fb7fe1c4369d3026478f3ad8eececaeadaf4ac staff-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 staff-app/brand-logo.png -cda1967d172ceadbdb01c056ab9928fb194d0a41ca4b486907bc5bad3a5726b0 customer-app/index.html -bccb881b613774ef1d50f521b23d3ad14cba18526b18682025d75fc5c6096d3f customer-app/sw.js +d33129cbfda140723936fbbc88918bce8535ad5a0b41215e12214403bc672272 customer-app/index.html +fc706e3e7c27fde623e99bc0835122bd9ae34c38a925aa24ed19b58a31f7f1fb customer-app/sw.js 3bfb1fd10cc13f09ca6be65c461e1f6b5750ae51a3ece12e079750b2a066052e customer-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 customer-app/brand-logo.png -122eb56e6cd58f1279f51effa973428f24e2e1b3c2967f9fb2afaf56447c493e display-app/index.html -e600d6e89fe54defdb82f0998e4de3a03a969c7227f2b5704a6cf7c56b7ad0b1 display-app/sw.js +c0361cb559836e2abebfdbb7107020228e8fced72f49abc0ceba0c806c94e328 display-app/index.html +03926ab176d65d70d75ab0e9c48aa68f5e3c2a8f8b83a952cb6b191d1365b870 display-app/sw.js 35e2721b86eb1ae1605e55bee64177adcee72f4e53a24ac417d19ea2873434a1 display-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 display-app/brand-logo.png -8c89429416569c65505aed252492e1a5123b097d72c9a7bab731934b65955d1b chef-app/index.html -3854000ccd4bff03a5f33fbfbd65a0e7765fc6a6644cf73ca7194426d77d1db9 chef-app/sw.js +0388e7dfcb92104dcace2d72381dd89d095435aebdff7212bed59615f0fe785d chef-app/index.html +aebd43136364c0953218854de6a17c25afcf625ff3c440a0013e968aaca18510 chef-app/sw.js 97ed43decde8a888e22b7411e13a2122c6f8b9944cf38b2e28e8f62ef2e25397 chef-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 chef-app/brand-logo.png -088f7621220580434890c87c413f72ae97101f3e3f1065f6ef8d59fc2e520281 car-app/index.html -4b96966c57750b840c49a9f1ccbf0ce97589de5b424c74e5ec2c8e213cd14554 car-app/sw.js +b95ac801353db01a327aa1c7f5a094ce9c9eae99dcac3443dc3a38f18280958b car-app/index.html +4901967a3777fc8715cc2cfa2ddc061d54bd445b3f2c470d6b2e5e264be543ad car-app/sw.js 091b9f96d36153d270b44dbf458aa99e4fd5e2f127769d030436fcd1d51e724a car-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 car-app/brand-logo.png -ac42c93ce3299d8e7a9d590ac4beb3124668253aa1efbf479e599e29223c05bc car.html +4c75c3bcf346006a2f8e28e5abf372f0dffd57ab1ce49cde9b0f62526889910b car.html 98081968ac06b8ca464c4e5c66c95465d50c20bd7318d2b18eac93464c6e39af t.html diff --git a/car-app/_expo/static/js/web/bundle.js b/car-app/_expo/static/js/web/bundle.js index 0053f2a10fced4e73525f10e3b57e58a92cacc39..ff00fc06250cccc89e07bcf7fdfc4dae89dcabf7 100644 --- a/car-app/_expo/static/js/web/bundle.js +++ b/car-app/_expo/static/js/web/bundle.js @@ -23,11 +23,11 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_VENUE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PITCH_TEAM",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_TEXT",{enumerable:!0,get:function(){return o}}),e.pitchText=function(a){let n=a;for(const[a,t]of o)a.test(n)?(a.lastIndex=0,n=n.replace(a,t)):a.lastIndex=0;return n};const a={name:'The Harbour Kitchen',tagline:'Harbourside seafood & seasonal plates',location:'12 Quay Street, Portmorran',phone:'01632 960 123',website:'harbourkitchen.example'},n={'st-tracy':{name:'Morgan',job:'Owner',hourlyPence:null,salaried:!0},'st-gordon':{name:'Alex',job:'General Manager',dept:'Management',hourlyPence:null,salaried:!0},'st-bisto':{name:'Ravi',job:'Head Chef',hourlyPence:null,salaried:!0},'st-agate':{name:'Priya',job:'Front of house supervisor',hourlyPence:1450},'st-lenny':{name:'Tom',job:'Commis Chef',hourlyPence:1325},'st-finn':{name:'Lewis',job:'Bar staff',hourlyPence:1290},'st-eilidh':{name:'Chloe',job:'Front of house',hourlyPence:1271},'st-emily':{name:'Ellie',job:'Front of house',hourlyPence:1271},'st-lillie':{name:'Jordan',job:'Kitchen porter (KP)',hourlyPence:1271},'st-jack':{name:'Sam',job:'Kitchen porter (KP)',hourlyPence:1271}},o=[['Harbour View, Dunure, South Ayrshire',a.location],['Harbour View, Dunure',a.location],['Harbour View mug','Harbour Kitchen mug'],['Harbour View','Quay Street'],['anchoragedunure.com',a.website],['01292 502826',a.phone],['Mini Anchors','Little Crew'],['The Anchorage',a.name],['Anchorage','Harbour Kitchen'],['ANCHORAGE','HARBOUR KITCHEN'],['South Ayrshire','the Firth coast'],['Ayrshire','the Firth coast'],['Dunure','Portmorran'],['Kittyfisher boat (Big Sean)','Coastal Fish Co'],['Kittyfisher','Coastal Fish Co'],['Big Sean','Coastal Fish Co'],['Example Fish Co.','Coastal Fish Co'],['Sample Dairy Ltd','Hillside Dairy'],['Sample Fruit & Veg','Fieldfare Veg'],['Mills milk','Hillside Dairy milk'],['Mills','Hillside Dairy'],['J. Pieroni & Sons','Fieldfare Veg'],["Pieroni's",'Fieldfare Veg'],['Pieroni','Fieldfare Veg'],['Alsons (drinks)','Drinks wholesaler'],['Alsons','the drinks wholesaler'],['Spes Bona','the deli wholesaler'],['Tarelgin','the butcher'],['Reids','the bakery'],['Reeds','the bakery'],['Example Butchers Ltd','Quayside Butchers'],['Example Dry Goods Wholesale','Dry goods wholesaler'],['Sample Brewing Co.','Harbourside Brewing'],['Example Cleaning Supplies','Cleaning supplies'],['Sample Packaging Ltd','Packaging supplier'],['Example Kitchen Repairs','Kitchen repairs'],['Preston','Ravi'],['Bisto','Ravi'],['Tracy','Morgan'],['James','Morgan'],['Gordon','Alex'],['Agate','Priya'],['Lenny','Tom'],['Finn','Lewis'],['Eilidh','Chloe'],['Emily','Ellie'],['Gabrielle','Ellie'],['Cameron Mc','Sam'],['Cameron','Sam'],['Lillie','Jordan'],['Lily','Jordan'],['Mia','Jordan'],['Jack','Sam'],['Harvey','Jordan'],['Anna','the supplier'],['(preview)',''],[' (example)','']].map(([a,n])=>[new RegExp(`${/^[A-Za-z]/.test(a)?'(?g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`](_),globalThis.__webpack_require__=o=>{const t=ErrorUtils.reportFatalError;_&&(ErrorUtils.reportFatalError=_=>{throw _});try{return g[`${__METRO_GLOBAL_PREFIX__}__r`](o)}finally{_&&(ErrorUtils.reportFatalError=t)}}},23,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1522,1525]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1526,1529]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},25,[26]); __d(function(g,r,i,a,m,e,d){ /** @@ -41,7 +41,7 @@ __d(function(g,r,i,a,m,e,d){ */ "use strict";var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(t,o,f){var l=null;if(void 0!==f&&(l=""+f),void 0!==o.key&&(l=""+o.key),"key"in o)for(var y in f={},o)"key"!==y&&(f[y]=o[y]);else f=o;return o=f.ref,{$$typeof:n,type:t,key:l,ref:void 0!==o?o:null,props:f}}e.Fragment=t,e.jsx=o,e.jsxs=o},26,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ctx",{enumerable:!0,get:function(){return t}});const t=r(d[0])},27,[28]); -__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1192,1193,1195,1197,1199,1206,1260,1261,1262,1263,1264,1265,1267,1268,1269,1270,1271,1272,1273,1274,1277,1335,1336,1337,1475,1479,1480,1521]); +__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1193,1194,1196,1198,1200,1207,1261,1262,1263,1264,1265,1266,1268,1269,1270,1271,1272,1273,1274,1275,1278,1336,1337,1338,1479,1483,1484,1525]); __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]})}},29,[30,34,792,846,988,25]); __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)},30,[31,32,782,783,785]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},31,[]); @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1159,1160,899,997,1161,1133,1162,1169,1174,1183,1176,1132,1185,1189,1156,848,1190,1130,985,1191,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1160,1161,899,997,1162,1133,1163,1170,1175,1184,1177,1132,1186,1190,1156,848,1191,1130,985,1192,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,899,927,924,840,928,25]); __d(function(g,_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 C.webLine}}),_e.T=R,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return T}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:l=!0,right:o,maxWidth:n=640,footer:s,scroll:c=!0}){const h=(0,S.jsxs)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===k.APP_VARIANT?(0,S.jsx)(D,{}):null]});return(0,S.jsxs)(x.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,S.jsx)(A,{title:t,subtitle:r,back:l,right:o})}),c?(0,S.jsx)(u.default,{contentContainerStyle:{paddingBottom:40},children:h}):(0,S.jsx)(f.default,{style:{flex:1},children:h}),s?(0,S.jsx)(f.default,{style:O.footer,children:(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=z,_e.Card=v,_e.Badge=function({label:e,kind:t="neutral"}){const r={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,S.jsx)(f.default,{style:[O.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:I?'center':'flex-start'}],children:(0,S.jsx)(R,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return E}}),_e.Row=V,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return $}}),_e.Field=function({label:e,...r}){return(0,S.jsxs)(f.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,S.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...r,style:[O.input,r.multiline&&{minHeight:70,textAlignVertical:'top'},r.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:l,sub:o,testID:n,accessibilityLabel:s}){return(0,S.jsxs)(c.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${s??e}${!s&&o?`, ${o}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:r,style:[O.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e.trim()}),o?(0,S.jsx)(R,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:o}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:l,disabled:o,a11y:n}){return(0,S.jsxs)(V,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,S.jsx)(R,{style:{flex:1,flexShrink:1},children:r}),(0,S.jsx)(b.default,{testID:l,disabled:o,accessibilityLabel:n??r,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:r=1,max:l=20,label:o,step:n=1,format:s,testID:u}){const h=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,S.jsxs)(V,{gap:10,children:[(0,S.jsx)(c.default,{testID:u?`${u}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${o??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[O.stepBtn,e<=r?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,S.jsx)(f.default,{testID:u?`${u}-value`:void 0,accessibilityLabel:o?`${o}: ${h}`:h,children:(0,S.jsx)(R,{weight:"semibold",size:p.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:h})}),(0,S.jsx)(c.default,{testID:u?`${u}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${o??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,b(e+n))),style:[O.stepBtn,e>=l?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:r,children:l,maxWidth:n,testID:h,footer:b}){const{height:j}=(0,y.default)(),C=o.default.useContext(x.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},w=Math.max(320,j-C.top-C.bottom-24);return(0,S.jsx)(s.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,S.jsx)(f.default,{style:[O.overlay,{padding:12,paddingTop:12+C.top,paddingBottom:12+C.bottom}],children:(0,S.jsxs)(f.default,{style:[O.sheet,{maxHeight:w},n?{maxWidth:n}:null],testID:h,children:[(0,S.jsxs)(V,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,S.jsx)(P,{style:{flex:1},children:r}),(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:B?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,S.jsx)(R,{size:B?18:24,colour:p.colours.text,children:B?'Close':'\u2715'})})]}),(0,S.jsx)(u.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:l}),b?(0,S.jsx)(f.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:h?`${h}-footer`:void 0,children:b}):null]})})})},_e.SectionTitle=function({children:e}){return(0,S.jsx)(R,{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 O}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),l=_r(d[3]),o=e(_r(d[4])),n=e(_r(d[5])),s=e(_r(d[6]));_r(d[7]);var c=e(_r(d[8])),u=e(_r(d[9])),h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=_r(d[14]),p=_r(d[15]),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),k=_r(d[19]),W=_r(d[20]),S=_r(d[21]);const B=['kirkton','abbotsford'].includes(w.VENUE_RID),I='display'!==k.APP_VARIANT;function R({children:e,style:r,size:l=p.font.body,weight:o="regular",colour:n=p.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:b,accessibilityLabel:f}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,w=h.default.flatten(r)||{},k=1===w.flex||1===w.flexGrow||'number'==typeof w.width||'left'===w.textAlign,W=c??(I&&('semibold'===o||'bold'===o)&&!k);return(0,S.jsx)(t.Text,{testID:u??(y?'cc-url':void 0),...W?{dataSet:{centre:'heading'}}:{},accessibilityRole:b,accessibilityLabel:f,numberOfLines:s,style:[{minWidth:0,fontFamily:p.fonts[o],fontSize:l,color:n,lineHeight:(0,j.lineFor)(l)},W&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},r,x,(0,C.webLine)(r,l),W&&'left'!==w.textAlign?{textAlign:'center'}:null],children:e})}const L=e=>(0,S.jsx)(R,{size:p.font.title,weight:"semibold",center:!0,...e}),P=e=>(0,S.jsx)(R,{size:p.font.large,weight:"semibold",center:!0,...e}),T=e=>(0,S.jsx)(R,{colour:p.colours.muted,size:p.font.small,...e,center:e.center??I});function A({title:e,back:t=!0,right:l,subtitle:o}){return(0,S.jsxs)(f.default,{style:O.brandBar,children:[(0,S.jsxs)(f.default,{style:O.row,children:[(0,S.jsx)(f.default,{style:O.brandSide,children:t?(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>r.router.canGoBack()?r.router.back():r.router.replace(k.ENTRY[k.APP_VARIANT]),style:O.backBtn,hitSlop:10,children:(0,S.jsx)(R,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,S.jsx)(c.default,{onPress:()=>r.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:O.brandCenter,children:(0,S.jsx)(W.RestaurantBrand,{size:W.HEADER_LOGO})}),(0,S.jsx)(f.default,{style:[O.brandSide,{alignItems:'flex-end'}],children:l?(0,S.jsx)(f.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,S.jsx)(L,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,S.jsx)(T,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function D(){const e=(0,r.useLocalSearchParams)().rid??w.VENUE_RID,t=(0,l.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,S.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{n.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,S.jsx)(R,{center:!0,size:14,colour:p.colours.gold,children:t})}):null}function z({label:e,sub:t,onPress:r,kind:l="primary",disabled:o,small:n,style:s,accessibilityLabel:u,accessibilityHint:h,testID:b}){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],x={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,S.jsxs)(c.default,{testID:b,accessibilityRole:"button",accessibilityLabel:u??e,accessibilityHint:h,accessibilityState:{disabled:!!o},disabled:o,onPress:r,style:({pressed:e})=>[O.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:x,opacity:o?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:j.control.min,minWidth:44},s],children:[(0,S.jsx)(R,{weight:"semibold",size:n?p.font.small:p.font.body,colour:y,center:!0,children:e.trim()}),t?(0,S.jsx)(R,{size:n?p.font.small-2:p.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function v({children:e,style:t,onPress:r,highlight:l}){const o=l===p.colours.gold||l===p.colours.accentBorder,n=(0,S.jsx)(f.default,{testID:"cc-card",style:[O.card,{alignItems:'stretch'},l?{borderColor:o?p.colours.accentBorder:l,borderWidth:o?1:2}:null,t],children:e});return r?(0,S.jsx)(c.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function F({kind:e="info",title:t,children:r}){const l={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,S.jsxs)(f.default,{accessibilityRole:"summary",style:[O.banner,{backgroundColor:l[0],borderLeftColor:l[1]}],children:[t?(0,S.jsx)(R,{weight:"semibold",colour:l[2],center:!0,children:t}):null,o.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,S.jsx)(R,{size:p.font.small,colour:l[2],center:!0,children:r}):r]})}T.statusLine=!0,z.centreRow=!0;const H=()=>(0,S.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."}),E=()=>(0,S.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function V({children:e,style:t,gap:r=8,wrap:l}){const n=o.default.Children.map(e,e=>{if(!o.default.isValidElement(e))return e;const t=e,r=h.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:o.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===v?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),s=h.default.flatten(t)||{},c=o.default.Children.toArray(n).filter(o.default.isValidElement),u=e=>e.type;if(I&&'space-between'===s.justifyContent&&1!==s.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,S.jsx)(f.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const b=I&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==s.justifyContent&&'space-between'!==s.justifyContent;return(0,S.jsx)(f.default,{...b?{dataSet:{centre:'buttons'}}:{},style:[O.row,{gap:r},b&&{justifyContent:'center',flexWrap:'wrap'},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:n})}const $=()=>(0,S.jsx)(f.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const O=h.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},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:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:j.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:j.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',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,boxSizing:'border-box',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:{maxWidth:'100%',flexShrink:0,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:j.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}})},794,[795,796,30,800,34,379,395,236,402,295,41,410,102,426,36,840,844,845,5,846,847,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -945,7 +945,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/ __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},862,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},863,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},864,[]); -__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 h}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return g}}),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 S}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return v}}),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 D}}),_e.openShiftOf=T,_e.loggedBreakMins=$,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 U}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return x}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return F}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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',h=e=>!!e.out&&!!e.signOff,g={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},y=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return b(new Date(a,n-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),S=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),E=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],R=1271,v=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,D=[{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 T(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function $(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-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 B=()=>{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:{},chatRead:{},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:D.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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},U=(0,u.create)()((0,f.persist)((e,a)=>({...B(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:a,job:n,active:!0,level:q[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}: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,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}: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,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=y(t,e),o=y(n,e);i.shifts.filter(e=>e.date===a&&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 a=y(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,a)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??$({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=T(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:$({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),g.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,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>g.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};g.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(B()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=j().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,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=B();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}})),V=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,q={owner:'Owner',manager:'Manager',staff:'Staff'},x={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 K=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,a)=>a.indexOf(e)===t),W=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=K(e);return n.includes(a)||n.includes(a.split(' ')[0])},F=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return $}}),_e.openShiftOf=P,_e.loggedBreakMins=A,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return W}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return H}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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,t,a)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=a&&a<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,k={send:null},y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,I=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},w=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return y(new Date(a,n-1,i+t))},S=e=>w(e,-I(e)),E=(e,t)=>e.filter(e=>e.date===t),O=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),R=(e,t)=>t?e:e.filter(e=>e.published),v=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],_=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,$=[{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 P(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function A(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),M=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,N=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function C(){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,...B.includes(e.id)?{displayClock:!0}:{}}))}const B=['st-jack'];function U(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const V=()=>{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:{},chatRead:{},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:$.map(e=>({...e})),workEmail:'',staff:C(),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:U(),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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},q=(0,u.create)()((0,f.persist)((e,a)=>({...V(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:M('st'),name:t,role:a,job:n,active:!0,level:K[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:M('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:M('ph'),caption:t,tone:N[e.photos.length%N.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:M('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:M('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:M('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:M('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:M('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:I(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:I(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=w(t,e),o=w(n,e);i.shifts.filter(e=>e.date===a&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!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:I(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 a=w(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const a={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[a,...e.leave]})),a},setLeave:(t,n)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)}));const i=a().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:M('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??A({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:M('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=P(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:A({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:M('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),k.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:M('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:M('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};k.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(V()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=C().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,hourly:{...e.hourly,...U()},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=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=V();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=S(y(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:w(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}})),x=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,K={owner:'Owner',manager:'Manager',staff:'Staff'},W={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 F=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,a)=>a.indexOf(e)===t),G=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=F(e);return n.includes(a)||n.includes(a.split(' ')[0])},H=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},866,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},867,[]); __d(function(s,t,r,i,a,c,e){"use strict";a.exports={uri:"/car-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},868,[]); @@ -1065,7 +1065,7 @@ __d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModul __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},982,[804]); __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 u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).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 u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),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(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};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 u=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):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},983,[982]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return c.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const c=e.IS_CAR?b[n]:'nolink'===n&&'display'===e.APP_VARIANT?p:f[n];return(0,h.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${c}`,style:{borderRadius:16,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface,padding:14,gap:4},children:[(0,h.jsx)(u.T,{size:12,weight:"semibold",colour:l.colours.goldMuted,children:o.toUpperCase()}),(0,h.jsx)(u.T,{size:18,weight:"semibold",children:c})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]);const f={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},p="This Display isn't paired yet. Tap Not paired to pair it.",b={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when the car is back online.',nolink:'Not connected yet. Check the car has internet. If this stays, sign the car in again from Managers on your phone.'}},984,[846,34,102,985,2,840,794,25]); -__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return he}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),It(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=he.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Gt,i.readAccessLog=async function(){const e=he.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Qt}}),i.uploadOrderLogo=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Qt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=Jt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Qt).createSignedUrl(e,3600);if(t?.signedUrl)return Jt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Qt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return zt}}),i.claimInvite=ca,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(na,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ia,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=he.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=he.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(na),await T.kv.remove(ia),Se({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=he.getState().venueId;if(ae.PITCH||!s||'staff'!==he.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await ma('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'}}},i.claimInviteForSync=async function(e){const t=await ca(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return await ma('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return ma('staff_app_link_history',{p_venue:he.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await ma('revoke_staff_app_link',{p_venue:he.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=he.getState().venueId;if(!e||'staff'!==he.getState().kind)return{};try{const t=await ma('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return Number(await ma('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=he.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(sa,n),Sa(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(la,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:fa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(la,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(na,null);await T.kv.set(na,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||Sa()}return'revoked'!==i&&'unknown'!==i||await pa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await pa(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}Se({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await ma('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:fa(e)}}},i.carList=async function(){const e=he.getState().venueId;if(!e)return[];return(await ma('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await ma('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:fa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(sa),await ha();try{await _e().auth.signOut()}catch{}Se({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(na),await T.kv.remove(ia),await ha();try{await _e().auth.signOut()}catch{}Se({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Se({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ga,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return ma}}),i.mendSession=ya,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,wa=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,h.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,h.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Se({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 Ka(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void Se({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void Se({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];Se({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>Se({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>Se({mode:e?he.getState().venueId?'live':he.getState().mode:he.getState().venueId?'offline':he.getState().mode}))),await va()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ua}}),i.goLive=Ea,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ga}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Va.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Va.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),ma('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Ue(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Ue(a.from_time),to:Ue(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Va.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ga.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Va.get(a);e&&!e.ok&&Va.delete(a)}));const n=Va.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=he.getState().venueId;if(!n||'staff'!==he.getState().kind)throw new Error('Connect to your venue first.');const i=await ma('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),h=t(r[10]),S=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),D=t(r[21]),U=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),j=t(r[34]),B=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,U.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const he=(0,D.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Se=e=>he.setState(e),ye=e=>{const t=he.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=he.getState().mode;return'live'===e||'offline'===e||'connecting'===e};he.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),De=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Ue=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=De(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=De(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==he.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(j.useFloor.getState().plans[e]??(0,j.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:he.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&j.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>j.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>B.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>B.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>B.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>B.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(B.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==he.getState().kind&&('device'!==he.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>B.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>B.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(B.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={...B.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;B.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{B.useShellStore.getState().server[e]||B.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const je=new Set;function Be(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,h.isAnchorage)(e)&&(0,h.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,h.isAnchorage)(e)&&(s={...s,signOff:(0,h.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,h.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,h.isAnchorage)(e)&&(0,h.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,h.isAnchorage)(e)&&(0,h.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!je.has(e)){je.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){je.delete(e),Se({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,D.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==he.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,h.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${he.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=De(62),t=e=>ye('rota.manage')||e.staffId===he.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,S.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,S.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=De(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===he.getState().staffRef&&'open'===e.status,writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===he.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const gt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function mt(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function _t(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:j.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:gt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...St??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...St?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...St?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},St=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&j.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&mt(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=j.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,St=null;const yt=()=>new Date(Date.now()-2592e6).toISOString(),wt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},vt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},bt=()=>he.getState().perms.includes('*');function kt(){const e=()=>he.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!wt(t.ch)&&(t.from===e()||bt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('created_at',yt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=yt(),toRow:(e,t)=>{const a=wt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=vt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=vt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function It(e,t,a){const s=he.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':wt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Ot(e){const t=he.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':vt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function Rt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function At(e){const t=De(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===he.getState().staffRef,writable:()=>'staff'===he.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ut=e=>null==e||''===e?null:Number(e),Ct=e=>e.filter(e=>!e.startsWith('data:'));function Et(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',De(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Ct(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Tt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Ct(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Nt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function Mt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',De(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function xt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ut(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function Kt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function qt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Lt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function Pt(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===he.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:he.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function $t(e){const t=De(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,S.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Bt(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===he.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ft(e){const t=De(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=he.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===he.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Wt(e,t=!1){const a=De(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Ht(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Vt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Gt(){const e=he.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Qt='order-list-logos';const Jt=new Map;const zt=(0,D.create)(()=>({live:!1,known:!1}));async function Zt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const Xt=(e,t)=>Ee({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)}),ea='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function ta(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Xt(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function aa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ea).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Xt(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const sa='pair:v1',na='staff:v1',ia='staff:rejoin:v1';async function ra(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function oa(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ia,null);if(!e)return'none';try{await ua();const{data:t,error:a}=await ra(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ia),await T.kv.remove(na),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(na,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ia),'refused')}catch{return'offline'}}const da=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 ua(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}Se({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 ca(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ua();const{data:t,error:a}=await ra(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(na,n),await T.kv.set(ia,e),Re&&Sa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Se({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const la='car:request:v1',fa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function pa(){await T.kv.remove(na),await T.kv.remove(la),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ga(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ua(),!0}catch{return!1}}const ma=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let _a=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],_a&&(clearInterval(_a),_a=null)}async function Sa(){await ha(),await va()}async function ya(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ia,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await oa()&&(Sa(),!0)}catch{return!1}}(0,d.setSessionMender)(ya);let wa=o.VENUE_RID;async function va(){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 e=wa;try{if(Se({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Oa(e);const t=await T.kv.get(sa,null);let a=await T.kv.get(na,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await oa();if('offline'===t)return Se({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{wa===e&&Sa()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(na,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void Se({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await ma('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(sa):(await T.kv.remove(na),await T.kv.remove(ia)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))Se({mode:'offline'});else if(da(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await oa()&&setTimeout(()=>{wa===e&&Sa()},500)}i=he.getState().perms}Se({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await ka(n.venueId,e,n.kind)}catch(e){Se({mode:'local',lastError:String(e?.message??e)})}}const ba=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 ka(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ea(a),Oe.push(Ha(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[_t(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Wa()},onRemote:()=>{Wa()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[wa]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[wa],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&&V.useSetup.getState().patch(wa,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[wa]?.staffGrade!==a.sites[wa]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Be(a),La(a)];ye('wages.view')&&n.push(Pa(a)),'staff'===s&&(n.push(ut(),ct(),lt(),pt(a)),ft(e));const i='staff'===s&&await Yt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(kt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Vt('hr_questions')&&(n.push(ta(a)),ba.add('hr_questions'),aa(e,a)),'guest'!==s&&await Vt('sold_out_items')?(n.push(Wt(a,await Vt('sold_out_items','auto'))),ba.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Vt('sold_out_links')?(n.push(Ht(a)),ba.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Zt()&&(n.push(Rt(a)),'staff'===s&&n.push(At(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Vt('staff','nickname'),Ze=await Vt('staff','display_clock');const[e,t,s,i]=await Promise.all([Vt('scheduled_notifications'),Vt('order_lists'),Vt('venue_clock_area'),Vt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Bt(a),Ft(a)),ba.add('daily_tasks'),ba.add('daily_task_ticks')),e&&(n.push(qt(a)),Gt()),t&&n.push(Lt(a),Pt(a),$t(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ba.add(n)}if('guest'!==s&&await Vt('day_tips')){n.push(Mt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ba.add(e);await Vt('tips_pot_events')&&n.push(xt(a),Kt(a)),'staff'===s&&(n.push(Et(a),Tt(a),Nt(a)),ba.add('cash_ups'),ba.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Vt('scheduled_notifications')&&n.push(qt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Vt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ba.add('ingredient_prices'),await Vt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ba.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Vt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ba.add('specials_boards'));const c={onActivity:()=>Se({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Se({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Se({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await ma('whoami')??[]).some(t=>t.venue_id===e))return void(wa===a&&Sa());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await ma('whoami');if(!t?.some(t=>t.venue_id===e))return void(wa===a&&Sa())}catch(e){if(da(e)){const e=await oa();return void('ok'!==e&&'refused'!==e||wa===a&&Sa())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Ot(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(Se({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):Se({mode:'offline'}),!ye('wages.view')){const e=he.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ba.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const h=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);Se({lastSyncAt:(new Date).toISOString()})},e=>{Se({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(h)}),_a=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...he.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Ia='guest:sent:v1';async function Oa(e){Se({kind:'guest',venueSlug:e,perms:[]});try{const t=(await ma('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){Se({venueId:t.id,venueName:t.name}),await Ea(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),mt(e,t.app?.events)}await Ra(e),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Se({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Ra(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Aa(e)}async function Ra(e){const t=await ma('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Aa(e){let t=await T.kv.get(Ia,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ga())return;for(const a of n)try{const s=(await ma('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await ma('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Order: ${e?.message}`}))}await T.kv.set(Ia,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await ma('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Ia,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await ma('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Se({mode:(0,E.isOnline)()?he.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),_a=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ua={bridges:()=>Ie,restart:Sa},Ca='golive:v1:';async function Ea(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await Ka(e):(await T.kv.get(Ca+e,!1)||await Ka(e),await T.kv.get(Ma+e,!1)||(xa(e),await T.kv.set(Ma+e,!0)),await T.kv.get(Ta+e,!1)||(Na(),await T.kv.set(Ta+e,!0)))}const Ta='golive:v3:';function Na(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 Ma='golive:v2:';function xa(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 Ka(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,h.isDemoCard)(e)),log:m.log.filter(e=>!(0,h.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ca+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),j.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:[],swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ca+e,!0)}const qa=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function La(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(j.useFloor.getState().live[e]??{}).map(([e,t])=>qa(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===he.getState().kind||ye('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:he.getState().staffRef??ve}),fromRow:e=>qa(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>j.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>j.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Pa(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const $a='staff-avatars',ja=new Map;let Ba=!1;const Fa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Wa(){if(!Ba){Ba=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===he.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from($a).download(t);if(n||!s)continue;const i=await Fa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ba=!1}}}function Ha(e){const t=async()=>{const t=he.getState().staffRef,a=t?Ye.get(t)??he.getState().staffUuid:void 0;if(!t||!a||'staff'!==he.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from($a).remove([t]).catch(()=>{})};if(!s)return void(n&&(await ma('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Se({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 _e().storage.from($a).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await ma('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Se({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==he.getState().staffRef){const e=s[t].path;ja.set(t,null),ma('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from($a).remove([e])).catch(()=>{})}});return t(),s}const Va=new Map,Ga=(0,D.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),Ot(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=Se.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(Zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Qt,i.readAccessLog=async function(){const e=Se.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Jt}}),i.uploadOrderLogo=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Jt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=zt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Jt).createSignedUrl(e,3600);if(t?.signedUrl)return zt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Jt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return Zt}}),i.claimInvite=la,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(ia,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ra,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(ia),await T.kv.remove(ra),he({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Se.getState().venueId;if(ae.PITCH||!s||'staff'!==Se.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await _a('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'}}},i.claimInviteForSync=async function(e){const t=await la(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return _a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return await _a('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),_a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return _a('staff_app_link_history',{p_venue:Se.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await _a('revoke_staff_app_link',{p_venue:Se.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=Se.getState().venueId;if(!e||'staff'!==Se.getState().kind)return{};try{const t=await _a('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return Number(await _a('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=Se.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(na,n),ya(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(fa,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:pa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(fa,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(ia,null);await T.kv.set(ia,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||ya()}return'revoked'!==i&&'unknown'!==i||await ga(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await ga(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}he({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await _a('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:pa(e)}}},i.carList=async function(){const e=Se.getState().venueId;if(!e)return[];return(await _a('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await _a('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:pa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(na),await ha();try{await _e().auth.signOut()}catch{}he({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(ia),await T.kv.remove(ra),await ha();try{await _e().auth.signOut()}catch{}he({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}he({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ma,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return _a}}),i.mendSession=wa,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,va=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,S.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,S.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void he({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 qa(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void he({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void he({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];he({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>he({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>he({mode:e?Se.getState().venueId?'live':Se.getState().mode:Se.getState().venueId?'offline':Se.getState().mode}))),await ba()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ca}}),i.goLive=Ta,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Qa}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Ga.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Ga.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),_a('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:De(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:De(a.from_time),to:De(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Ga.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Qa.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ga.get(a);e&&!e.ok&&Ga.delete(a)}));const n=Ga.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Se.getState().venueId;if(!n||'staff'!==Se.getState().kind)throw new Error('Connect to your venue first.');const i=await _a('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),U=t(r[21]),D=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),B=t(r[34]),j=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,D.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const Se=(0,U.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),he=e=>Se.setState(e),ye=e=>{const t=Se.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=Se.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Se.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),Ue=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),De=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=Ue(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=Ue(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Se.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(B.useFloor.getState().plans[e]??(0,B.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:Se.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&B.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>B.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>j.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>j.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>j.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>j.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(j.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Se.getState().kind&&('device'!==Se.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>j.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>j.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(j.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={...j.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;j.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{j.useShellStore.getState().server[e]||j.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const Be=new Set;function je(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,S.isAnchorage)(e)&&(0,S.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,S.isAnchorage)(e)&&(s={...s,signOff:(0,S.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,S.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,S.isAnchorage)(e)&&(0,S.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,S.isAnchorage)(e)&&(0,S.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!Be.has(e)){Be.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Be.delete(e),he({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,U.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==Se.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,S.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${Se.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=Ue(62),t=e=>ye('rota.manage')||e.staffId===Se.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,h.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,h.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=Ue(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===Se.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.leaveRemote.decide=t=>!(!ye('rota.manage')||!(0,z.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(K.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),Oe.push(()=>{J.leaveRemote.decide=null})}function pt(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function gt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Se.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const mt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function _t(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function St(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:B.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...yt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...yt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...yt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},yt=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&B.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&_t(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=B.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,yt=null;const wt=()=>new Date(Date.now()-2592e6).toISOString(),vt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},bt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},kt=()=>Se.getState().perms.includes('*');function It(){const e=()=>Se.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!vt(t.ch)&&(t.from===e()||kt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('created_at',wt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=wt(),toRow:(e,t)=>{const a=vt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=bt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=bt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Ot(e,t,a){const s=Se.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':vt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Rt(e){const t=Se.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':bt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function At(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Ut(e){const t=Ue(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===Se.getState().staffRef,writable:()=>'staff'===Se.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ct=e=>null==e||''===e?null:Number(e),Et=e=>e.filter(e=>!e.startsWith('data:'));function Tt(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',Ue(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Et(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Nt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Et(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Mt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function xt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',Ue(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.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:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ct(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function qt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Lt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Pt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function $t(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Se.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Se.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Bt(e){const t=Ue(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,h.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Ft(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===Se.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Wt(e){const t=Ue(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Se.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===Se.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Ht(e,t=!1){const a=Ue(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Vt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Gt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Qt(){const e=Se.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();Zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Jt='order-list-logos';const zt=new Map;const Zt=(0,U.create)(()=>({live:!1,known:!1}));async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Xt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const ea=(e,t)=>Ee({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)}),ta='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function aa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ea(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function sa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ta).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ea(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const na='pair:v1',ia='staff:v1',ra='staff:rejoin:v1';async function oa(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function da(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ra,null);if(!e)return'none';try{await ca();const{data:t,error:a}=await oa(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ra),await T.kv.remove(ia),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(ia,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ra),'refused')}catch{return'offline'}}const ua=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 ca(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}he({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 la(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ca();const{data:t,error:a}=await oa(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(ia,n),await T.kv.set(ra,e),Re&&ya(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return he({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const fa='car:request:v1',pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function ga(){await T.kv.remove(ia),await T.kv.remove(fa),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ma(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ca(),!0}catch{return!1}}const _a=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let Sa=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],Sa&&(clearInterval(Sa),Sa=null)}async function ya(){await ha(),await ba()}async function wa(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ra,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await da()&&(ya(),!0)}catch{return!1}}(0,d.setSessionMender)(wa);let va=o.VENUE_RID;async function ba(){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 e=va;try{if(he({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Ra(e);const t=await T.kv.get(na,null);let a=await T.kv.get(ia,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await da();if('offline'===t)return he({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{va===e&&ya()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(ia,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void he({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await _a('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(na):(await T.kv.remove(ia),await T.kv.remove(ra)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))he({mode:'offline'});else if(ua(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await da()&&setTimeout(()=>{va===e&&ya()},500)}i=Se.getState().perms}he({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await Ia(n.venueId,e,n.kind)}catch(e){he({mode:'local',lastError:String(e?.message??e)})}}const ka=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 Ia(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ta(a),Oe.push(Va(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[St(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ha()},onRemote:()=>{Ha()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[va]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[va],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&&V.useSetup.getState().patch(va,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[va]?.staffGrade!==a.sites[va]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},je(a),Pa(a)];ye('wages.view')&&n.push($a(a)),'staff'===s&&(n.push(ut(),ct(),lt(),gt(a)),pt(e)),'staff'===s&&await Gt('staff_leave')&&(n.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Se.getState().staffRef&&'pending'===e.status||ye('rota.manage')),writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:Ee(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),ka.add('staff_leave'),ft(e));const i='staff'===s&&await Xt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(It(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Gt('hr_questions')&&(n.push(aa(a)),ka.add('hr_questions'),sa(e,a)),'guest'!==s&&await Gt('sold_out_items')?(n.push(Ht(a,await Gt('sold_out_items','auto'))),ka.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Gt('sold_out_links')?(n.push(Vt(a)),ka.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Yt()&&(n.push(At(a)),'staff'===s&&n.push(Ut(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Gt('staff','nickname'),Ze=await Gt('staff','display_clock');const[e,t,s,i]=await Promise.all([Gt('scheduled_notifications'),Gt('order_lists'),Gt('venue_clock_area'),Gt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Ft(a),Wt(a)),ka.add('daily_tasks'),ka.add('daily_task_ticks')),e&&(n.push(Lt(a)),Qt()),t&&n.push(Pt(a),$t(a),Bt(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ka.add(n)}if('guest'!==s&&await Gt('day_tips')){n.push(xt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ka.add(e);await Gt('tips_pot_events')&&n.push(Kt(a),qt(a)),'staff'===s&&(n.push(Tt(a),Nt(a),Mt(a)),ka.add('cash_ups'),ka.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Gt('scheduled_notifications')&&n.push(Lt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Gt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ka.add('ingredient_prices'),await Gt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ka.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Gt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ka.add('specials_boards'));const c={onActivity:()=>he({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>he({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{he({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await _a('whoami')??[]).some(t=>t.venue_id===e))return void(va===a&&ya());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await _a('whoami');if(!t?.some(t=>t.venue_id===e))return void(va===a&&ya())}catch(e){if(ua(e)){const e=await da();return void('ok'!==e&&'refused'!==e||va===a&&ya())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Rt(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(he({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):he({mode:'offline'}),!ye('wages.view')){const e=Se.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ka.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);he({lastSyncAt:(new Date).toISOString()})},e=>{he({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(S)}),Sa=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...Se.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Oa='guest:sent:v1';async function Ra(e){he({kind:'guest',venueSlug:e,perms:[]});try{const t=(await _a('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){he({venueId:t.id,venueName:t.name}),await Ta(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),_t(e,t.app?.events)}await Aa(e),he({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{he({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Aa(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Ua(e)}async function Aa(e){const t=await _a('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Ua(e){let t=await T.kv.get(Oa,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ma())return;for(const a of n)try{const s=(await _a('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await _a('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Order: ${e?.message}`}))}await T.kv.set(Oa,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await _a('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Oa,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await _a('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),he({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{he({mode:(0,E.isOnline)()?Se.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),Sa=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ca={bridges:()=>Ie,restart:ya},Ea='golive:v1:';async function Ta(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await qa(e):(await T.kv.get(Ea+e,!1)||await qa(e),await T.kv.get(xa+e,!1)||(Ka(e),await T.kv.set(xa+e,!0)),await T.kv.get(Na+e,!1)||(Ma(),await T.kv.set(Na+e,!0)))}const Na='golive:v3:';function Ma(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 xa='golive:v2:';function Ka(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 qa(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,S.isDemoCard)(e)),log:m.log.filter(e=>!(0,S.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ea+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),B.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:e.leave.filter(e=>(0,z.isUuid)(e.id)),swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ea+e,!0)}const La=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Pa(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(B.useFloor.getState().live[e]??{}).map(([e,t])=>La(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Se.getState().kind||ye('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:Se.getState().staffRef??ve}),fromRow:e=>La(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>B.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>B.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function $a(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ba='staff-avatars',ja=new Map;let Fa=!1;const Wa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ha(){if(!Fa){Fa=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Se.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from(Ba).download(t);if(n||!s)continue;const i=await Wa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Fa=!1}}}function Va(e){const t=async()=>{const t=Se.getState().staffRef,a=t?Ye.get(t)??Se.getState().staffUuid:void 0;if(!t||!a||'staff'!==Se.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from(Ba).remove([t]).catch(()=>{})};if(!s)return void(n&&(await _a('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void he({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 _e().storage.from(Ba).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await _a('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){he({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Se.getState().staffRef){const e=s[t].path;ja.set(t,null),_a('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from(Ba).remove([e])).catch(()=>{})}});return t(),s}const Ga=new Map,Qa=(0,U.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=O,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return b}}),_e.useGpCalcView=function(){const e=b();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...O(e)}:e,[e])},Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return v}}),_e.gpSyncItems=E,_e.gpSyncFromRow=P,_e.mergeGpItems=w,_e.gpSyncSpec=function(e,t){const i='ing'===e?'ingredient_prices':'card_costs';return{name:i,table:i,deletes:!1,list:()=>E(b.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:C(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>P(e,t),apply:(t,i)=>b.setState(n=>w(n,e,t,i)),subscribe:t=>b.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i.cardCosts===n.cardCosts)||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),r=(e=a)&&e.__esModule?e:{default:e},d=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,t,i,n,s,a=0,r=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:a,allergens:r}),m=e=>new Date(Date.now()-864e5*e).toISOString(),S={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},k=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...h('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...h('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(S[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:m(7*(i.length-t))}))})),y=(e,t,i,n,s,a,r,d="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:a,status:r,description:d,allergens:[]}),I=[y('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),y('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),y('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),y('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),y('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),y('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function O(e){const t=e=>I.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),a=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),r=e=>{const t=k.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},d=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(d).forEach(e=>e.lines.forEach(e=>a.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>a.has(e.id)||!r(e)),cardCosts:d}}const b=(0,d.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:k,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),a=n.ingredients.map(e=>e.id===t.id?t:e);let r=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,a,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(d(t)-d(s))/d(s)*100;i.length&&(r=[{id:f('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...r].slice(0,20))}const d=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:d?a.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):a,alerts:r})},addPricePaid:(e,t,n)=>{const s=i(),a=s.ingredients.find(t=>t.id===e);if(!(a&&t>0))return;const r=[...a.prices?.length?a.prices:[{p:a.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),d={...a,prices:r};i().saveIngredient({...d,packPrice:(0,o.costingPrice)(d,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=f('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)}))}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>r.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...O({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&b.persist.rehydrate()});const v='1970-01-01T00:00:00.000Z',C=e=>JSON.parse(JSON.stringify(e));function E(e,t){const i=O(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??v,doc:C({...e,updatedAt:e.updatedAt??v})})):Object.entries(i.cardCosts).map(([e,t])=>({id:e,updatedAt:t.updatedAt??v,doc:C({...t,updatedAt:t.updatedAt??v})})),s=new Set(n.map(e=>e.id)),a=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...a]}function P(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('card'!==e||Array.isArray(s.lines))?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function w(e,t,i,n){const s={...e.gone??{}},a=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e.cardCosts??{})),r=[];for(const e of i){const i=`${t}:${e.id}`,n=a.get(e.id),d=n?n.updatedAt??v:void 0,c=s[i];if(e.deletedAt){if(n&&d>e.deletedAt)continue;a.delete(e.id),(!c||ce.updatedAt)continue;if(n&&d>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?a.set(e.id,o):r.push([e.id,o]),delete s[i]}for(const e of n)a.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...a.values(),...r.map(([,e])=>e)],gone:s}}return{cardCosts:Object.fromEntries([...a.entries(),...r]),gone:s}}},986,[806,34,807,5,808,815,818,987,832,839]); __d(function(_g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return i}}),e.priceStats=c,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return o}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return l}}),e.convert=function(t,n,i){const c=u[n],o=u[i];return c&&o&&c.dim===o.dim?t*c.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return d}}),e.perBaseUnit=function(t){const n=u[t.packUnit];if(!(n&&t.packSize>0))return null;const i=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/i*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/i*1e3,per:'litre'}:{pence:t.packPrice/i,per:'item'}},Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return g}}),e.lineCost=m,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return p}}),e.suggestAllergens=function t(n,i,c=[],o=0){const s=new Set;for(const u of n.lines)if(u.ingId.startsWith('dish:')){const n=c.find(t=>t.id===u.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>s.add(t)),t(n,i,c,o+1).forEach(t=>s.add(t)))}else i.find(t=>t.id===u.ingId)?.allergens?.forEach(t=>s.add(t));return[...s]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:h(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return S}}),e.suggestForMultiple=function(t,n,i,c,o){const s=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?b(Math.ceil(s)):Math.ceil(s)},e.amountLabel=k,e.cardCostSummary=function(t,n,i,c){const o=(t?.lines??[]).map(t=>{const i=n.find(n=>n.id===t.ingId);return{line:t,name:i?.name??'Removed ingredient',cost:m(t,n),label:k(t,i)}}),s=o.reduce((t,n)=>t+n.cost,0),u=Math.max(1,t?.portions||1),a=s/u,l=t?.target??i.defaultTarget??70,f=a>0?y(a,l,i.vatPct,i.pricePoints):null,d=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,g=d??(c&&c>0?c:f),p=g&&a>0?P(a,g,i.vatPct):null;return{lines:o,batch:s,perPortion:a,target:l,suggested:f,price:g,priceIsSuggested:!(d||c&&c>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,l):null,missing:o.filter(t=>t.cost<=0).length}};var t=r(_d[0]);const n=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],i=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function c(t,n=5){const c=i(t),o=c.slice(-Math.max(1,n)),s=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:s,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",i=5)=>'average'===n?c(t,i).avg:c(t,i).latest;const s={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},u={kg:{dim:'mass',f:s.kg},g:{dim:'mass',f:s.g},oz:{dim:'mass',f:s.oz},lb:{dim:'mass',f:s.lb},stone:{dim:'mass',f:s.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=['kg','g','stone','lb','oz','L','ml','each'],l=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const f=(t,n)=>[...'mass'===u[t].dim?['g','kg','oz','lb']:'vol'===u[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],d=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;const g=(t,n)=>{const i=(t?.servingName||'serving').trim().toLowerCase();return 1===n?i:/(s|sh|ch|x)$/.test(i)?`${i}es`:`${i}s`};function m(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?p(o,n,i,c+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=d(o);return null==n?0:t.qty*n}const s=u[o.packUnit],a=u[t.unit];if(!a||s.dim!==a.dim)return 0;const l=o.packPrice/(o.packSize*s.f),f=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*a.f*l/(1-f/100)}const p=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+m(o,n,i,c),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,i){const c=h(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}}function b(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}function y(t,n,i,c){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+i/100);return c?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const S=t=>`${t.toFixed(1)}x`;function k(t,n){const i=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${i} ${g(n,t.qty)}`:'each'===t.unit?`${i} ${1===t.qty?'item':'items'}`:`${i} ${l(t.unit,t.qty)}`}},987,[982]); __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 f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});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:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},988,[]); @@ -1088,7 +1088,7 @@ __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1006,[975]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1007,[1003,975,1008]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1009,[]); __d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return v}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class v{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=c(t),this.saveKnown())})}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=s.get(e);if(!this.pending(e)){if(f){const t=c(f);if(this.rev(f)===this.rev(h)){this.known[e]=l,t!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(h),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,h.length>l&&!f)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||e.syncable(s)&&e.writable()&&this.known[n]!==t&&!this.pending(n)&&this.write(s)}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1010,[1005,931,1003,975,1007]); __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 b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);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??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`: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}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},1011,[829,808,839,815,818,827,1012,1013]); @@ -1122,7 +1122,7 @@ __d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},1038,[1039]); __d(function(g,r,i,a,m,e,d){function n(n,t){const o=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o,s){const u=()=>r.importAll(t,s);{const l=o?.[String(t)];if(Array.isArray(l)){const c=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(c?.isReady?.(l))return u();const f=n(t,o);if(null!=f)return f.then(u);throw new Error(`Cannot import module ${s??t}: the async bundle loader is unavailable. Load the initial Expo bundle before importing these chunks: ${l.join(', ')}`)}try{return u()}catch(s){const l=n(t,o);if(null!=l)return l.then(u);throw s}}const l=n(t,o);return null!=l?l.then(u):u()}function o(n,o,s){const u=t(n,o,s),l=Promise.resolve(u);return l._result=u,l}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},1039,[]); __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)},1040,[34]); __d(function(_g,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,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return p}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[w,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(p,Math.ceil(f.w)+4),j=e&&l>0&&l-2*vu(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.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 t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const w=()=>f(e=>e.layers.some(e=>e.own)),p=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1041,[34,236,402,102,815,840,794,1040,25]); -__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.120'},1042,[]); +__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.121'},1042,[]); __d(function(_g,_r,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'},1043,[796,991,34,379,402,102,794,840,1021,1022,865,1025,1026,1027,992,1044,985,1045,994,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1044,[]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1045,[1046,931,985,846]); @@ -1179,7 +1179,7 @@ __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return z}}),_e.useTableNames=B,_e.resetTableLive=N,_e.seatBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'seated'),N(e,t.table)},_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=M,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return F}}),_e.TablePicker=A,_e.WalkInSheet=R,_e.AssignTableSheet=W,_e.undoNotice=E,_e.NewBookingSheet=_,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[n,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,O.jsxs)(O.Fragment,{children:[s?(0,O.jsx)(R,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:E}):null,l?(0,O.jsx)(_,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,i.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,O.jsx)(W,{booking:n.b,combine:n.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),O=_r(_d[27]);const z=Array.from({length:12},(e,t)=>String(t+1));function B(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function N(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function M(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=B(e),a=(0,S.useFloor)(t=>t.live[e])??{},n=(0,S.usePlan)(e),i=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(i,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[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,S.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,x.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 F=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function A({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=n?6:8,y=n?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(i??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,O.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],i=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!i,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,O.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:i?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,O.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,O.jsx)(T.T,{weight:"bold",size:22,colour:i?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,O.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,O.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,O.jsx)(T.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const L=[1,2,3,4,5,6,7,8];function R({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:y,r:w,now:C}=(0,p.useCtx)(15e3),D=M(y,C),[I,$]=(0,r.useState)(2),[P,z]=(0,r.useState)(!1),[B,F]=(0,r.useState)(i??null),R=(0,S.usePlan)(y),W=(0,f.useBookings)(y),E=(0,v.useBlocks)(e=>e.blocks),_=(0,v.closedAreasAt)(E,y,(0,x.ymd)(C),(0,x.hm)(C)),H=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(D).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(R,W.filter(e=>e.date===(0,x.ymd)(C)),e,I,C,(0,k.turnFor)(I,w.settings.turnMins),90,void 0,{closed:_})?.table??null},[R,W,D,I,_.size,C.getTime()]);(0,r.useEffect)(()=>{B&&(0,S.tablesOf)(B).some(e=>'Closed'===D[e]?.label)&&F(null)},[B,_.size]);const[U,q]=(0,r.useState)(!1),[V,Y]=(0,r.useState)(''),G=(e,t=String(e),s=()=>{z(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,O.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,O.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},K=(0,O.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),Q=(0,O.jsxs)(b.default,{style:{gap:8,width:n?256:void 0},children:[(0,O.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,O.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[L.map(e=>G(e)),G(9,'9+',()=>{z(!0),$(e=>e>=9?e:9)})]}),P?K:null]}),[X,J]=(0,r.useState)(!1),Z=async(t=B)=>{if(!X){J(!0);try{const s=await f.repo.bookings.seatWalkIn(y,I,t??void 0,V);N(y,t??void 0),a(s),e()}finally{J(!1)}}},ee=(0,O.jsxs)(b.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,O.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,O.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),B?(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>F(null)}):null]}),(0,O.jsx)(A,{use:D,value:B,onPick:e=>{D[e]&&!D[e].busy?Z(e):F(B===e?null:e)},big:n,dense:n,best:H,bestSet:(0,u.bestTables)(R)}),(0,O.jsxs)(T.Muted,{children:["Tap a free table to seat them there",H&&!B?` (suggested for ${I}: ${(0,l.tableNumbers)(H)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(C)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,O.jsx)(T.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${B?` \xb7 ${(0,l.tableNumbers)(B)}`:''}`,disabled:X,onPress:()=>{Z()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,O.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[Q,ee]}):(0,O.jsxs)(O.Fragment,{children:[Q,ee]}),(0,O.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[U?(0,O.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>q(!0)}),(0,O.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,O.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function W({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,p.useCtx)(15e3),i=M(o,n),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(n)),t,e.partySize,n,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,n.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),B=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&N(o,l),t()},R=C?(0,O.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,O.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,O.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,O.jsx)(b.default,{testID:"combine-short",children:(0,O.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,O.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>L(I)}),(0,O.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,O.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${F(e)}`,testID:"assign-table-sheet",footer:R,children:[v&&!C?(0,O.jsx)(b.default,{testID:"assign-suggested",children:(0,O.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,O.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,O.jsx)(A,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await L([e])}})]})}function E(e){(0,i.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${F(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function _({date:e,onClose:t,wide:i,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:B}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,F]=(0,r.useState)(ee.blocks),[R,W]=(0,r.useState)(!1),[E,_]=(0,r.useState)(''),[H,U]=(0,r.useState)(2),[q,V]=(0,r.useState)(null),[Y,G]=(0,r.useState)(''),[K,Q]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ne=(0,S.usePlan)(u),ie=(0,P.dogSetUp)(ne),re=!0===te.dog&&ie,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(H,c.settings.turnMins),be=A.filter(e=>e.date===M),ge=e=>(0,k.freeTablesAt)(ne,be,H,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(L,u,M,e)}),he=re&&q?ge(q):[];(0,r.useEffect)(()=>{ae(null)},[re,q,H]);const pe=(0,y.bookingSlots)(c,ue,e=>A.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),H,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0)),me=(0,w.ukPhone)(K),[fe,ye]=(0,r.useState)(!1),ke=q?pe.find(e=>e.time===q):void 0,xe=ke&&ke.left=2&&!!q&&(!xe||fe)&&(0,o.validParty)(H)&&me.ok&&(0,w.emailOk)(X)&&(!je||we&&R)&&(!re||he.length>0)&&!Te,ve=te.wheelchair>0||te.stepFree;return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:i?760:void 0,testID:"booking-sheet",children:[(0,O.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:H,audience:"staff"}),te.dog&&!ie?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(F(e),V(null),W(!1))}}),(0,O.jsxs)(T.Row,{gap:6,children:[(0,O.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,O.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,O.jsx)(T.Field,{label:"Name",value:E,onChangeText:_,placeholder:"e.g. Reid",testID:"nb-name"}),(0,O.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:K,onChangeText:Q,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&K?(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,O.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,O.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(T.T,{center:!0,children:"Covers"}),(0,O.jsx)(s.PartySizeInput,{value:H,onChange:e=>{U(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!ge(e.time).length||!(0,D.dogTimeOk)(c,A,M,e.time,de);return(0,O.jsx)(T.Chip,{label:e.time,sub:(0,v.blockAt)(L,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':e.left>0?`${e.left} left`:'Full',disabled:(e.past??!e.available)||t,selected:q===e.time,onPress:()=>{V(e.time),W(!1),ye(!1)}},e.time)})}),xe?(0,O.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(H,xe.left,xe.time)}),(0,O.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&q?(0,O.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,O.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,O.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ne.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),he.length?(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:he.slice(0,10).map((e,t)=>(0,O.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${ve&&(0,P.accessibleSetUp)(ne)&&!(0,P.isAccessible)(ne,e.table)?' \xb7 not step-free':''}`,selected:(le??he[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",H," at ",q,". Try another time."]})]}):null,je?(0,O.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",je.from,"\u2013",je.to,je.reason?` (${je.reason})`:'']}),we?(0,O.jsx)(T.Chip,{label:R?'Manager override on':'Override and book anyway',selected:R,onPress:()=>W(e=>!e)}):(0,O.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,O.jsx)(b.default,{testID:"nb-closed",children:(0,O.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,O.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:H,date:M,time:q,today:(0,x.ymd)(h),bookings:A,audience:"staff",showTables:!1!==c.settings.tableRequests}),ve&&!(0,P.accessibleSetUp)(ne)?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(T.Field,{label:"Notes (optional)",value:Y,onChangeText:G,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,n.depositDue)((0,n.depositOf)(c.settings),H)?(0,O.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(c.settings),H))," (",(0,a.gbp)((0,n.depositOf)(c.settings).perPersonPence)," per person for ",(0,n.depositOf)(c.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,O.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),Te?(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",q,". Try another time: dogs are very welcome then."]}):null,(0,O.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Se,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||he.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:H,date:M,time:q,notes:Y.trim(),security:(0,n.depositDue)((0,n.depositOf)(c.settings),H)?'deposit':'none',depositPaid:0,...(0,n.depositDue)((0,n.depositOf)(c.settings),H)?{depositDue:(0,n.depositDue)((0,n.depositOf)(c.settings),H),depositPolicy:(0,n.depositWords)((0,n.depositOf)(c.settings),H,c.name).join(' '),depositRefundable:(0,n.depositOf)(c.settings).refundable,depositCutoffHours:(0,n.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??he[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,B)).catch(()=>{}),d?.({date:M,time:q,name:E.trim()}),t()}})]})}},1096,[796,1097,1098,829,836,14,1099,34,828,402,102,846,1100,848,1104,1079,827,840,833,794,1014,1011,1105,1106,1111,1081,1075,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1097,[34,402,412,102,1098,840,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const f=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(f)?f:u))},f=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),b=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`},1098,[]); -__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{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]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); +__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); __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 c.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return c.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return D}}),_e.useShiftManager=b,_e.useSignedIn=h,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(w),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),c=h(),m=o||'staff'===s.APP_VARIANT,y=(0,t.useContext)(D),O=b(),S=m?y&&O?'manager':'staff':c?p(i,l(c)):i,M=(0,r.useOwner)(e=>e.staff),A=(0,n.useRestaurant)(u),P=(0,n.useNow)(e),I=c?c.id:m&&f?f:d[S],R=M.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:A,now:P,role:S,me:R,meId:I,today:(0,a.venueYmd)(P),signedIn:!!c}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return S}}),_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()-O(n));const c=(0,a.ymd)(f),d=(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===O(t)&&e.date>=c&&e.date<=d&&!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,c=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,...c})})}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 M}}),_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()-O(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=h(),t=(0,r.useOwner)(e=>e.hourly);return e?t:A};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]),c=_r(_d[10]);const d={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=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,p=(e,t)=>m[e]>m[t]?t:e,w=(0,t.createContext)(!1),y=()=>(0,t.useContext)(w),D=(0,t.createContext)(!1);function b(){const e=(0,t.useContext)(w)||'staff'===s.APP_VARIANT,n=h(),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 h(){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 O=e=>(e.getDay()+6)%7,S=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const M=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const A={}},1100,[806,34,848,865,827,846,985,1101,997,15,1103]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); __d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[1103]); @@ -1222,7 +1222,7 @@ __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1139,[931,974,985,975]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1140,[1129,982,34,379,102,794,865,988,836,840,1100,1124,1018,1141,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1141,[796,804,982,34,379,236,402,102,794,1016,981,983,836,1017,840,1124,25]); -__d(function(g,_r,_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:u,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),f=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,o.useLiveState)();if('ready'!==$)return(0,p.jsx)(o.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,p.jsxs)(n.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface,padding:u?10:12,gap:6},b],children:[(0,p.jsxs)(r.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:u?1:void 0},children:[(0,p.jsxs)(i.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:["LIVE \xb7 ",I]}),(0,p.jsx)(i.T,{size:12,colour:c.colours.muted,children:"Tap to update \u203a"})]}),(0,p.jsx)(i.Row,{gap:u?14:18,style:{flex:u?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,p.jsx)(i.T,{size:u?42:34,weight:"bold",colour:s<=0?c.colours.red:o?c.colours.amber:c.colours.text,style:{lineHeight:u?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,p.jsxs)(i.T,{size:13,colour:o?c.colours.amber:c.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!u&&L.length?(0,p.jsxs)(n.default,{testID:"shellfish-low",style:{backgroundColor:c.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,p.jsxs)(i.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.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,p.jsx)(i.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,u||L.length||!h?null:(0,p.jsx)(r.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,p.jsx)(i.T,{size:13,colour:c.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,p.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:u=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,f]=(0,s.useState)(!1);if(!h.items.length)return null;const x=u>=80,w=Math.max(28,Math.min(52,Math.round(.6*u))),C=Math.max(22,Math.min(34,Math.round(.42*u)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.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:()=>f(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:u,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,r=b[t.key]??0,d=Math.max(0,o-r),y=d<=0,f=y||h.isLow(t.key);return(0,p.jsxs)(n.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:f?'rgba(255,107,94,0.07)':'transparent',...l.look.web(f?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,p.jsx)(i.T,{size:C,children:t.icon}),(0,p.jsx)(i.T,{size:w,weight:"bold",colour:f?'#FF8E82':c.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,p.jsxs)(n.default,{style:{gap:0},children:[(0,p.jsx)(i.T,{size:x?15:13,weight:"semibold",colour:f?'#FFB3AA':c.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),f&&u>=60?(0,p.jsx)(i.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,p.jsxs)(i.T,{size:x?14:12,weight:"semibold",colour:r?c.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,r)]})]})]},t.key)})}),y?(0,p.jsx)(j,{rid:e,by:t,app:o,onClose:()=>f(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=w,_e.SundayRoastChip=function(e){return(0,p.jsx)(w,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_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]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]);const f=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,u.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:r,onOrder:u,group:h}){const b=(0,d.useShellfish)(e,o,l,h),y='roast'===h,[k,j]=(0,s.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,k[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):k,[C,S]=(0,s.useState)(null),$=x(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&j(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=k[e.key]&&k[e.key]!==Math.round(b.counts[e.key]??0));return(0,p.jsxs)(i.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,p.jsx)(i.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,p.jsxs)(n.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface2},children:[(0,p.jsxs)(i.T,{center:!0,size:13,colour:c.colours.muted,children:[s.icon," ",s.plural]}),(0,p.jsx)(i.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?c.colours.amber:c.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,p.jsx)(i.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,p.jsx)(i.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,p.jsx)(n.default,{style:{minHeight:52}})]},s.key)})}),(0,p.jsx)(i.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,a.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,a.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,p.jsx)(i.Banner,{kind:"success",title:C}):null,(0,p.jsxs)(n.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:c.colours.gold,backgroundColor:c.colours.goldTint},children:[(0,p.jsx)(i.T,{weight:"semibold",colour:c.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,p.jsxs)(i.Row,{gap:10,children:[(0,p.jsxs)(i.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,p.jsx)(i.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,w[s.key]||0)}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,p.jsx)(i.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=k[e.key]&&b.recount(e.key,Math.max(0,Math.round(k[e.key])))}),j({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,p.jsx)(i.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),j({})},style:{minHeight:54}})]}),u?(0,p.jsx)(i.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:u}):null,(0,p.jsxs)(n.default,{style:{gap:2},children:[(0,p.jsx)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,p.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(i.T,{size:13,style:{flex:1},children:(0,a.describe)(e,b.itemOf(e.kind))}),(0,p.jsxs)(i.Muted,{children:[f(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,p.jsx)(i.Row,{wrap:!0,gap:6,children:b.synced?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"ok",label:"Shared live"}),(0,p.jsx)(i.Muted,{children:"Every paired device sees the same count."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"neutral",label:"Saved on this device"}),(0,p.jsx)(i.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function w({rid:e,by:t,app:o,size:u="m",group:b}){const y=(0,d.useShellfish)(e,t,o,b),f=k(e),[x,w]=(0,s.useState)(!1),C=(0,h.useNow)(3e4);if(!y.items.length)return null;if('roast'===b&&!(0,a.isSundayIn)(C))return null;const S='m'===u?20:17,$='xs'!==u;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.default,{testID:'roast'===b?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===b?'Sunday roast: ':''}${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(y.counts[t.key]??0)-(f[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>w(!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:y.items.map((t,s)=>{const o=y.counts[t.key]??0,l=f[t.key]??0,r=Math.max(0,o-l),d=r<=0,u=d||y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,r)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:u?'rgba(255,107,94,0.10)':'transparent'},children:[(0,p.jsx)(i.T,{size:S-2,children:t.icon}),(0,p.jsx)(i.T,{size:S,weight:"bold",colour:d?c.colours.red:u?c.colours.amber:c.colours.text,style:{lineHeight:S+4},children:(0,a.fmtStockCount)(e,t,r)}),$&&(l||d||u)?(0,p.jsx)(i.T,{size:10,weight:"semibold",colour:d||u?'#FFB3AA':c.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),x?(0,p.jsx)(j,{rid:e,by:t,app:o,group:b,onClose:()=>w(!1)}):null]})}},1142,[982,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); +__d(function(g,_r,_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=x,_e.ShellfishTile=function({rid:e,by:t,app:s,big:r,onOrder:c,style:b}){const y=(0,u.useShellfish)(e,t,s),p=x(e),[k,C]=(0,o.useState)(!1),S=j(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,l.useLiveState)();if('ready'!==$)return(0,f.jsx)(l.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(i.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface,padding:r?10:12,gap:6},b],children:[(0,f.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:r?1:void 0},children:[(0,f.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:["LIVE \xb7 ",I]}),(0,f.jsx)(a.T,{size:12,colour:h.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(a.Row,{gap:r?14:18,style:{flex:r?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)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(a.T,{size:r?42:34,weight:"bold",colour:s<=0?h.colours.red:o?h.colours.amber:h.colours.text,style:{lineHeight:r?50:42},children:(0,d.fmtStockCount)(e,t,s)}),(0,f.jsxs)(a.T,{size:13,colour:o?h.colours.amber:h.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.goldLight,children:["Reserved: ",(0,d.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,d.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!r&&L.length?(0,f.jsxs)(i.default,{testID:"shellfish-low",style:{backgroundColor:h.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.map(t=>`${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,d.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),c?(0,f.jsx)(a.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:c}):null]}):null,r||L.length||!c?null:(0,f.jsx)(n.default,{accessibilityRole:"button",onPress:c,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(a.T,{size:13,colour:h.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),k?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>C(!1),onOrder:c?()=>{C(!1),c()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:l=76}){const c=(0,u.useShellfish)(e,t,s),b=x(e),[y,p]=(0,o.useState)(!1);if(!c.items.length)return null;const k=l>=80,j=Math.max(28,Math.min(52,Math.round(.6*l))),C=Math.max(22,Math.min(34,Math.round(.42*l)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${c.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,c.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:l,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...r.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:c.items.map((t,s)=>{const o=c.counts[t.key]??0,n=b[t.key]??0,u=Math.max(0,o-n),y=u<=0,p=y||c.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,u)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:k?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...r.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)(a.T,{size:C,children:t.icon}),(0,f.jsx)(a.T,{size:j,weight:"bold",colour:p?'#FF8E82':h.colours.text,style:{lineHeight:Math.round(1.15*j),letterSpacing:-.5,minWidth:Math.round(.85*j),textAlign:'center'},children:(0,d.fmtStockCount)(e,t,u)}),(0,f.jsxs)(i.default,{style:{gap:0},children:[(0,f.jsx)(a.T,{size:k?15:13,weight:"semibold",colour:p?'#FFB3AA':h.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&l>=60?(0,f.jsx)(a.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,d.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(a.T,{size:k?14:12,weight:"semibold",colour:n?h.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,d.fmtStockCount)(e,t,n)]})]})]},t.key)})}),y?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=w,_e.ShellfishChip=C,_e.SundayRoastChip=function(e){return(0,f.jsx)(C,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),r=_r(_d[4]),n=e(_r(_d[5])),i=e(_r(_d[6])),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]),f=_r(_d[15]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function x(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.ymd)((0,b.useNow)(6e4));return(0,y.reservedOn)(t,o,(0,y.reservablesOf)(s))}function j(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function w({rid:e,by:s,app:l,onClose:r,onOrder:n,group:c}){const b=(0,u.useShellfish)(e,s,l,c),y='roast'===c,[p,x]=(0,o.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,p[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):p,[C,S]=(0,o.useState)(null),$=j(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&x(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=p[e.key]&&p[e.key]!==Math.round(b.counts[e.key]??0));return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,f.jsx)(a.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,f.jsxs)(i.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(a.T,{center:!0,size:13,colour:h.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(a.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?h.colours.amber:h.colours.text,style:{lineHeight:56},children:(0,d.fmtStockCount)(e,s,o)}),(0,f.jsx)(a.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(a.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(i.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(a.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,d.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,d.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,f.jsx)(a.Banner,{kind:"success",title:C}):null,(0,f.jsxs)(i.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,f.jsx)(a.T,{weight:"semibold",colour:h.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsxs)(a.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(a.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,d.fmtStockCount)(e,s,w[s.key]||0)}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,f.jsx)(a.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=p[e.key]&&b.recount(e.key,Math.max(0,Math.round(p[e.key])))}),x({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,f.jsx)(a.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,d.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),x({})},style:{minHeight:54}})]}),n?(0,f.jsx)(a.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:n}):null,(0,f.jsxs)(i.default,{style:{gap:2},children:[(0,f.jsx)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,style:{flex:1},children:(0,d.describe)(e,b.itemOf(e.kind))}),(0,f.jsxs)(a.Muted,{children:[k(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:b.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(a.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(a.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function C({rid:e,by:t,app:l,size:c="m",group:y}){const p=(0,u.useShellfish)(e,t,l,y),k=x(e),[j,C]=(0,o.useState)(!1),S=(0,b.useNow)(3e4);if(!p.items.length)return null;if('roast'===y&&!(0,d.isSundayIn)(S))return null;const $='m'===c?20:17,L='xs'!==c;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:'roast'===y?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===y?'Sunday roast: ':''}${p.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,Math.max(0,(p.counts[t.key]??0)-(k[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>C(!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)',...r.look.web({cursor:'pointer'})}),children:p.items.map((t,o)=>{const l=p.counts[t.key]??0,r=k[t.key]??0,n=Math.max(0,l-r),u=n<=0,c=u||p.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,n)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(a.T,{size:$-2,children:t.icon}),(0,f.jsx)(a.T,{size:$,weight:"bold",colour:u?h.colours.red:c?h.colours.amber:h.colours.text,style:{lineHeight:$+4},children:(0,d.fmtStockCount)(e,t,n)}),!L||!(r||u||c)||u&&s.IS_CAR?null:(0,f.jsx)(a.T,{size:10,weight:"semibold",colour:u||c?'#FFB3AA':h.colours.goldLight,children:u?'none left':r?`${(0,d.fmtStockCount)(e,t,r)} res`:'low'})]},t.key)})}),j?(0,f.jsx)(w,{rid:e,by:t,app:l,group:y,onClose:()=>C(!1)}):null]})}},1142,[982,846,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); __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}},1143,[5,797,841,798,236,844]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,x.jsxs)(r.default,{style:{gap:12},children:[(0,x.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,x.jsx)(y,{}):'take'===t?(0,x.jsx)(j,{}):(0,x.jsx)(f,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]);function y(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[y,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===y?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,x.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,x.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,x.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,x.jsx)(p.Seg,{value:y,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,x.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,x.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,x.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,x.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,x.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,x.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,x.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function j(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[y,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=y[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,x.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,x.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,x.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,x.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,x.jsx)(o.T,{size:16,children:e.name}),(0,x.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,x.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:y[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(y[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:y[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,x.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,x.jsx)(o.Muted,{children:"\u2014"}):(0,x.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,x.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,x.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,x.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function f(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,x.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,x.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,x.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,x.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,x.jsx)(v,{id:e.id,me:t}):null]},e.id)})]})}function v({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[y,j]=(0,l.useState)(b.lines.map(e=>({...e}))),f=(e,t)=>j(i=>i.map(i=>i.ing===e?{...i,...t}:i)),v='expected'!==b.status,k=(0,l.useMemo)(()=>y.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),w=k.filter(e=>Math.abs(e.pct)>=.5),$=y.reduce((e,t)=>e+t.received*t.price,0);return(0,x.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[k.map(({l:e,i:i,short:l,pct:d})=>(0,x.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,x.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,x.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,x.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>f(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!v?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>f(e.ing,{price:100*(Number(t.replace(',','.'))||0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,x.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,x.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round($))]}),S.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[S.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,w.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[w.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,v?(0,x.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,x.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,y,i,[S.length?`${S.length} short`:'',w.length?`${w.length} price changes`:''].filter(Boolean).join(', '))})]})}},1144,[796,1016,1129,982,34,402,102,794,865,836,840,1124,1018,25]); __d(function(g,_r,_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,100][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:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,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))]})}},1145,[796,1146,34,402,102,426,794,865,836,827,840,1147,1100,1050,25]); @@ -1235,378 +1235,382 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1152,[34,402,102,1153,840,794,25]); __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])},1153,[34,900,25]); __d(function(g,_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 M}}),_e.allocate=O,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:T,now:C,today:S,role:k,meId:v,me:D}=(0,x.useCtx)(6e4),B=(0,u.useOwner)(e=>e.staff),F=(0,u.useOwner)(e=>e.attendance),N=(0,u.useOwner)(e=>e.shifts),R=(0,u.useOwner)(e=>e.tronc),E=(0,u.useOwner)(e=>e.troncCash),L=(0,u.useOwner)(e=>e.troncHistory),z=(0,u.useOwner)(e=>e.troncLog),_=(0,c.useOrders)(T),V=(0,j.useVenuePay)(T).pay,[q,H]=(0,i.useState)(-1),[U,W]=(0,i.useState)(''),[Y,K]=(0,i.useState)(!1),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(R.text),[Z,ee]=(0,i.useState)(null),te='staff'!==k,se='owner'===k,{s:oe,e:ie,key:ne}=(0,j.venueRange)(V,'tips',q,C),re=`${(0,h.niceDate)(oe)} \u2013 ${(0,h.niceDate)(ie)} ${ie.getFullYear()}`,le=L.find(e=>e.key===ne),ae=e=>u.useOwner.getState().setOwner({tronc:{...R,...e}}),de=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ce=Math.round((ie.getTime()-oe.getTime())/864e5)+1,ue=(0,i.useMemo)(()=>{let e=_.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(oe)&&e.createdAt.slice(0,10)<=(0,h.ymd)(ie)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!de)for(let t=0;tC)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ne,_.length,de]),pe=E[ne]??0,he=le?le.pot:ue+pe,me=(0,i.useMemo)(()=>{const e={};for(let t=0;tS)break;const o=(0,h.ymd)(s);B.forEach(t=>{const s=F.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ne,F.length,N.length,B.length]),fe=B.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&R.includeManagers||'owner'===e.role&&R.includeOwner)),ye=(0,i.useMemo)(()=>{if(le)return le.rows;const e=fe.map(e=>{const t=(me[e.id]?.paid??0)/60,s=R.points[M(e)]??1;return'hours'===R.method?t:'points'===R.method?t*s:'equal'===R.method?t>0?1:0:R.custom[e.id]??0}),{amounts:t}=O(he,e),s=e.reduce((e,t)=>e+t,0);return fe.map((o,i)=>({staffId:o.id,hours:(me[o.id]?.paid??0)/60,points:R.points[M(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[le,fe.map(e=>e.id).join(),me,R,he]),ge=ye.reduce((e,t)=>e+t.amount,0),xe=le?0:(()=>{const e=ye.map(e=>e.pct);return O(he,e).remainder})(),je=Object.entries(R.custom).filter(([e])=>fe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),be='custom'===R.method&&Math.abs(je-100)>.01,we=new Date(ie.getFullYear(),ie.getMonth()+2,0),Te=[...L].sort((e,t)=>t.end.localeCompare(e.end))[0],Ce=0!==L.length&&(0,h.parseYmd)(Te.end)<(0,h.addMins)(C,-89280),Se=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return`${I(t.name)},${M(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return te?(0,P.jsxs)(l.default,{style:{gap:10},children:[(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,P.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>H(q-1)}),(0,P.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,P.jsx)(d.T,{weight:"semibold",children:re}),le?(0,P.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${le.lockedAt}`}):q>=0?(0,P.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,P.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:q>=0,onPress:()=>H(q+1)})]}),(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Card tips on orders"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.card:ue)})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Cash tips"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.cash:pe)})]}),le?null:(0,P.jsxs)(d.Row,{gap:6,children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:U,onChangeText:W,style:[d.styles.input,{flex:1}]}),(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(U)>=0)||''===U.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...E,[ne]:Math.round(100*Number(U))}}),W('')}})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,P.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(he)})]}),(0,P.jsx)(d.Muted,{children:de?'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).'})]}),le?(0,P.jsxs)(d.Muted,{children:["Locked with method: ",$[le.method],"."]}):(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,P.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,P.jsx)(d.Chip,{label:$[e],selected:R.method===e,onPress:()=>se&&ae({method:e})},e))}),se?null:(0,P.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===R.method?Object.entries(R.points).map(([e,t])=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:e}),(0,P.jsx)(d.Row,{gap:6,children:(0,P.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>se&&ae({points:{...R.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===R.method?(0,P.jsxs)(P.Fragment,{children:[fe.map(e=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,P.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(R.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ae({custom:{...R.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ae({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,P.jsxs)(d.T,{size:13,colour:be?m.colours.red:m.colours.ok,children:["Total ",je.toFixed(1),"%",be?' (must be 100%)':' \u2713']})]}):null,(0,P.jsx)(d.Toggle,{label:"Include managers",value:R.includeManagers,onChange:e=>se&&ae({includeManagers:e})}),(0,P.jsx)(d.Toggle,{label:"Include owner",value:R.includeOwner,onChange:e=>se&&ae({includeOwner:e})}),R.includeOwner?(0,P.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,P.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,P.jsxs)(d.T,{center:!0,children:["Points: ",'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013']}),(0,P.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,P.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,P.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(ge)]})]}):(0,P.jsx)(r.default,{horizontal:!0,children:(0,P.jsxs)(l.default,{children:[(0,P.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,P.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,P.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,P.jsx)(d.T,{size:13,style:{width:54},children:'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013'}),(0,P.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,P.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,P.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,P.jsx)(d.T,{size:13,weight:"bold",colour:ge===he?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(ge)})]})]})}),(0,P.jsxs)(d.Muted,{children:[ge===he?`\u2713 Total equals the pot (${(0,p.gbp)(he)}).`:'\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."]}),le?null:(0,P.jsx)(d.Button,{label:"Approve & lock period",disabled:!se||q>=0||be||ge!==he||he<=0,onPress:()=>{const e=`${(0,h.niceDate)(C)} ${C.toTimeString().slice(0,5)}`,t={id:`tp-${ne}`,key:ne,label:re,end:(0,h.ymd)(ie),pot:he,card:ue,cash:pe,method:R.method,rows:ye,lockedAt:e,by:D};u.useOwner.getState().setOwner({troncHistory:[t,...L],troncLog:[{id:`tl-${Date.now()}`,at:C.toISOString(),text:`${D} approved & locked tips for ${re}: ${(0,p.gbp)(he)} split ${$[R.method].toLowerCase()} between ${ye.filter(e=>e.amount>0).length} staff`},...z]})}}),!le&&q>=0?(0,P.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,se||le?null:(0,P.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),le?(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:le.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!le.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${re} approved: ${(0,p.gbp)(le.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:L.map(e=>e.id===le.id?{...e,shared:(0,h.niceDate)(C)}:e)}),ee('Posted to All staff chat.')}}):null]}),Z?(0,P.jsx)(d.Banner,{kind:"info",title:Z}):null,(0,P.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,P.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(he)} = allocated ${(0,p.gbp)(ge)}`],[R.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Ce,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(we)} ${we.getFullYear()}`],[!0,'Tip records kept for 3 years',`${L.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,P.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,P.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,P.jsxs)(l.default,{style:{flex:1},children:[(0,P.jsx)(d.T,{size:14,children:t}),(0,P.jsx)(d.Muted,{children:s})]})]},String(t))),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{X(R.text),Q(!0)}})]}),(0,P.jsx)(y.SectionHead,{title:"Tip history & audit log"}),L.map(e=>(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"semibold",children:e.label}),(0,P.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,P.jsxs)(d.Muted,{children:[$[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,P.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),L.length||z.length?null:(0,P.jsx)(d.Muted,{children:"No approved periods yet."}),(0,P.jsxs)(d.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,P.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,P.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Se.map((e,t)=>(0,P.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,P.jsxs)(d.Muted,{children:[re," \xb7 ",$[le?.method??R.method]]})]}),(0,P.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tipping policy",children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:se,value:J,onChangeText:X,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),se?(0,P.jsx)(d.Button,{label:"Save policy",onPress:()=>{ae({text:J}),Q(!1)}}):null,(0,P.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,P.jsx)(A,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||B()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${D(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${D(i)}`;return(0,P.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(R,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,P.jsx)(R,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=A;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},M=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',I=e=>(e??'').replace(' (example)','');function O(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const D=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function B(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const F={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,k.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),B()?{pot:F.pot,today:F.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function R({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${D(s)}`;return(0,P.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,P.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,P.jsx)(d.Muted,{center:!0,children:o}):(0,P.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:D(s)})]})}function A(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,P.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,P.jsx)(R,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,P.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,P.jsx)(R,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1154,[798,796,806,34,402,295,102,426,794,848,865,836,827,840,1135,1147,1100,1050,1119,985,1024,1048,13,1049,2,25]); -__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,D.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,D.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),w=(0,f.useOwner)(e=>e.swaps),[v,$]=(0,l.useState)(0),[M,O]=(0,l.useState)(null),[R,P]=(0,l.useState)(null),[z,A]=(0,l.useState)('week'),[N,F]=(0,l.useState)(''),[K,U]=(0,l.useState)(''),[G,X]=(0,l.useState)(''),J='staff'!==t,Q=(0,y.addMins)(_(e),7*v*1440);Q.setHours(0,0,0,0);const Z=q(Q),ee=Z.sales,te='none'===Z.mode,se=Array.from({length:7},(e,t)=>{const s=new Date(Q);return s.setDate(Q.getDate()+t),(0,y.ymd)(s)}),ne=(0,f.visibleShifts)(i,J).filter(e=>e.date>=se[0]&&e.date<=se[6]),ae=(()=>{const e=new Date(Q);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),oe=ne.filter(e=>!e.published||e.changed).length,ie=i.filter(e=>e.date>=ae&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),re=se.map(e=>ne.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(h[s.staffId]??0);var s},0)),de=re.reduce((e,t)=>e+t,0),ce=ee.reduce((e,t)=>e+t,0),ue=(e,t)=>t?Math.round(e/t*100):0,he=J?o:o.filter(e=>e.id===n),fe=(0,a.useNarrow)(),me=Math.max(0,se.indexOf((0,y.ymd)(e))),[pe,xe]=(0,l.useState)(null),ge=pe??me,je=(e,t)=>!fe||t===ge,be=fe?150:74;return(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(u.Chip,{label:`Swaps & leave (${w.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(u.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(v-1),O(null)}}),(0,H.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(Q)]}),(0,H.jsxs)(u.Muted,{children:[0===v?'This week':1===v?'Next week':-1===v?'Last week':v>0?`In ${v} weeks`:-v+" weeks ago",J?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(v+1),O(null)}})]}),J?(0,H.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ie?` (${ie})`:''),disabled:!ie,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(ae,se[0]);O(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,H.jsx)(u.Button,{small:!0,kind:"success",label:oe?`Publish ${oe} ${1===oe?'change':'changes'}`:'Week published',disabled:!oe,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(se[0]);O(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),oe?(0,H.jsx)(u.Badge,{kind:"amber",label:`${oe} unpublished`}):ne.length?(0,H.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,M?(0,H.jsx)(u.Banner,{kind:"success",title:M}):null,fe?(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(u.Chip,{label:`${e} ${(0,y.parseYmd)(se[t]).getDate()}`,selected:t===ge,onPress:()=>xe(t)},e))}):null,(0,H.jsx)(d.default,{horizontal:!fe,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(c.default,{style:{gap:4},children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsxs)(u.T,{size:12,weight:"semibold",colour:se[s]===(0,y.ymd)(e)?S.colours.gold:S.colours.text,children:[t," ",(0,y.parseYmd)(se[s]).getDate()]})},t)).filter(je)]}),he.map(e=>(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(ne,e.id,se[s]),a=(m[e.id]??[]).includes(s),o=le(e.id,se[s]);return(0,H.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!J,onPress:()=>P({staffId:e.id,date:se[s],shift:n}),style:{width:be,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?S.colours.gold:S.colours.amber:S.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:o?'Leave':a?'Unavail.':J?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(u.T,{size:9,colour:S.colours.red,children:o?'on leave!':'unavailable'}):n&&J&&(!n.published||n.changed)?(0,H.jsx)(u.T,{size:9,colour:S.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(je)]},e.id)),J?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour"})}),re.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:'example'===Z.mode?'Fcst sales (ex.)':'Fcst sales'})}),ee.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour %"})}),re.map((e,t)=>{const s=ue(e,ee[t]);return(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,weight:"semibold",colour:ee[t]?s>32?S.colours.red:s>26?S.colours.amber:S.colours.ok:S.colours.muted,children:ee[t]?`${s}%`:'\u2013'})},t)}).filter(je)]})]}):null]})}),!J&&n?(0,H.jsx)(c.default,{testID:"rota-team-on",children:(0,H.jsx)(u.Card,{children:se.map((e,t)=>(0,H.jsx)(x.TeamOnDay,{date:e,meId:n,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(je)})}):null,J&&te?(0,H.jsx)(u.Card,{children:(0,H.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(c.default,{testID:"labour-week-cost",children:(0,H.jsx)(u.T,{weight:"semibold",children:(0,k.gbp)(de)})})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===Z.weeks?'1 week':`${Z.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),Z.booked?(0,H.jsx)(c.default,{testID:"labour-booked",children:(0,H.jsxs)(u.T,{children:["Booked so far: ",Z.booked," Covers this week"]})}):null]})}):null,J&&!te?(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(u.Row,{gap:6,children:['example'===Z.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(u.Badge,{kind:ue(de,ce)>30?'red':'ok',label:`${ue(de,ce)}% this week`})]})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(ce)," forecast sales. Target 25\u201330%. ",'example'===Z.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=ue(re[5],ee[5]);return e&&e<24?(0,H.jsxs)(u.T,{size:14,colour:S.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,J?(0,H.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>J||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,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(e=>L(s,e)).map(t=>(0,H.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,H.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,I.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),J?null:(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(u.Muted,{testID:"swap-dept-note",children:(0,j.isAnchorageVenue)(b.VENUE_RID)?j.ANCHORAGE_SWAP_NOTE:Y(o.find(e=>e.id===n))?j.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ne.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,I.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>L(o.find(e=>e.id===n),e)).map(t=>(0,H.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)}),ne.some(e=>e.staffId===n)?null:(0,H.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(C.SectionHead,{title:"Holiday & leave"}),p.filter(e=>J||e.staffId===n).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,H.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)((0,y.parseYmd)(e.from))," \u2013 ",(0,y.niceDate)((0,y.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Request leave",J?' (as yourself)':'']}),(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:N,onChangeText:F,style:[u.styles.input,{flex:1}]}),(0,H.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:K,onChangeText:U,style:[u.styles.input,{flex:1}]})]}),(0,H.jsx)(u.Field,{label:"Reason",value:G,onChangeText:X}),(0,H.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(N)||!/^\d{4}-\d{2}-\d{2}$/.test(K)||K{f.useOwner.getState().addLeave({staffId:n,from:N,to:K,reason:G.trim()||'Holiday'}),F(''),U(''),X('')}})]})]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",J?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),he.filter(e=>'owner'!==e.role||!J).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{gap:8,children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(u.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,H.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,D.useCtx)(5e3),x=((0,v.useClockArea)(e=>e.areas[m]),(0,v.areaOf)(m));const j=(0,$.privateClockVenue)(m),[b,w]=(0,l.useState)(!1),k=(0,f.useOwner)(e=>e.consent[a]),C=(0,f.useOwner)(e=>e.attendance),I=(0,f.useOwner)(e=>e.shifts),[B,z]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,N]=(0,l.useState)(null),[F,E]=(0,l.useState)(void 0),[W,_]=(0,l.useState)(null),[q,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=C.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)(I,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,M.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),N(null),E(void 0);const l=await(0,O.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(_(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&_(null),!0):(N(l.message),E(l.fix),(0,R.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 k?(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(T.StaffAvatar,{id:a,size:48}),(0,H.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,H.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(c.default,{testID:"clock-area-line",children:(0,H.jsx)(u.T,{size:14,colour:S.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,H.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(c.default,{testID:"on-break",children:(0,H.jsxs)(u.T,{size:15,weight:"semibold",colour:S.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.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,H.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,H.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'):(N(null),z(!0))}})]}):(0,H.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(c.default,{testID:"clock-message",children:(0,H.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===F?(0,H.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===F?(0,H.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===F?(0,H.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,M.areaSet)(x)?(0,H.jsx)(c.default,{testID:"clock-area-warning",children:(0,H.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,H.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(u.T,{size:14,colour:S.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.T,{weight:"semibold",colour:S.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(u.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.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,H.jsx)(u.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(c.default,{style:{gap:12},children:[(0,H.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,H.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,H.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:()=>{w(!1),ae('in')}}),(0,H.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:m,today:t,now:e}):null,G?(0,H.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,H.jsx)(u.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,M.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.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,H.jsx)(c.default,{style:{gap:10},children:(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.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,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.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,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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]),S=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),v=_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]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const Y=e=>(0,j.deptKey)(e?.dept),L=(e,t)=>(0,j.canSwapWith)(e,t,b.VENUE_RID),N=2650,F=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,z.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,w.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*N+t.restOfDay.takeaway*F:0})}},[s,a,o,i,r,(0,y.ymd)(e)])}function V({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,H.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,H.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,H.jsx)(u.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{children:"Start"}),(0,H.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:"End"}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:i,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.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,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:D.fmtH,label:"Break time"}),(0,H.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,H.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,H.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,H.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,H.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({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,D.useSignedIn)(),{me:i,meId:r}=(0,D.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),w=s=>{if(!d)return;const a=(0,O.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,R.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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,b]=(0,l.useState)(h?Math.round(60*h.start):720),[w,k]=(0,l.useState)(h?Math.round(60*h.end):1200),[C,I]=(0,l.useState)(''),[T,v]=(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&&w<=j,P=(e,t)=>(0,H.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return T?(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.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,H.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,D.fmtH)(h.start)}\u2013${(0,D.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,y.hm)(new Date(c.in))}\u2013${c.out?(0,y.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,O?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(u.Field,{label:"Note for your manager (optional)",value:C,onChangeText:I,placeholder:"e.g. phone died",maxLength:200}),(0,H.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,w):void 0,note:C.trim(),at:t.toISOString()}),v(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.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,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(c.default,{children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(u.T,{size:28,weight:"bold",colour:S.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(u.T,{size:18,weight:"semibold",colour:w?S.colours.amber:S.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.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,H.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(C.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsxs)(u.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.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,H.jsx)(C.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,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(u.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.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,H.jsxs)(u.T,{size:13,colour:S.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,H.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,D.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,j]=(0,l.useState)(s),[b,w]=(0,l.useState)(null),[I,v]=(0,l.useState)(!1),$=!!(0,D.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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),B=P.filter(f.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),Y=B.reduce((t,s)=>t+(0,D.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(B.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,D.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,D.fmtH)(a.start)}-${(0,D.fmtH)(a.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.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,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(u.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(u.T,{size:13,colour:S.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(u.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(a.WideTable,{children:(0,H.jsxs)(c.default,{style:{gap:2},children:[(0,H.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:S.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(u.T,{size:12,weight:"semibold",colour:S.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,D.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(T.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:l?`${(0,D.fmtH)(l.start)}\u2013${(0,D.fmtH)(l.end)}`:'\u2013'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?S.colours.ok:'open'===(0,f.attStatus)(t)?S.colours.blue:S.colours.amber,children:(0,m.statusLabel)(t)}),(0,H.jsx)(u.T,{size:11,style:{width:140},colour:c.length?S.colours.amber:S.colours.ok,children:c.join(', ')||'OK'}),(0,H.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(u.T,{size:12,colour:S.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?S.colours.muted:S.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,H.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>v(!0)}),(0,H.jsx)(C.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(u.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(m.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(u.Sheet,{visible:I,onClose:()=>v(!1),title:"Payroll export",children:[(0,H.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(u.T,{size:10,colour:t?S.colours.text:S.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,796,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); +__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:s}=(0,D.useCtx)(6e4),a=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,h.useOwner)(e=>e.shifts),u=(0,D.useHourly)(),f=(0,h.useOwner)(e=>e.availability),m=(0,h.useOwner)(e=>e.leave),w=(0,h.useOwner)(e=>e.swaps),[T,$]=(0,i.useState)(0),[O,M]=(0,i.useState)(null),[R,P]=(0,i.useState)(null),[z,A]=(0,i.useState)('week'),[F,Y]=(0,i.useState)(!1),K=(0,D.useSignedIn)()?.name??'',U='staff'!==t,G=(0,y.addMins)(_(e),7*T*1440);G.setHours(0,0,0,0);const X=q(G),J=X.sales,Q='none'===X.mode,Z=Array.from({length:7},(e,t)=>{const s=new Date(G);return s.setDate(G.getDate()+t),(0,y.ymd)(s)}),ee=(0,h.visibleShifts)(o,U).filter(e=>e.date>=Z[0]&&e.date<=Z[6]),te=(()=>{const e=new Date(G);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),se=ee.filter(e=>!e.published||e.changed).length,ne=o.filter(e=>e.date>=te&&e.date!!(0,h.leaveOn)(m,e,t),oe=Z.map(e=>ee.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(u[s.staffId]??0);var s},0)),ie=oe.reduce((e,t)=>e+t,0),le=J.reduce((e,t)=>e+t,0),re=(e,t)=>t?Math.round(e/t*100):0,de=U?a:a.filter(e=>e.id===s),ce=(0,n.useNarrow)(),ue=Math.max(0,Z.indexOf((0,y.ymd)(e))),[he,fe]=(0,i.useState)(null),me=he??ue,pe=(e,t)=>!ce||t===me,xe=ce?150:74;return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(c.Chip,{label:`Swaps & time off (${w.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(c.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[!U&&s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-time-off"}):null,(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(T-1),M(null)}}),(0,H.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(c.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(G)]}),(0,H.jsxs)(c.Muted,{children:[0===T?'This week':1===T?'Next week':-1===T?'Last week':T>0?`In ${T} weeks`:-T+" weeks ago",U?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(T+1),M(null)}})]}),U?(0,H.jsxs)(c.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ne?` (${ne})`:''),disabled:!ne,testID:"rota-copy",onPress:()=>{const e=h.useOwner.getState().copyWeek(te,Z[0]);M(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,H.jsx)(c.Button,{small:!0,kind:"success",label:se?`Publish ${se} ${1===se?'change':'changes'}`:'Week published',disabled:!se,testID:"rota-publish",onPress:()=>{const e=h.useOwner.getState().publishWeek(Z[0]);M(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),se?(0,H.jsx)(c.Badge,{kind:"amber",label:`${se} unpublished`}):ee.length?(0,H.jsx)(c.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,O?(0,H.jsx)(c.Banner,{kind:"success",title:O}):null,ce?(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(c.Chip,{label:`${e} ${(0,y.parseYmd)(Z[t]).getDate()}`,selected:t===me,onPress:()=>fe(t)},e))}):null,(0,H.jsx)(r.default,{horizontal:!ce,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(d.default,{style:{gap:4},children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsxs)(c.T,{size:12,weight:"semibold",colour:Z[s]===(0,y.ymd)(e)?I.colours.gold:I.colours.text,children:[t," ",(0,y.parseYmd)(Z[s]).getDate()]})},t)).filter(pe)]}),de.map(e=>(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsxs)(c.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(c.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,h.shiftOf)(ee,e.id,Z[s]),a=(f[e.id]??[]).includes(s),o=ae(e.id,Z[s]);return(0,H.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!U,onPress:()=>P({staffId:e.id,date:Z[s],shift:n}),style:{width:xe,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?I.colours.gold:I.colours.amber:I.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(c.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:o?'Off':a?'Unavail.':U?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(c.T,{size:9,colour:I.colours.red,children:o?'on leave!':'unavailable'}):n&&U&&(!n.published||n.changed)?(0,H.jsx)(c.T,{size:9,colour:I.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(pe)]},e.id)),U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour"})}),oe.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:'example'===X.mode?'Fcst sales (ex.)':'Fcst sales'})}),J.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour %"})}),oe.map((e,t)=>{const s=re(e,J[t]);return(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,weight:"semibold",colour:J[t]?s>32?I.colours.red:s>26?I.colours.amber:I.colours.ok:I.colours.muted,children:J[t]?`${s}%`:'\u2013'})},t)}).filter(pe)]})]}):null]})}),!U&&s?(0,H.jsx)(d.default,{testID:"rota-team-on",children:(0,H.jsx)(c.Card,{children:Z.map((e,t)=>(0,H.jsx)(p.TeamOnDay,{date:e,meId:s,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(pe)})}):null,U&&Q?(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(d.default,{testID:"labour-week-cost",children:(0,H.jsx)(c.T,{weight:"semibold",children:(0,k.gbp)(ie)})})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(c.Muted,{children:`Forecasts start once CoverCharge has ${1===X.weeks?'1 week':`${X.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),X.booked?(0,H.jsx)(d.default,{testID:"labour-booked",children:(0,H.jsxs)(c.T,{children:["Booked so far: ",X.booked," Covers this week"]})}):null]})}):null,U&&!Q?(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(c.Row,{gap:6,children:['example'===X.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(c.Badge,{kind:re(ie,le)>30?'red':'ok',label:`${re(ie,le)}% this week`})]})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(le)," forecast sales. Target 25\u201330%. ",'example'===X.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=re(oe[5],J[5]);return e&&e<24?(0,H.jsxs)(c.T,{size:14,colour:I.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,U?(0,H.jsx)(c.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>U||e.fromId===s||e.toId===s).map(e=>{const t=o.find(t=>t.id===e.shiftId),s=a.find(t=>t.id===e.fromId),n=a.find(t=>t.id===e.toId);return(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(c.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:a.filter(e=>L(s,e)).map(t=>(0,H.jsx)(c.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{h.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,H.jsx)(c.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{h.useOwner.getState().setSwap(e.id,'approved');const s=e=>(a.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,C.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),U?null:(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(c.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(c.Muted,{testID:"swap-dept-note",children:(0,x.isAnchorageVenue)(j.VENUE_RID)?x.ANCHORAGE_SWAP_NOTE:N(a.find(e=>e.id===s))?x.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ee.filter(e=>e.staffId===s).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(d.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(c.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Ask for cover",onPress:()=>{h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,kind:'cover',note:'Can anyone cover?'}),(0,C.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(a.find(e=>e.id===s)?.name??'').replace(' (example)','')})`)}}),a.filter(e=>L(a.find(e=>e.id===s),e)).map(t=>(0,H.jsx)(c.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),ee.some(e=>e.staffId===s)?null:(0,H.jsx)(c.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(S.SectionHead,{title:"Holiday & time off"}),U?(0,H.jsx)(c.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>Y(!0)}):s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-requests-time-off"}):null,m.filter(e=>U||e.staffId===s).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,H.jsx)(c.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,H.jsxs)(c.Muted,{children:[(0,b.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,style:{justifyContent:'center'},children:[(0,H.jsx)(c.Button,{small:!0,label:"Approve",onPress:()=>h.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),U&&s?(0,H.jsx)(b.TimeOffSheet,{visible:F,onClose:()=>Y(!1),meId:s,me:K,manager:!0}):null]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Muted,{children:["Days each person can\u2019t work. ",U?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),de.filter(e=>'owner'!==e.role||!U).map(e=>(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{gap:8,children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(c.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(c.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(f[e.id]??[]).includes(s);return(0,H.jsx)(c.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>h.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:n,meId:r,me:u,r:f,rid:p}=(0,D.useCtx)(5e3),x=((0,T.useClockArea)(e=>e.areas[p]),(0,T.areaOf)(p));const j=(0,$.privateClockVenue)(p),[b,w]=(0,i.useState)(!1),k=(0,h.useOwner)(e=>e.consent[r]),S=(0,h.useOwner)(e=>e.attendance),C=(0,h.useOwner)(e=>e.shifts),[B,z]=(0,i.useState)(!1),[A,N]=(0,i.useState)(null),[L,F]=(0,i.useState)(null),[Y,E]=(0,i.useState)(void 0),[W,_]=(0,i.useState)(null),[q,V]=(0,i.useState)(!1),[G,X]=(0,i.useState)(null),J=S.filter(t=>t.staffId===r&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,h.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,h.visibleShifts)(C,'staff'!==n).find(e=>e.staffId===r&&e.date===t),ee='staff'!==n,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,O.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{N(s),F(null),E(void 0);const i=await(0,M.clockAction)(s,{rid:p,staffId:r,date:t,at:new Date(e.getTime()).toISOString(),...n});return N(null),i.ok?('out'===s&&i.att&&(_(i.att),(0,o.hrSettingsOf)(f.settings?.hr).on&&!a.useHr.getState().hasAnswered(p,i.att.id)&&X(i.att)),'in'===s&&_(null),!0):(F(i.message),E(i.fix),(0,R.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:i.message.split('. ')[0]+'.',body:i.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(v.StaffAvatar,{id:r,size:48}),(0,H.jsx)(c.T,{weight:"semibold",style:{flex:1},children:u})]}),(0,H.jsx)(c.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(c.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(d.default,{testID:"clock-area-line",children:(0,H.jsx)(c.T,{size:14,colour:I.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${f.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${f.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,H.jsxs)(c.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(c.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(d.default,{testID:"on-break",children:(0,H.jsxs)(c.T,{size:15,weight:"semibold",colour:I.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,h.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.jsx)(c.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,H.jsx)(c.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,H.jsx)(c.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),z(!0))}})]}):(0,H.jsx)(c.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(c.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,h.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(d.default,{testID:"clock-message",children:(0,H.jsx)(c.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===Y?(0,H.jsx)(c.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,O.areaSet)(x)?(0,H.jsx)(d.default,{testID:"clock-area-warning",children:(0,H.jsx)(c.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,H.jsx)(l.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(c.T,{size:14,colour:I.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(m.BreakRoomCard,{staffId:r,name:u,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.T,{weight:"semibold",colour:I.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(c.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.jsx)(c.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,H.jsx)(c.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(d.default,{style:{gap:12},children:[(0,H.jsxs)(c.T,{children:["We check once that you are at ",f.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,H.jsx)(c.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,H.jsx)(c.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{w(!1),ae('in')}}),(0,H.jsx)(c.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:p,today:t,now:e}):null,G?(0,H.jsx)(s.ShiftCheckout,{rid:p,shiftKey:G.id,day:G.date,meId:r,onClose:()=>X(null)}):null,(0,H.jsx)(c.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(d.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(c.Chip,{testID:`forgot-break-${e}`,label:(0,O.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.jsx)(c.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,H.jsx)(d.default,{style:{gap:10},children:(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",f.name,", within about ",x.radius," m."]}),(0,H.jsx)(c.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(c.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.jsx)(c.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 ",f.name," (within about ",x.radius," m)."]}),(0,H.jsx)(c.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.jsx)(c.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,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.jsx)(c.Button,{label:"I understand \u2014 continue",onPress:()=>h.useOwner.getState().giveConsent(r,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),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]),I=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const N=e=>(0,x.deptKey)(e?.dept),L=(e,t)=>(0,x.canSwapWith)(e,t,j.VENUE_RID),F=2650,Y=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,u.useBookings)(t),o=(0,u.useOrders)(t),l=(0,u.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,i.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),i=(0,z.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:i,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:i,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:i,booked:n,sales:t.map(e=>{const t=(0,w.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*F+t.restOfDay.takeaway*Y:0})}},[s,a,o,l,r,(0,y.ymd)(e)])}function V({init:e,onClose:t}){const s=(0,h.useOwner)(e=>e.staff),[n,a]=(0,i.useState)(e.shift?.start??12),[o,l]=(0,i.useState)(e.shift?.end??20),[r,u]=(0,i.useState)(e.shift?.breakAt),f=void 0===r||r>n&&rt.id===e.staffId),p=(0,h.leaveOn)((0,h.useOwner)(e=>e.leave),e.staffId,e.date);return(0,H.jsxs)(c.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[p?(0,H.jsx)(c.Banner,{kind:"warn",title:`${(m?.name??'').replace(' (example)','')} has time off: ${(0,b.rangeLabel)(p.from,p.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,H.jsx)(c.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,H.jsx)(c.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),l(s)}},e))}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{children:"Start"}),(0,H.jsx)(c.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:"End"}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:l,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(c.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(c.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.jsx)(c.Chip,{label:"Set a break time",onPress:()=>u(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,H.jsxs)(c.Row,{gap:6,children:[(0,H.jsx)(c.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:u,format:D.fmtH,label:"Break time"}),(0,H.jsx)(c.Chip,{label:"No set time",onPress:()=>u(void 0)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=h.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:f?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&f?{breakAt:r}:{}}),t()}}),(0,H.jsx)(c.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,H.jsx)(c.Button,{kind:"danger",label:"Remove shift",onPress:()=>{h.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({rid:e,today:t,now:s}){const n=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,h.useOwner)(e=>e.attendance),o=(0,D.useSignedIn)(),{me:l,meId:r}=(0,D.useCtx)(3e4),[d,u]=(0,i.useState)(null),[f,m]=(0,i.useState)(''),[p,x]=(0,i.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,h.isOnBreak)(j),w=s=>{if(!d)return;const a=(0,M.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??l},f);if(!a.ok)return void x(a.message);const i=n.find(e=>e.id===d)?.name??'them';(0,R.notify)({id:'mgr-clock',title:`Recorded for ${i}`,body:`Reason kept with the record: ${f.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Record it for someone"}),(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(c.Chip,{label:e.name,selected:d===e.id,onPress:()=>u(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Field,{label:"Reason (kept with the record)",value:f,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(c.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,h.useOwner)(e=>e.attendance),o=(0,h.useOwner)(e=>e.shifts),l=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),[r,d]=(0,i.useState)(s),u=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],m=(0,h.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,i.useState)(u&&!u.out?'out':'in'),[j,b]=(0,i.useState)(m?Math.round(60*m.start):720),[w,k]=(0,i.useState)(m?Math.round(60*m.end):1200),[S,C]=(0,i.useState)(''),[v,T]=(0,i.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,O='out'!==p,M='in'!==p,R=O&&M&&w<=j,P=(e,t)=>(0,H.jsx)(c.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return v?(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.jsx)(c.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,H.jsx)(c.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(c.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(c.Muted,{children:[m?`Your rota that day: ${(0,D.fmtH)(m.start)}\u2013${(0,D.fmtH)(m.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,y.hm)(new Date(u.in))}\u2013${u.out?(0,y.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(c.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(c.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),O?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,M?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(c.Field,{label:"Note for your manager (optional)",value:S,onChangeText:C,placeholder:"e.g. phone died",maxLength:200}),(0,H.jsx)(c.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{h.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:u?.id,kind:p,suggestedIn:O?(0,f.isoAt)(r,j):void 0,suggestedOut:M?(0,f.isoAt)(r,w):void 0,note:S.trim(),at:t.toISOString()}),T(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.useCtx)(3e4),n=(0,h.useOwner)(e=>e.attendance),a=(0,h.useOwner)(e=>e.shifts),o=(0,h.useOwner)(e=>e.timeRequests),[l,r]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),p=(0,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(h.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(d.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(d.default,{children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(c.T,{size:28,weight:"bold",colour:I.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(c.T,{size:18,weight:"semibold",colour:w?I.colours.amber:I.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(S.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsxs)(c.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(c.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,H.jsx)(S.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,h.shiftOf)((0,h.visibleShifts)(a,!1),t.staffId,t.date),n=(0,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(c.Card,{onPress:()=>m(u===t.id?null:t.id),children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(c.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.jsx)(c.Badge,{kind:(0,f.statusKind)(t),label:'awaiting'===(0,h.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,f.statusLabel)(t)})]}),o?(0,H.jsxs)(c.T,{size:13,colour:I.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(c.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,u===t.id?(0,H.jsx)(f.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(c.Muted,{children:"No clocked shifts yet."}),l?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const a=(0,h.useOwner)(e=>e.staff),o=(0,h.useOwner)(e=>e.shifts),r=(0,D.useHourly)(),u=(0,h.useOwner)(e=>e.attendance),m=(0,h.useOwner)(e=>e.timeRequests),p=(0,h.useOwner)(e=>e.attLog),[x,j]=(0,i.useState)(s),[b,w]=(0,i.useState)(null),[C,T]=(0,i.useState)(!1),$=!!(0,D.useSignedIn)(),O=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),M=u.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!M.some(t=>t.staffId===e.staffId)),P=u.filter(e=>O.includes(e.date)&&e.out),B=P.filter(h.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),N=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(B.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=a.find(e=>e.id===t.staffId),n=(0,h.shiftOf)(o,t.staffId,t.date),i=(0,D.paidMins)(t,e),l=r[t.staffId]??0;return`${s?.name},${t.date},${n?`${(0,D.fmtH)(n.start)}-${(0,D.fmtH)(n.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.hm)(new Date(t.out))},${i.brk},${(i.paid/60).toFixed(2)},${(l/100).toFixed(2)},${(i.paid/60*l/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:O.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(c.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(c.T,{size:13,colour:I.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(c.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(N))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(n.WideTable,{children:(0,H.jsxs)(d.default,{style:{gap:2},children:[(0,H.jsx)(n.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:I.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(c.T,{size:12,weight:"semibold",colour:I.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),M.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,h.shiftOf)(o,t.staffId,x),d=(0,D.paidMins)(t,e),u=(0,f.flagsFor)(t,r,e,s,m).map(e=>e.label);return(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(c.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(v.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(c.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:r?`${(0,D.fmtH)(r.start)}\u2013${(0,D.fmtH)(r.end)}`:'\u2013'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(c.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(c.T,{size:11,style:{width:120},colour:'confirmed'===(0,h.attStatus)(t)?I.colours.ok:'open'===(0,h.attStatus)(t)?I.colours.blue:I.colours.amber,children:(0,f.statusLabel)(t)}),(0,H.jsx)(c.T,{size:11,style:{width:140},colour:u.length?I.colours.amber:I.colours.ok,children:u.join(', ')||'OK'}),(0,H.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(c.T,{size:12,colour:I.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(c.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(c.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?I.colours.muted:I.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),M.length||R.length?null:(0,H.jsx)(c.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(c.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,H.jsx)(S.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(c.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(c.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(f.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(c.Sheet,{visible:C,onClose:()=>T(!1),title:"Payroll export",children:[(0,H.jsxs)(c.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(d.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(c.T,{size:10,colour:t?I.colours.text:I.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(c.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(c.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1159,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); __d(function(g,_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)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1156,[796,34,402,102,794,840,865,800,850,998,999,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),H=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),N=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(N.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),N.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(N.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:H.length?`Confirm all unflagged (${H.length})`:'Nothing unflagged to confirm',disabled:!H.length,onPress:()=>Y(H.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[H,N]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[H,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:H===e,onPress:()=>N(H===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:H?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),N=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),H=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(H.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),H.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(H.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:N.length?`Confirm all unflagged (${N.length})`:'Nothing unflagged to confirm',disabled:!N.length,onPress:()=>Y(N.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[N,H]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[N,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:N===e,onPress:()=>H(N===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:N?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:p}){const b=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.staff),f=(0,s.useMemo)(()=>(0,c.teamOnDay)(b,j,e,t),[b,j,e,t]);return(0,h.jsxs)(l.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(p,f),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",p]}),f.length?f.map(e=>(0,h.jsxs)(l.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,h.jsxs)(n.T,{size:13,center:!0,children:[e.name,e.job?(0,h.jsxs)(n.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,h.jsx)(n.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6])},1158,[34,102,794,865,1102,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1159,[34,102,794,865,840,1100,1103,1158,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1160,[34,102,1100,840,794,25]); -__d(function(g,r,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]})}},1161,[796,34,402,102,794,1019,840,928,25]); -__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1162,[796,1163,804,865,34,336,402,102,794,1019,1020,840,899,928,1164,1167,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1163,[34,1019,865,804]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1164,[798,796,1163,804,865,34,336,402,102,900,794,899,1019,1020,1165,840,928,1166,25]); -__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1165,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1166,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1167,[34,379,236,102,794,865,1019,1166,1020,1168,840,928,1163,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1168,[1020]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1169,[34,402,102,794,989,830,990,840,928,1170,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1170,[798,34,336,395,402,295,102,1171,794,989,830,990,827,840,1034,25,1173]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1171,[34,1172,102,830,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1172,[2,985]); -__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1173,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1174,[829,34,236,402,102,900,848,840,794,1175,1099,1176,25]); -__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1175,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); -__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1176,[1177,1178,1180,1179,1181,1033,1182]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1177,[]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1178,[808,5,815,818,846,1033,1179]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1179,[829,236,846,1177]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1180,[34,848,830,838,836,1178,1177]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1181,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1182,[34,1178,985,931]); -__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1183,[34,402,102,426,848,830,840,794,1174,1099,1184,25]); -__d(function(g,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}},1184,[34,102,426,848,830,1176,1033,840,794,1099,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1185,[34,236,402,102,853,794,840,994,1186,1187,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1186,[846,6,931,974,994,1176,1187]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1187,[808,1188,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1188,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1189,[34,846,1186]); -__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1190,[796,1163,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1191,[34,402,346,102,426,840,1153,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1192,[30,34,792,846,25]); -__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1193,[829,1097,851,30,34,1194,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); -__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])},1194,[796,34,236,102,25]); -__d(function(_g,_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"})]})]})}},1195,[30,34,336,102,1171,1196,794,830,836,848,856,840,25]); -__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])},1196,[30,34,402,848,840,794,25]); -__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1197,[30,34,794,1198,848,1185,25]); -__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])},1198,[34,402,840,794,25]); -__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1199,[806,30,34,1200,794,836,848,840,1201,1205,25]); -__d(function(_g,r,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])},1200,[34,385,102,848,836,840,794,25]); -__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}},1201,[34,102,794,836,1202,1203,1204,840,25]); -__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})},1202,[]); -__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})},1203,[]); -__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()})},1204,[931,985,1203]); -__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}},1205,[815,931,974,985,2,1202]); -__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1206,[1207,1216,5,1217,1218,1219,1222,829,30,34,236,402,102,1171,1196,794,830,836,852,848,840,1223,1185,846,865,1170,989,990,997,1224,1205,25]); -__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1207,[34,379,794,847,1208,1209,1215,848,5,6,25]); -__d(function(g,r,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])},1208,[34,379,102,794,991,992,1044,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1209,[6,34,931,794,1210,25]); -__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]})]})}},1210,[6,1211,1212,1213,34,102,796,794,840,11,1214,25]); -__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1212,[4,11]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1213,[11]); -__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.'}},1214,[6,931]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1215,[34,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1216,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1217,[34,102,794,1210,25]); -__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1218,[34,379,931,794,847,1208,1210,4,25]); -__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1219,[34,379,794,1208,847,1209,8,1220,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1220,[34,102,794,1221,25]); -__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1221,[]); -__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1222,[34,794,847,1208,1209,848,9,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1223,[34,402,102,426,794,840,1153,25]); -__d(function(g,_r,_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)})]})}},1224,[34,102,1225,794,848,997,1202,1205,840,25]); -__d(function(g,r,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])},1225,[34,102,1226,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1226,[1227]); -__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1227,[34,900,1228,1257,1258,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1228,[1229]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1229,[1230,1231,1254,1256]); -__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1230,[]); -__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1231,[1232,1233,1234,1235,1236,1237,1238,1239,1240,1243,1247,1244,1248]); -__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1232,[]); -__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1233,[]); -__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1234,[]); -__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1235,[]); -__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1240,[1241]); -__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1244,[1245,1246]); -__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1245,[]); -__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1246,[]); -__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1249,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1250,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1252,[1244,1232]); -__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1253,[]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1254,[1255]); -__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1256,[1255]); -__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1257,[]); -__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1258,[34,900,1259,25]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1259,[]); -__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1260,[30,34,794,848,865,25]); -__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1261,[806,30,34,102,1225,794,836,848,840,1224,1205,25]); -__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1262,[806,30,34,102,1200,794,848,865,836,827,840,1201,1205,25]); -__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1263,[806,30,34,794,848,865,827,840,1224,1205,25]); -__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1264,[806,30,34,794,848,865,840,1224,1205,25]); -__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1265,[30,34,794,827,1120,1266,848,840,25]); -__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}},1266,[]); -__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1267,[30,1075,34,402,102,794,827,848,840,25]); -__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1268,[829,30,34,1194,995,102,1200,794,830,836,1104,827,848,800,840,833,25]); -__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1269,[30,34,102,1196,794,830,852,848,840,1223,5,25]); -__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)}})]})}},1270,[829,30,34,102,1200,1198,794,830,836,827,848,840,25]); -__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1271,[829,1205,30,34,102,794,830,836,827,848,853,25]); -__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]})}},1272,[30,34,846,25]); -__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}},1273,[806,30,34,794,848,5,1205,25]); -__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."})})}},1274,[30,34,794,1275,1131,1205,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1275,[796,829,34,102,794,830,836,1131,1276,848,840,25]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1276,[931,985,1131]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1277,[30,34,846,1278,1333,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"})]}),qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1278,[1121,5,6,1279,798,822,1094,829,1120,1280,1281,1282,1091,1115,1283,1284,1286,1287,1288,1130,977,1099,1289,34,1073,1148,1033,1087,1116,1290,380,402,295,102,426,36,794,1185,1189,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1291,1107,1292,1295,1297,1300,1303,1299,1304,1306,1307,1112,1093,1095,852,1309,1174,1310,1184,1176,1011,1315,1323,1325,1076,1114,1327,1328,1329,1143,1330,1142,1136,838,1331,1332,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1280,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1281,[1012,1100]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1282,[34,102,1079,794,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1283,[829,34,102,794,848,1131,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1284,[34,395,402,426,102,1225,794,1143,1014,1285,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1285,[]); -__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}))},1286,[815]); -__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1287,[798,34,379,395,402,102,794,1143,840,25]); -__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return v}}),_e.SoldOutStrip=function({rid:e,now:k,by:w,onOpen:F}){const I=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[C,_]=(0,n.useState)(0),[A,H]=(0,n.useState)(!1),L=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{O()},[]);const D=k??(0,p.nowFrom)(z),W=(0,S.activeSoldOut)(I,e,D);if(!W.length)return null;const E=W.map(e=>(0,x.withReason)(e.name,L.reason(e.itemId))),M=(0,S.stripText)(E),P=C>0&&(0,S.stripNeedsTicker)(E,C,v),R=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=R);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>F?F():H(!0),onLayout:e=>_(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:b.colours.accentBorder},children:[(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:b.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,j.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,j.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&T?{whiteSpace:'nowrap'}:{},fontFamily:b.fonts.medium,fontSize:v,lineHeight:20,color:b.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!T?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:12,color:b.colours.muted},children:"Tap for all"}):null]}),F?null:(0,j.jsxs)(c.Sheet,{visible:A,onClose:()=>H(!1),title:(0,S.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[w?(0,j.jsx)(u.SoldOutList,{rid:e,by:w,hideLinks:!0}):(0,j.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,j.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:b.colours.border},children:[(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.semibold,fontSize:17,color:b.colours.text},children:e.name}),L.reason(e.itemId)?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.medium,fontSize:14,color:b.colours.amber},children:L.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted},children:["Since ",$(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${$(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const T='undefined'!=typeof document,k=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let w=!1;function O(){if(!T||w)return;w=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=k,document.head.appendChild(e)}const $=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},v=15},1288,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,978,840,25]); -__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])},1289,[798,34,102,840,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1290,[34,102,900,840,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1291,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1292,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1293,1294,1014,865,1107,25]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1293,[798,829,34,1294,102,828,840,794,1108,25]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1294,[828]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1295,[34,236,402,102,840,794,1143,1296,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1296,[]); -__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1297,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1298,840,794,1299,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1298,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1299,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1300,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1286,1301,2,1302,1303,848,827,25]); -__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1301,[236]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1303,[34,815,931,985,1302]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1304,[829,14,1014,1305]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1305,[830]); -__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1306,[34,102,900,840,25]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1307,[829,1014,34,102,794,1096,848,1308,1304,1095,1093,1112,1113,1114,840,1281,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1308,[1014,1079]); -__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1309,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1299,848,1014,830,1089,1079,1266,840,1281,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1310,[796,34,236,402,102,794,848,1014,1311,840,1312,1314,25]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1311,[]); -__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1312,[815,848,1014,1311,1313,1314]); -__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1313,[829]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1314,[236,1313]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1315,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1316,1319,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1316,[1317,839,829,34,281,395,402,295,102,848,1011,1014,1318,827,840,1041,794,1319,1320,985,1281,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1317,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1318,[852,827,851]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1319,[5,1014,931,985]); -__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})},1320,[815,931,985,1321,2,1322]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1321,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1322,[15]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1323,[34,102,900,794,1143,827,840,798,1324,1325,1326,25]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1324,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1325,[]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1326,[1079]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1327,[829,1305]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1328,[34,402,102,794,1327,840,1290,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1329,[34,102,899,794,1143,827,840,25]); -__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1330,[34,1143,402,102,426,794,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1331,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1320,985,25]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1332,[34,1021,865,1001,800,1022,994,1320,1070]); -__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1333,[5,798,847,34,236,402,102,426,985,840,794,1286,1334,25]); -__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}})()},1334,[]); -__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]})}},1335,[30,34,846,25]); +__d(function(g,_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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1159,[34,402,102,794,865,827,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1160,[34,102,794,865,840,1100,1103,1158,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1161,[34,102,1100,840,794,25]); +__d(function(g,r,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]})}},1162,[796,34,402,102,794,1019,840,928,25]); +__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1163,[796,1164,804,865,34,336,402,102,794,1019,1020,840,899,928,1165,1168,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1164,[34,1019,865,804]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1165,[798,796,1164,804,865,34,336,402,102,900,794,899,1019,1020,1166,840,928,1167,25]); +__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1166,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1167,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1168,[34,379,236,102,794,865,1019,1167,1020,1169,840,928,1164,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1169,[1020]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1170,[34,402,102,794,989,830,990,840,928,1171,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1171,[798,34,336,395,402,295,102,1172,794,989,830,990,827,840,1034,25,1174]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1172,[34,1173,102,830,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1173,[2,985]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1174,[]); +__d(function(g,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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1175,[829,34,236,402,102,900,848,840,794,1176,1099,1177,25]); +__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1176,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); +__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1177,[1178,1179,1181,1180,1182,1033,1183]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1178,[]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1179,[808,5,815,818,846,1033,1180]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1180,[829,236,846,1178]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1181,[34,848,830,838,836,1179,1178]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1182,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1183,[34,1179,985,931]); +__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1184,[34,402,102,426,848,830,840,794,1175,1099,1185,25]); +__d(function(g,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}},1185,[34,102,426,848,830,1177,1033,840,794,1099,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1186,[34,236,402,102,853,794,840,994,1187,1188,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1187,[846,6,931,974,994,1177,1188]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1188,[808,1189,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1189,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1190,[34,846,1187]); +__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1191,[796,1164,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1192,[34,402,346,102,426,840,1153,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1193,[30,34,792,846,25]); +__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1194,[829,1097,851,30,34,1195,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); +__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])},1195,[796,34,236,102,25]); +__d(function(_g,_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"})]})]})}},1196,[30,34,336,102,1172,1197,794,830,836,848,856,840,25]); +__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])},1197,[30,34,402,848,840,794,25]); +__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1198,[30,34,794,1199,848,1186,25]); +__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])},1199,[34,402,840,794,25]); +__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1200,[806,30,34,1201,794,836,848,840,1202,1206,25]); +__d(function(_g,r,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])},1201,[34,385,102,848,836,840,794,25]); +__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}},1202,[34,102,794,836,1203,1204,1205,840,25]); +__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})},1203,[]); +__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})},1204,[]); +__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()})},1205,[931,985,1204]); +__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}},1206,[815,931,974,985,2,1203]); +__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1207,[1208,1217,5,1218,1219,1220,1223,829,30,34,236,402,102,1172,1197,794,830,836,852,848,840,1224,1186,846,865,1171,989,990,997,1225,1206,25]); +__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1208,[34,379,794,847,1209,1210,1216,848,5,6,25]); +__d(function(g,r,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])},1209,[34,379,102,794,991,992,1044,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1210,[6,34,931,794,1211,25]); +__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]})]})}},1211,[6,1212,1213,1214,34,102,796,794,840,11,1215,25]); +__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1213,[4,11]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1214,[11]); +__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.'}},1215,[6,931]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1216,[34,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1217,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1218,[34,102,794,1211,25]); +__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1219,[34,379,931,794,847,1209,1211,4,25]); +__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1220,[34,379,794,1209,847,1210,8,1221,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1221,[34,102,794,1222,25]); +__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1222,[]); +__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1223,[34,794,847,1209,1210,848,9,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1224,[34,402,102,426,794,840,1153,25]); +__d(function(g,_r,_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)})]})}},1225,[34,102,1226,794,848,997,1203,1206,840,25]); +__d(function(g,r,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])},1226,[34,102,1227,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1227,[1228]); +__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1228,[34,900,1229,1258,1259,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1229,[1230]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1230,[1231,1232,1255,1257]); +__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1231,[]); +__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1232,[1233,1234,1235,1236,1237,1238,1239,1240,1241,1244,1248,1245,1249]); +__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1233,[]); +__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1234,[]); +__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1235,[]); +__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1236,[]); +__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1241,[1242]); +__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1245,[1246,1247]); +__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1246,[]); +__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1247,[]); +__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1250,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1251,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1253,[1245,1233]); +__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1254,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1255,[1256]); +__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1257,[1256]); +__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1258,[]); +__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1259,[34,900,1260,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1260,[]); +__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1261,[30,34,794,848,865,25]); +__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1262,[806,30,34,102,1226,794,836,848,840,1225,1206,25]); +__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1263,[806,30,34,102,1201,794,848,865,836,827,840,1202,1206,25]); +__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1264,[806,30,34,794,848,865,827,840,1225,1206,25]); +__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1265,[806,30,34,794,848,865,840,1225,1206,25]); +__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1266,[30,34,794,827,1120,1267,848,840,25]); +__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}},1267,[]); +__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1268,[30,1075,34,402,102,794,827,848,840,25]); +__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1269,[829,30,34,1195,995,102,1201,794,830,836,1104,827,848,800,840,833,25]); +__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1270,[30,34,102,1197,794,830,852,848,840,1224,5,25]); +__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)}})]})}},1271,[829,30,34,102,1201,1199,794,830,836,827,848,840,25]); +__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1272,[829,1206,30,34,102,794,830,836,827,848,853,25]); +__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]})}},1273,[30,34,846,25]); +__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}},1274,[806,30,34,794,848,5,1206,25]); +__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."})})}},1275,[30,34,794,1276,1131,1206,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1276,[796,829,34,102,794,830,836,1131,1277,848,840,25]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1277,[931,985,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1278,[30,34,846,1279,1334,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"}),G]}),Le,qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1279,[1121,5,6,1280,798,822,1094,829,1120,1281,1282,1283,1091,1115,1284,1285,1287,1288,1289,1130,977,1099,1290,34,1073,1148,1033,1087,1116,1291,380,402,295,102,426,36,794,1186,1190,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1292,1107,1293,1296,1298,1301,1304,1300,1305,1307,1308,1112,1093,1095,852,1310,1175,1311,1185,1177,1011,1316,1324,1326,1076,1114,1328,1329,1330,1143,1331,1142,1136,838,1332,1333,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1281,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1282,[1012,1100]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1283,[34,102,1079,794,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1284,[829,34,102,794,848,1131,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1285,[34,395,402,426,102,1226,794,1143,1014,1286,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1286,[]); +__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}))},1287,[815]); +__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1288,[798,34,379,395,402,102,794,1143,840,25]); +__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return F}}),_e.SoldOutStrip=function({rid:e,now:w,by:O,onOpen:I}){const C=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[_,A]=(0,n.useState)(0),[H,L]=(0,n.useState)(!1),D=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{$()},[]);const R=w??(0,p.nowFrom)(z),W=(0,b.activeSoldOut)(C,e,R);if(!W.length)return null;const E=W.map(e=>{const t=D.reason(e.itemId);return(0,x.withReason)(e.name,S.IS_CAR&&'none left'===t?'':t)}),M=(0,b.stripText)(E),P=_>0&&(0,b.stripNeedsTicker)(E,_,F),B=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=B);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>I?I():L(!0),onLayout:e=>A(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:j.colours.accentBorder},children:[(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:j.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,T.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,T.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&k?{whiteSpace:'nowrap'}:{},fontFamily:j.fonts.medium,fontSize:F,lineHeight:20,color:j.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!k?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:12,color:j.colours.muted},children:"Tap for all"}):null]}),I?null:(0,T.jsxs)(c.Sheet,{visible:H,onClose:()=>L(!1),title:(0,b.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[O?(0,T.jsx)(u.SoldOutList,{rid:e,by:O,hideLinks:!0}):(0,T.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,T.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.colours.border},children:[(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.semibold,fontSize:17,color:j.colours.text},children:e.name}),D.reason(e.itemId)?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.medium,fontSize:14,color:j.colours.amber},children:D.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted},children:["Since ",v(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${v(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]),T=r(_d[17]);const k='undefined'!=typeof document,w=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let O=!1;function $(){if(!k||O)return;O=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=w,document.head.appendChild(e)}const v=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},F=15},1289,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,846,978,840,25]); +__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])},1290,[798,34,102,840,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1291,[34,102,900,840,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1292,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1293,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1294,1295,1014,865,1107,25]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1294,[798,829,34,1295,102,828,840,794,1108,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1295,[828]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1296,[34,236,402,102,840,794,1143,1297,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1298,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1299,840,794,1300,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1299,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1300,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1301,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1287,1302,2,1303,1304,848,827,25]); +__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1302,[236]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1304,[34,815,931,985,1303]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1305,[829,14,1014,1306]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1306,[830]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1307,[34,102,900,840,25]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1308,[829,1014,34,102,794,1096,848,1309,1305,1095,1093,1112,1113,1114,840,1282,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1309,[1014,1079]); +__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1310,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1300,848,1014,830,1089,1079,1267,840,1282,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1311,[796,34,236,402,102,794,848,1014,1312,840,1313,1315,25]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1312,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1313,[815,848,1014,1312,1314,1315]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1314,[829]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1315,[236,1314]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1316,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1317,1320,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1317,[1318,839,829,34,281,395,402,295,102,848,1011,1014,1319,827,840,1041,794,1320,1321,985,1282,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1318,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1319,[852,827,851]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1320,[5,1014,931,985]); +__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})},1321,[815,931,985,1322,2,1323]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1322,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1323,[15]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1324,[34,102,900,794,1143,827,840,798,1325,1326,1327,25]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1325,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1326,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1327,[1079]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1328,[829,1306]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1329,[34,402,102,794,1328,840,1291,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1330,[34,102,899,794,1143,827,840,25]); +__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1331,[34,1143,402,102,426,794,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1332,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1321,985,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1333,[34,1021,865,1001,800,1022,994,1321,1070]); +__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1334,[5,798,847,34,236,402,102,426,985,840,794,1287,1335,25]); +__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}})()},1335,[]); __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]})}},1336,[30,34,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1337,[30,34,1338,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1338,[34,846,1339,1470,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnerApp=function(){return(0,ie.isDesktop)()?(0,de.jsx)(le.DesktopShell,{}):(0,de.jsx)(he,{})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),n=_r(d[3]),r=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),x=_r(d[13]),j=e(_r(d[14])),w=e(_r(d[15])),y=e(_r(d[16])),S=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),I=_r(d[24]),L=_r(d[25]),E=_r(d[26]),B=_r(d[27]),O=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var M=_r(d[33]),H=_r(d[34]),V=_r(d[35]),D=_r(d[36]),W=_r(d[37]),$=_r(d[38]),z=_r(d[39]),U=_r(d[40]),F=_r(d[41]),G=_r(d[42]),K=_r(d[43]),Y=_r(d[44]);_r(d[45]);var q=_r(d[46]),J=_r(d[47]),Q=_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]),ne=_r(d[55]),re=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]),de=_r(d[60]);const ce=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ue=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:I.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],fe={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function he(){const{rid:e,r:ie,role:le,today:he,now:ge,meId:me,me:pe}=(0,O.useCtx)(3e4);(0,h.useTipsPosted)(e,he,'staff'!==le);const be=(0,O.useSignedIn)();(0,l.useSoldOutLink)(!0,(be?.name??pe).replace(' (example)',''));const xe=(0,T.useOrders)(e),[je,we]=(0,x.useState)('home'),[ye,Se]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Te=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,O.ensureAttendance)(he,ge),(0,J.ensureChat)(ge)},[he]),globalThis.__ccNow=ge.getTime();const Ie=(0,J.useChatUnread)().total,Le=(0,x.useRef)({t:'home',s:null});Le.current={t:je,s:ye};const Ee=(0,x.useRef)([]),Be=(0,a.useScrollMemory)(Te),Oe=(0,x.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.s===s||(Ee.current=[...Ee.current,{...t,y:Be.leave()}].slice(-30),Be.restore(0)),we(e),Se(s)},[]),Pe=(0,x.useCallback)(()=>{if((0,c.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Be.leave(),we(t.t),Se(t.s),Be.restore(t.y??0),!0},[]);(0,c.useWebBack)(Pe);const Ne=(0,c.useInnerBackShown)();(0,x.useEffect)(()=>(oe.useVoiceNav.setState({go:Oe}),()=>oe.useVoiceNav.setState({go:null})),[Oe]),(0,x.useEffect)(()=>{u.PITCH&&(globalThis.__pitchGo=Oe)},[Oe]),(0,x.useEffect)(()=>{const e=j.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ue.find(e=>e.id===je);e?.can&&!e.can(le)&&Oe('home');const s=(0,K.pageFor)(ye);s?.can&&!s.can(le)&&Se(null)},[le]);const Me='more'===je?(0,K.pageFor)(ye):void 0,He=xe.filter(e=>(0,B.LIVE)(e)&&'new'===e.status).length,{unread:Ve,list:De,read:We}=(0,q.useNotifications)();(0,se.useAlertWatcher)(e,{nag:'staff'!==le}),(0,te.useReviewAlerts)(e),(0,ne.useScheduledNotices)({rid:e,staffId:be?.id??'',name:pe,onOpen:()=>Oe('more','orderlists')}),(0,re.useOffRotaAlerts)({enabled:'staff'!==le&&!!be});const $e=be?.role??le,ze='owner'===$e?'OWNER':'manager'===$e?'MANAGER':'STAFF',Ue=(0,se.useAlerts)(s=>s.history.filter(t=>t.rid===e&&(0,se.isUnread)(s,t)&&!(0,se.isCleared)(s,t)&&t.at>(s.seenAt[e]??0)).length),Fe=(0,se.useAlerts)(s=>s.todoSeen[e]),Ge=Math.max(0,Ve-De.filter(e=>!We[e.id]&&(Fe??[]).includes(e.id)).length)+Ue;(0,se.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:Ge})},[Ge]);const Ke=(0,T.useBookings)(e).filter(e=>'pending'===e.status).length,Ye=s.IS_ISOLATED_VENUE?[{id:e,name:ie.name,place:ie.location||ie.address||''}]:ce,qe=Ye.find(s=>s.id===e)??Ye[0],Je=be?.ownerAccess&&'owner'!==be.role?'owner privileges':be?.managerAccess&&'staff'===be.role?'manager privileges':'',Qe=(0,H.ownerHomeLayout)(le,be);(0,A.default)().width;return(0,de.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:L.colours.bg},edges:['top','left','right','bottom'],children:[(0,de.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:L.colours.border,gap:6},children:[(0,de.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Oe('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(U.Icon,{name:"search",colour:L.colours.text})}),(0,de.jsx)(y.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:Ge?`Notifications, ${Ge} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Oe('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsxs)(k.default,{children:[(0,de.jsx)(U.Icon,{name:"bell",colour:L.colours.text}),Ge?(0,de.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:L.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(C.T,{size:10,weight:"bold",children:Ge})}):null]})}),(0,de.jsx)(X.VoiceSlot,{size:44})]}),(0,de.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,de.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,de.jsx)(y.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${pe}. Account and role${Je?`, ${Je}`:''}`,disabled:'owner'!==V.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,de.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,de.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,de.jsxs)(k.default,{style:{flexShrink:1},children:[(0,de.jsxs)(C.T,{size:13,weight:"semibold",colour:L.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[be?`${pe} \xb7 ${be.level??I.ROLE_LABEL[be.role]}`:`${pe} \xb7 ${I.ROLE_LABEL[le]}`,'owner'===V.APP_VARIANT?' \u25be':'']}),Je?(0,de.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:Je}):null]})]})})})}),(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,de.jsx)(v.VenueHeaderBlock,{rid:e,name:ie.name,badge:ze,place:`${'staff'===le?'Staff preview \xb7 ':'Managers \xb7 '}${qe.place}`})}),le!==(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner')&&'owner'===V.APP_VARIANT?(0,de.jsx)(y.default,{onPress:()=>I.useOwner.getState().setPreviewRole(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,de.jsx)(C.T,{size:12,colour:L.colours.gold,children:'staff'===le?`Staff app preview: what staff see in the Staff app. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`:`Previewing the ${I.ROLE_LABEL[le].toLowerCase()} view. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`})}):null]}),(0,de.jsxs)(S.default,{ref:Te,...Be.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,de.jsx)(c.BackTitleRow,{back:!('home'===je&&!ye||Ne),onBack:Pe,title:Me?Me.title:'staff'===le&&'home'===je?'Staff app preview':fe[je]}),'home'===je&&be&&'staff'===be.role&&'owner'===V.APP_VARIANT?(0,de.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",colour:L.colours.gold,children:"Your manager access is off"}),(0,de.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,de.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Oe('more','clock')})]}):null,'home'!==je||Qe?null:(0,de.jsx)(r.WhoBar,{}),'home'===je&&!Qe&&be?(0,de.jsx)(ae.MyShiftCard,{go:Oe}):null,'home'===je&&!Qe&&be?(0,de.jsx)(f.MyTasksToday,{rid:e,staffId:be.id,name:be.name,onShift:(0,p.shiftNow)(be.id,Date.now()).on}):null,'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TodaysTipsCard,{rid:e,today:he}),'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TipsPotCard,{rid:e,today:he}),'home'===je?'staff'===le?(0,de.jsx)($.StaffHome,{go:Oe}):(0,de.jsx)(M.Dashboard,{go:Oe,ownerHome:Qe}):null,'orders'===je?(0,de.jsx)(Y.Orders,{}):null,'bookings'===je?(0,de.jsx)(E.Bookings,{go:Oe}):null,'forecast'===je?(0,de.jsx)(z.Forecasts,{go:Oe}):null,'chat'===je?(0,de.jsx)(J.Chat,{go:Oe}):null,'more'===je?Me?(0,de.jsx)(Me.C,{go:Oe}):(0,de.jsx)(K.MoreMenu,{go:Oe}):null]}),(0,de.jsx)(b.SeatAllergenReminder,{rid:e}),'staff'!==le?(0,de.jsx)(ee.PrintHost,{rid:e}):null,'staff'!==le?(0,de.jsx)(Z.AlertHost,{variant:"managers",rid:e,me:pe,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,de.jsx)(Q.AssistantSheet,{}),(0,de.jsx)(F.BottomTabs,{background:(0,t.soutersSurface)('#0d0d0d'),active:je,onPress:e=>Oe(e),tabs:ue.filter(e=>!e.can||e.can(le)).map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ie?{text:String(Ie),bg:L.colours.red}:'bookings'===e.id&&Ke?{text:String(Ke),bg:L.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&He?{text:String(He),bg:L.colours.red}:null}))}),(0,de.jsx)(w.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ye.filter(e=>!Re||'saltmarsh'!==e.id).map(s=>(0,de.jsx)(y.default,{accessibilityRole:"button",onPress:()=>{I.useOwner.getState().setSite(s.id),ke(!1),Oe('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:s.id===e?L.colours.gold:L.colours.border},children:(0,de.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,de.jsxs)(k.default,{children:[(0,de.jsx)(C.T,{weight:"medium",children:s.name}),(0,de.jsx)(C.Muted,{children:s.place})]}),s.id===e?(0,de.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},s.id)),(0,de.jsx)(C.Muted,{children:s.IS_ISOLATED_VENUE?`This app belongs only to ${ie.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,de.jsx)(w.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[be?(0,de.jsxs)(C.Row,{gap:10,children:[(0,de.jsx)(_.StaffAvatar,{id:be.id,size:44}),(0,de.jsxs)(k.default,{style:{flex:1},children:[(0,de.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",be.name]}),(0,de.jsx)(C.Muted,{children:(0,N.levelJob)(be.level??I.ROLE_LABEL[be.role],be.job)})]})]}):(0,de.jsxs)(k.default,{style:{gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,de.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,de.jsx)(P.SignInWithLink,{})]}),s.IS_QUEUED_VENUE||s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_GREENSIDE||!be?null:(0,de.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=s.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():s.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,de.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!be||(0,O.clampRole)(e,be.ownerAccess?'owner':be.managerAccess?'manager':be.role)===e).map(e=>(0,de.jsx)(C.Button,{kind:e===le?'primary':'secondary',label:'staff'===e?'Staff app preview':`${I.ROLE_LABEL[e]} view`,onPress:()=>{I.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,de.jsx)(D.OnboardingHost,{go:Oe}),(0,de.jsx)(W.CoachHost,{})]})}},1339,[5,798,985,1172,1160,1040,977,1041,2,1047,1048,1070,1087,34,373,395,402,295,426,102,36,794,847,848,865,840,1340,1147,1100,899,1348,997,236,1355,13,846,1384,1390,1391,1392,1153,1191,1393,1378,1394,1395,1376,1135,1410,1116,1174,1310,1176,1189,1400,1085,1086,1159,1460,1461,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1340,[5,1341,11,1342,796,806,1112,1113,1091,1115,1114,1327,1328,1100,1281,1012,1089,14,1343,1185,1344,1315,1081,1075,1090,34,102,794,1290,848,830,836,827,1266,840,1147,1096,1014,1345,1346,1136,1347,1176,985,1149,1323,852,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1341,[34,794,25]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1342,[6,34,102,794,985,1214,25]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1343,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1344,[34,402,1143,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1345,[34,102,848,1014,794,840,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1346,[34,402,102,794,840,25]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1347,[34,102,853,848,833,840,794,25]); -__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1348,[5,1349,1350,1351,1352,1353,34,236,41,102,846,997,840,1354,794,985,2,1072,996,865,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1349,[34,102,847,794,5,6,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1350,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1351,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1352,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1353,[34,102,847,794,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1354,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:a=!1}){const{rid:n,r:b,now:O,role:te,me:le,today:oe}=(0,S.useCtx)(5e3),ae=(0,p.useOrders)(n),ne=(0,p.useBookings)(n),ie=(0,p.useWaitlist)(n),de=(0,p.useEvents)(n),ue=(0,p.useRatings)(n),he=(0,k.useOwner)(e=>e.staff),ge=(0,k.useOwner)(e=>e.attendance),xe=(0,k.useOwner)(e=>e.shifts),ye=(0,P.useRealHistory)(n,O),be=(0,o.useMemo)(()=>(0,t.forecastToday)(b,ne,ae,de,O,ye??void 0),[b,ne,ae,de,ye,O.getTime()/6e4|0]),fe=(0,N.useExamples)(),me=(0,M.useCashUp)(e=>e.cashUps),je=ne.filter(e=>e.date===oe),pe=ae.filter(A.LIVE),ke=ie.filter(e=>'waiting'===e.status||'notified'===e.status),we=je.filter(e=>['seated','finished'].includes((0,T.shownStatus)(e))).reduce((e,s)=>e+s.partySize,0),$e=(0,ee.coversSplit)(je,oe),ve=$e.walkIns,Ce=$e.bookings,Ie=pe.filter(e=>(0,G.chainNeedsAction)(e,ne)),Te=je.filter(e=>['confirmed','seated'].includes(e.status)&&(0,G.bookingNeedsAction)(e,pe)),Be=pe.flatMap(e=>(0,C.readinessFor)(e,b,O).map(s=>({...s,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),De=be.nextHour,Ae=(0,A.busyLevel)(De?.coversHigh??0,be.busy.busy),Se=(0,A.restOfDayLevel)(be,b),Le=ae.filter(e=>e.paid>0).reduce((e,s)=>e+s.paid,0)+(fe?186e3:0),Pe=(0,I.ymd)(new Date(O.getTime()-6048e5)),Ne=me.find(e=>e.rid===n&&e.date===Pe),Me=Ne?(0,F.takings)(Ne.vals):null,Fe=fe?(0,L.revenueHistory)(b,O,7).filter(e=>e.date.getDay()===O.getDay()).pop():null!=Me?{date:(0,I.parseYmd)(Pe),total:Math.round(100*Me)}:void 0,Oe=(0,o.useMemo)(()=>(0,L.insights)(b,ne,ae,de,ue,O,we),[b.id,ne.length,ue.length,we]),Re=((0,S.weekday)(O),ge.filter(e=>e.date===oe&&e.in&&!e.out)),He=(0,X.useFrontDoor)(oe),We=(0,h.useBookingWrite)(),Ee=(0,w.useOutstanding)(),ze=(0,r.useTravelDay)('owner',oe),Ge=(0,S.useSignedIn)(),Ue=(0,S.useInStaffApp)(),qe=(0,F.canSeeMonthTakings)(te,Ge,{inStaffApp:Ue,live:(0,H.isLive)()}),Ye=(0,R.homeSetupNagsHidden)(n),Ke=(0,k.useOwner)(e=>e.socialPosts.reduce((e,s)=>e+('awaiting approval'===s.status?1:0),0)),[Qe,Ve]=(0,o.useState)(!1),Xe=le.replace(' (example)',''),Ze=k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return ze?(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(r.DayView,{rid:n,day:ze,today:oe,app:"owner"})]}):a?(0,se.jsxs)(m.default,{style:{gap:12},testID:"owner-home",children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),k.CAN.takings(te)?(0,se.jsx)(j.Row,{wrap:!0,gap:10,children:(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})})}):null,(0,se.jsx)(Q.TodaysTipsCard,{rid:n,today:oe}),(0,se.jsx)(Q.TipsPotCard,{rid:n,today:oe}),k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(Y.WhoBar,{}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ge&&'owner'!==Ge.role?(0,se.jsx)(_.MyShiftCard,{go:e}):null,Ge?(0,se.jsx)(K.MyTasksToday,{rid:n,staffId:Ge.id,name:Ge.name,onShift:(0,V.shiftNow)(Ge.id,Date.now()).on}):null,k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]}):(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,k.CAN.takings(te)?(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ie,_e.MonthTakingsCard=re,_e.WalkInSplitCard=ce;var s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),o=_r(_d[3]),a=_r(_d[4]),n=e(a),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),x=_r(_d[11]),y=_r(_d[12]),b=e(_r(_d[13])),f=e(_r(_d[14])),m=e(_r(_d[15])),j=_r(_d[16]),p=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),T=_r(_d[24]),B=_r(_d[25]),D=_r(_d[26]),A=_r(_d[27]),S=_r(_d[28]),L=_r(_d[29]),P=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),F=_r(_d[33]),O=_r(_d[34]),R=_r(_d[35]),H=_r(_d[36]),W=_r(_d[37]),E=_r(_d[38]),z=_r(_d[39]),G=_r(_d[40]),U=_r(_d[41]),q=_r(_d[42]),Y=_r(_d[43]),_=_r(_d[44]),K=_r(_d[45]),Q=_r(_d[46]),V=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]);const te=18,le=18,oe=150,ae=34;function ne(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const s=e.length,t=[],l=[];for(let l=0;l9){const n=3/Math.sqrt(a);l[e]=n*s*t[e],l[e+1]=n*o*t[e]}}let o=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let t=0;tte+(s-1)/Math.max(1,e-1)*t,o=[1,5,10,15,20,25].filter(s=>s=36)&&a.push(e);for(;a.length&&l(e)-l(a[a.length-1])<36;)a.pop();return[...a,e]}function re({rid:e,today:s}){const t=(0,M.useCashUp)(e=>e.cashUps),[l,i]=(0,o.useState)(s.slice(0,7)),[r,d]=(0,o.useState)(0),[c,u]=(0,o.useState)(null),h=(0,o.useMemo)(()=>(0,F.monthTakings)(t,e,l,s),[t,e,l,s]),x=(0,o.useMemo)(()=>(0,F.firstTakingsMonth)(t,e),[t,e]),y=!!x&&xte+(e-1)/Math.max(1,k-1)*w,I=e=>$-e/v*128,T=[];h.days.forEach((e,s)=>{if('recorded'!==e.state)return;const t={x:C(e.day),y:I(e.value)};s&&'recorded'===h.days[s-1].state?T[T.length-1].push(t):T.push([t])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),S=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===s):void 0)??A??B[B.length-1],L=e=>{const s=B.findIndex(e=>e.date===S?.date),t=B[Math.max(0,Math.min(B.length-1,s+e))];t&&(u(t.date),b.default.announceForAccessibility?.(P(t)))},P=e=>`${(0,F.longDay)(e.date)}, ${'recorded'===e.state?(0,F.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,N=h.current?`so far in ${h.month}`:`in ${h.month} ${l.slice(0,4)}`,R=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,F.monthName)((0,F.addMonths)(l,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,H=h.recorded?`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. ${(0,F.poundsWhole)(h.total)} ${N}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,F.longDay)(h.best.date)}, ${(0,F.poundsWhole)(h.best.value)}.${R?` ${R.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,W=r?ie(k,r):[],E=(e,s,t,o,a)=>(0,se.jsx)(f.default,{testID:a,accessibilityRole:"button",accessibilityLabel:s,accessibilityState:{disabled:!t},disabled:!t,onPress:()=>{i((0,F.addMonths)(l,o)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:t?e?.6:1:.25}),children:(0,se.jsx)(j.T,{size:24,colour:D.colours.gold,center:!0,children:e})});return(0,se.jsx)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center',gap:6},children:(0,se.jsxs)(m.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),y||p?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[E('\u2039',`Previous month, ${(0,F.monthName)((0,F.addMonths)(l,-1))}`,y,-1,'mt-prev'),(0,se.jsxs)(j.T,{center:!0,colour:D.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",l.slice(0,4)]}),E('\u203a',`Next month, ${(0,F.monthName)((0,F.addMonths)(l,1))}`,p,1,'mt-next')]}):null,(0,se.jsx)(m.default,{accessible:!0,accessibilityLabel:H,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(j.T,{size:38,weight:"bold",colour:D.colours.gold,center:!0,testID:"mt-total",children:(0,F.poundsWhole)(h.total)}),(0,se.jsx)(j.T,{center:!0,colour:D.colours.goldLight,children:N}),(0,se.jsxs)(j.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,F.shortDay)(h.best.date)," \xb7 ",(0,F.poundsWhole)(h.best.value)]}),R?(0,se.jsx)(j.Muted,{center:!0,testID:"mt-vs",children:R}):null]}):(0,se.jsx)(j.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,se.jsxs)(m.default,{style:{width:'100%',minWidth:0},children:[(0,se.jsxs)(m.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:oe,width:'100%',overflow:'visible'},children:[r?(0,se.jsxs)(n.default,{width:r,height:oe,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,se.jsx)(a.Defs,{children:(0,se.jsxs)(a.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,se.jsx)(a.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,se.jsx)(a.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,se.jsx)(a.Line,{x1:te,y1:$,x2:r-le,y2:$,stroke:D.colours.hairline,strokeWidth:1}),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:`${ne(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${s}`)),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:ne(e),stroke:D.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${s}`)),T.filter(e=>1===e.length).map((e,s)=>(0,se.jsx)(a.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:D.colours.gold},`s${s}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,se.jsx)(a.Circle,{cx:C(e.day),cy:$,r:2,fill:"none",stroke:D.colours.muted,strokeWidth:1},e.date)),S&&'recorded'===S.state?(0,se.jsx)(a.Line,{x1:C(S.day),y1:10,x2:C(S.day),y2:$,stroke:D.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===s);return(0,se.jsx)(a.Circle,{cx:C(e.day),cy:'recorded'===e.state?I(e.value):$,r:4.5,fill:D.colours.gold,stroke:D.colours.surface,strokeWidth:1.5})})():null,S&&'recorded'===S.state&&S.date!==s?(0,se.jsx)(a.Circle,{cx:C(S.day),cy:I(S.value),r:5,fill:D.colours.surface,stroke:D.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,se.jsx)(f.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:P(e),accessibilityState:{selected:S?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:oe,left:C(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,se.jsx)(m.default,{testID:"mt-axis",style:{height:O.AXIS_BAND+6,minHeight:O.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:W.map(e=>(0,se.jsx)(j.T,{size:O.AXIS_FONT,colour:D.colours.muted,style:{position:'absolute',left:C(e)-17,width:ae,top:0,textAlign:'center'},children:String(e)},e))})]}),S&&B.length?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,se.jsx)(f.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===S.date,onPress:()=>L(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u2039"})}),(0,se.jsxs)(m.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:P(S),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,se.jsx)(j.Muted,{center:!0,children:S.date===s?`Today \xb7 ${(0,F.shortDay)(S.date)}`:(0,F.shortDay)(S.date)}),(0,se.jsx)(j.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===S.state?D.colours.goldLight:D.colours.muted,children:'recorded'===S.state?(0,F.poundsWhole)(S.value):'pending'===S.state?'Not cashed up yet':'No cash-up'})]}),(0,se.jsx)(f.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===S.date,onPress:()=>L(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,se.jsx)(j.Muted,{center:!0,size:13,children:"From confirmed cash ups: gross takings, or card + cash. \u25cb = no cash up that day."})]})})}const de='#3A2F1E';function ce({split:e}){return(0,se.jsx)(j.Card,{style:{alignItems:'center',gap:8},children:(0,se.jsxs)(m.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,se.jsx)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,se.jsx)(j.Muted,{center:!0,children:"No Covers yet"}):(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",colour:D.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,se.jsxs)(m.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:de,borderWidth:1,borderColor:D.colours.gold},children:[(0,se.jsx)(m.default,{style:{width:`${e.walkInPct}%`,backgroundColor:D.colours.gold}}),(0,se.jsx)(m.default,{style:{flex:1,backgroundColor:de}})]})]})]})})}},1355,[829,1120,1356,34,900,1073,1148,1077,1078,1344,1281,851,1081,281,402,102,794,848,865,1157,830,836,1134,827,1075,855,840,1147,1100,1119,1125,1126,1024,13,1324,925,985,1365,1366,1136,838,1369,1151,1160,1159,1047,1048,1070,1096,1315,1130,1280,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:m,rid:L,today:P,me:O}=(0,R.useCtx)(6e4),Y=O.replace(" (example)",""),Z=m.settings,J=e=>k.useStore.getState().updateSettings(L,e),[X,se]=(0,b.useState)(()=>(0,d.takeAdvancedPrefill)()),[te,oe]=(0,b.useState)(null),ae=e=>{if(e.onReset)return e.onReset(),void oe(`${e.title}: back to the defaults.`);J(Object.fromEntries(e.reset.map(e=>[e,void 0]))),oe(`${e.title}: back to the defaults.`)},ne=(0,D.useBookings)(L),le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,N.jsx)(y.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,N.jsx)(y.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,N.jsx)(y.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,S.dogQuestionOn)(m),onChange:e=>J({dogQuestion:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,N.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:Z.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>J({maxDogsPerSlot:e||void 0})})]}),(0,N.jsx)(y.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,S.accessQuestionOn)(m),onChange:e=>J({accessQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,S.dietQuestionOn)(m),onChange:e=>J({dietQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==Z.tableRequests,onChange:e=>J({tableRequests:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),re=(0,S.dwellBands)(m),ie=(e,s)=>J({dwellBands:re.map((t,o)=>o===e?{...t,mins:s}:t)}),de=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),re.map((e,s)=>{const t=(0,S.dwellFor)(m,9999===e.upTo?20:e.upTo,ne);return(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:(0,S.bandLabel)(re,s)}),(0,N.jsx)(K,{label:`table time for ${(0,S.bandLabel)(re,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>ie(s,e)})]}),t.learned&&t.mins!==e.mins?(0,N.jsxs)(y.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,N.jsx)(y.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==Z.dwellLearn,onChange:e=>J({dwellLearn:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),he=Z.reservables??(0,C.reservablesOf)(m),ue=Z.reservables??('anchorage'===L?he:[]),ce=(e,s)=>J({reservables:ue.map(t=>t.id===e?{...t,...s}:t)}),pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[ue.length?ue.map(e=>(0,N.jsxs)(f.default,{style:{gap:4},children:[(0,N.jsx)(y.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>ce(e.id,{active:s})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.Muted,{children:"Price"}),(0,N.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>ce(e.id,{price:100*s})})]}),(0,N.jsxs)(y.Muted,{size:12,children:["Uses: ",e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')," from the counted stock. Held from the Display count and shown as \u201cReserved\u201d."]})]},e.id)):(0,N.jsx)(y.Muted,{children:"No reservable dishes yet."}),(0,N.jsx)(y.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==Z.reserveStock,onChange:e=>J({reserveStock:e})}),(0,N.jsx)(y.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),ge=(0,S.regularEventsOf)(m),[be,me]=(0,b.useState)(null),xe=e=>J({regularEvents:e}),fe=be?be.name.trim()?be.time&&!W.test(be.time)?'Start time looks wrong (use 20:00).':be.lastFood&&!W.test(be.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==be.rule.kind||U.test(be.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',ye=(0,N.jsxs)(f.default,{style:{gap:8},children:[ge.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,N.jsx)(y.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,N.jsx)(y.Badge,{kind:"neutral",label:"OFF"})]}),(0,N.jsxs)(y.Muted,{children:[(0,S.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,N.jsxs)(y.Muted,{size:12,children:["Next: ",(0,S.nextOccurrence)(e,P)??'\u2014']}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>me({...e})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>xe(ge.filter(s=>s.id!==e.id))})]})]},e.id)),be?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Name"}),(0,N.jsx)(q,{label:"Event name",width:220,value:be.name,onChange:e=>me({...be,name:e}),placeholder:"Open Mic Night"})]}),(0,N.jsx)(y.Muted,{children:"Repeats"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(y.Chip,{label:"Last \u2026 of the month",selected:'last'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'last',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"Every week",selected:'weekly'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'weekly',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"One-off date",selected:'once'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'once',date:P}})})]}),'weekday'in be.rule?(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:_.map(e=>(0,N.jsx)(y.Chip,{label:G[e],selected:be.rule.weekday===e,onPress:()=>me({...be,rule:{...be.rule,weekday:e}})},e))}):(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Event date",width:130,value:be.rule.date,onChange:e=>me({...be,rule:{kind:'once',date:e}}),placeholder:"2026-12-31"})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts (optional)"}),(0,N.jsx)(q,{label:"Start time",value:be.time??'',onChange:e=>me({...be,time:e||void 0}),placeholder:"20:00",bad:!!be.time&&!W.test(be.time)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Last food orders (optional)"}),(0,N.jsx)(q,{label:"Last food orders",value:be.lastFood??'',onChange:e=>me({...be,lastFood:e||void 0}),placeholder:"19:00",bad:!!be.lastFood&&!W.test(be.lastFood)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Notes"}),(0,N.jsx)(q,{label:"Notes",width:240,value:be.notes??'',onChange:e=>me({...be,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,N.jsx)(y.Toggle,{label:"Expect busier (raises the forecast)",value:be.busier,onChange:e=>me({...be,busier:e})}),(0,N.jsx)(y.Toggle,{label:"On",value:be.active,onChange:e=>me({...be,active:e})}),fe?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:fe}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save event",disabled:!!fe,testID:"event-save",onPress:()=>{const e={...be,name:be.name.trim()};xe(ge.some(s=>s.id===e.id)?ge.map(s=>s.id===e.id?e:s):[...ge,e]),me(null),oe(`Saved ${e.name}.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>me(null)})]})]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>me({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,N.jsx)(y.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),je=(0,v.hourSetsOf)(m),we=(0,v.seasonOn)(m,new Date),[ke,ve]=(0,b.useState)(null),[Ce,Se]=(0,b.useState)(null),Te=Z.hourOverrides??[],Re=ke?ke.start&&!H.test(ke.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ke.hours&&Object.values(ke.hours).some(e=>e&&(!W.test(e[0])||!W.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',De=Object.values(Z.lastFoodByDay??{}).some(e=>e&&!W.test(e)),Me=[];je.some(e=>!e.hours)&&Me.push(`${je.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);je.filter(e=>e.hours).length>=1&&je.length>1&&je.some(e=>!e.start)&&Me.push('the date each season starts');const Le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Me.length?(0,N.jsxs)(y.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Me.join(' and '),". Until then the app uses ",we?.name??'your weekly'," hours all year."]}):null,we?(0,N.jsxs)(y.T,{colour:T.colours.goldLight,children:["In use today: ",we.name]}):null,je.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",children:e.name}),we?.id===e.id?(0,N.jsx)(y.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,N.jsx)(y.Badge,{kind:"amber",label:"NOT SET"})]}),(0,N.jsx)(y.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,N.jsx)(y.Muted,{size:13,children:_.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,N.jsx)(y.Muted,{size:13,children:"No hours yet."}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>ve({...e,hours:e.hours?{...e.hours}:{...je.find(e=>e.hours)?.hours??m.kitchenHours}})})]},e.id)),ke?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.T,{weight:"semibold",children:[ke.name," hours"]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts every year on (MM-DD)"}),(0,N.jsx)(q,{label:"Season start date",value:ke.start??'',onChange:e=>ve({...ke,start:e||void 0}),placeholder:"04-01",bad:!!ke.start&&!H.test(ke.start)})]}),_.map(e=>{const s=ke.hours?.[e]??null,t=s=>ve({...ke,hours:{...ke.hours,[e]:s}});return(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.T,{style:{width:44},children:G[e]}),(0,N.jsx)(y.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:`${S.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!W.test(s[0])}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!W.test(s[1])||s[0]>=s[1]})]}):null]},e)}),Re?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:Re}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save hours",disabled:!!Re,testID:"season-save",onPress:()=>{var e;e=je.map(e=>e.id===ke.id?ke:e),J({hourSets:e}),ve(null),oe(`Saved ${ke.name} hours.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ve(null)})]})]}):null,(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,N.jsx)(y.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Te.map(e=>(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(y.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>J({hourOverrides:Te.filter(s=>s.date!==e.date)})})]},e.date)),Ce?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Special day date",width:130,value:Ce.date,onChange:e=>Se({...Ce,date:e}),placeholder:"2026-12-31",bad:!U.test(Ce.date)})]}),(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Chip,{label:Ce.hours?'Open':'Closed',selected:!!Ce.hours,onPress:()=>Se({...Ce,hours:Ce.hours?null:['12:00','19:00']})}),Ce.hours?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:"Opens",width:74,value:Ce.hours[0],onChange:e=>Se({...Ce,hours:[e,Ce.hours[1]]})}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:"Last food orders",width:74,value:Ce.hours[1],onChange:e=>Se({...Ce,hours:[Ce.hours[0],e]})})]}):null]}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Note"}),(0,N.jsx)(q,{label:"Note",width:220,value:Ce.note??'',onChange:e=>Se({...Ce,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=U.test(Ce.date)?Ce.hours&&(!W.test(Ce.hours[0])||!W.test(Ce.hours[1])||Ce.hours[0]>=Ce.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,N.jsxs)(N.Fragment,{children:[e?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:e}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{J({hourOverrides:[...Te.filter(e=>e.date!==Ce.date),Ce].sort((e,s)=>e.date.localeCompare(s.date))}),Se(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Se(null)})]})]})})()]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Se({date:P,hours:null})}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,N.jsx)(y.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:_.map(e=>(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.Muted,{size:12,children:G[e]}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,width:74,value:Z.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!Z.lastFoodByDay?.[e]&&!W.test(Z.lastFoodByDay[e]),onChange:s=>J({lastFoodByDay:{...Z.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),De?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,N.jsx)(y.Muted,{children:"After last food orders, booking times are\u2026"}),(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'drinks'})}),(0,N.jsx)(y.Chip,{label:"Not offered",selected:'block'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'block'})})]})]}),Pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,S.coversCounterOn)(m),onChange:e=>J({coversCounter:e})}),(0,N.jsx)(y.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,S.nextTableOn)(m),onChange:e=>J({nextTableFree:e})}),(0,N.jsx)(y.Toggle,{label:"Show takeaway on home screens",value:(0,S.showTakeaway)(m),onChange:e=>J({showTakeaway:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,N.jsx)(y.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),Oe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!Z.holidayFullNames,onChange:e=>J({holidayFullNames:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[ze,Ie]=(0,b.useState)(null),$e=ze??Z.whatsapp??'',Be=!$e.trim()||!!(0,M.waNumber)($e),Ae=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.T,{children:"The venue\u2019s WhatsApp number"}),(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:$e,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{Ie(e),e.trim()?(0,M.waNumber)(e)&&J({whatsapp:e.trim()}):J({whatsapp:void 0})}}),$e.trim()&&Be?(0,N.jsx)(y.Badge,{kind:"gold",label:`wa.me/${(0,M.waNumber)($e)}`}):null]}),Be?null:(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,N.jsx)(y.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Fe=(0,E.soldOutSettingsOf)(Z.soldOut),Ee=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Fe.auto,onChange:e=>J({soldOut:{...Fe,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,N.jsx)(y.Muted,{size:13,children:Fe.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,N.jsx)(y.T,{children:"Clear sold out dishes by themselves"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-soldout-${e}`,label:E.SOLD_OUT_CLEAR_LABEL[e],selected:Fe.clear===e,onPress:()=>J({soldOut:{...Fe,clear:e}})},e))}),'manual'!==Fe.clear?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(y.T,{children:"Next morning means"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,N.jsx)(y.Chip,{label:e,selected:Fe.morningAt===e,onPress:()=>J({soldOut:{...Fe,morningAt:e}})},e))})]}):null,(0,N.jsx)(y.Muted,{size:13,children:'close'===Fe.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Fe.clear?`Dishes go back on at ${Fe.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),Ne=(0,s.venueBusy)(m,ne,new Date),We=(0,F.clampWeeks)(Z.forecastMinWeeks),He=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(f.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:Ne.words,children:[(0,N.jsx)(y.T,{center:!0,size:20,weight:"semibold",children:Ne.words}),(0,N.jsx)(y.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:Z.busyCoversPerHour??30,min:1,max:200,onChange:e=>J({busyCoversPerHour:e,busyLearning:!1})}),(0,N.jsx)(y.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,N.jsx)(y.Toggle,{label:"Learn the busy level from our real history",value:!1!==Z.busyLearning,onChange:e=>J({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),Ne.enough?null:(0,N.jsx)(y.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,N.jsx)(y.T,{children:"History needed before forecasts show"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:We===e,onPress:()=>J({forecastMinWeeks:e})},e))}),(0,N.jsx)(y.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===We?'1 week':`${We} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,N.jsx)(n.ForecastDaySettings,{r:m,set:J})]}),Ue=(0,j.depositOf)(Z),Ge=e=>J({deposit:{...Ue,...e}}),qe=t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ue.on,onChange:e=>Ge({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Amount per person"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-amount",value:Ue.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"From a party of"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-party",value:Ue.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from party size"})]}),(0,N.jsx)(y.T,{children:"Refundable?"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:8,children:[(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ue.refundable,onPress:()=>Ge({refundable:!0})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ue.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ue.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ue.refundable?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Refunded if cancelled this many hours before"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-cutoff",value:Ue.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,N.jsx)(y.T,{children:"Words guests see (optional)"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ue.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:T.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,padding:10,fontSize:15}}),(0,N.jsx)(y.Muted,{size:13,children:Ue.on&&Ue.perPersonPence>0?`Guests booking for ${Ue.fromParty} or more see: \u201c${(0,j.depositWords)(Ue,Ue.fromParty,m.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,N.jsx)(y.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ue.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ue.wixLinksOn?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Link works for"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-linkhours",value:Ue.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,N.jsx)(y.Muted,{size:13,children:Ue.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,N.jsx)(w.LoyaltySettingsPanel,{}),Qe=(0,N.jsx)(ee,{rid:L}),Ye=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:le,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:de,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:pe,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:ye,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Le,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Pe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsx)(l.TableOrderSettings,{rid:L,me:Y}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Ae,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>V(L)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,N.jsx)(B.NotificationsSettings,{rid:L}),help:'adv-notifications',onReset:()=>A.useNotifs.getState().resetSeeds(L)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,N.jsx)(B.OrderListsSettings,{rid:L}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(L)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,N.jsx)(u.TaskLibrarySettings,{rid:L}),help:'adv-tasks',onReset:()=>g.useDailyTasks.getState().resetLibrary(L)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,N.jsx)(c.CashUpSettings,{rid:L}),help:'adv-cashup',onReset:()=>p.useCashUp.getState().resetFields(L)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,N.jsx)(c.TipsSettings,{rid:L}),help:'adv-tips',onReset:()=>p.useCashUp.getState().setShow(L,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,N.jsx)(B.ClockAreaSettings,{rid:L,me:Y}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(L,Y)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,N.jsx)(h.HrSettingsCard,{rid:L}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:He,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ee,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,N.jsx)(z.GridSettings,{rid:L,me:Y}),help:'adv-tablegrid',onReset:()=>{const e=$.useFloor.getState().settings[L];$.useFloor.getState().setSettings(L,{...$.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,N.jsx)(I.PrintersSettings,{rid:L,go:e}),help:'adv-printers',onReset:()=>{const e=$.useFloor.getState().settings[L];e&&$.useFloor.getState().setSettings(L,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,N.jsx)(i.BlockSettings,{rid:L}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,N.jsx)(r.GiftQrSettings,{rid:L}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:Oe,help:'adv-holidays'}],Ve=X.trim().toLowerCase(),Ze=(0,b.useMemo)(()=>Ye.filter(e=>!Ve||`${e.title} ${e.words}`.toLowerCase().includes(Ve)),[Ve,Ye]);return(0,N.jsxs)(f.default,{style:{gap:12},testID:"advanced-settings",children:[(0,N.jsx)(y.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:X,onChangeText:se,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:T.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:T.colours.accentBorder,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:12,fontSize:16}}),te?(0,N.jsx)(y.Banner,{kind:"success",title:te}):null,Ze.length?null:(0,N.jsxs)(y.Muted,{children:["No settings match \u201c",X,"\u201d."]}),Ze.map(s=>(0,N.jsx)(y.Card,{children:(0,N.jsxs)(f.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{size:17,weight:"semibold",colour:T.colours.gold,children:s.title}),e?(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,N.jsx)(y.T,{colour:T.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,N.jsx)(y.Row,{style:{justifyContent:'flex-end'},children:(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ae(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return Y}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,R.useCtx)(6e4),t=(0,v.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,N.jsx)(y.Card,{onPress:()=>e('more','advanced'),highlight:T.colours.gold,children:(0,N.jsxs)(f.default,{testID:"seasons-todo",style:{gap:4},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",colour:T.colours.gold,children:"Setup checklist: kitchen hours"}),(0,N.jsx)(y.T,{colour:T.colours.muted,children:"\u203a"})]}),(0,N.jsxs)(y.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=e(b),x=e(_r(_d[15])),f=e(_r(_d[16])),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),z=_r(_d[31]),I=_r(_d[32]),$=_r(_d[33]),B=_r(_d[34]),A=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]);const W=/^([01]\d|2[0-3]):[0-5]\d$/,H=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,U=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:n=90,bad:l,testID:r}){return(0,N.jsx)(a.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:T.colours.muted,style:{width:n,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?T.colours.red:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:T.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,N.jsx)(y.T,{size:20,colour:T.colours.gold,children:a})});return(0,N.jsxs)(y.Row,{gap:8,children:[r('\u2212',-l),(0,N.jsx)(y.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const Y={DEFAULT_DWELL:S.DEFAULT_DWELL,ANCHORAGE_SEASONS:v.ANCHORAGE_SEASONS};function V(e){const s=L.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,L.chairsId)(e))}const Z=[1,2,3,4,5,6,0],J=e=>`${7===e.days.length?'Every day':Z.filter(s=>e.days.includes(s)).map(e=>P.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${P.AUDIENCE_LABEL[e.audience]}`;function X({init:e,onSave:s,onCancel:t}){const[o,n]=(0,b.useState)(e.text),[l,r]=(0,b.useState)(e.days),[i,d]=(0,b.useState)(e.time),[h,u]=(0,b.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,P.validTime)(i);return(0,N.jsxs)(f.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:T.colours.accentBorder,borderRadius:12,padding:10},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"What it says"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:n,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:T.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}}),(0,N.jsx)(y.T,{weight:"semibold",children:"Days"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,N.jsx)(y.Chip,{label:P.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Time (UK)"}),(0,N.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,P.validTime)(i)})]}),(0,N.jsx)(y.T,{weight:"semibold",children:"Who sees it"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,N.jsx)(y.Chip,{label:P.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,N.jsx)(y.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,N.jsxs)(y.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,N.jsx)(y.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function ee({rid:e}){m.default.useEffect(()=>{L.useReminders.getState().ensure(e)},[e]);const s=(0,L.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,L.useReminders)(s=>s.rules[e]),a=(0,P.clampRules)(o??P.DEFAULT_BREAK_RULES),n=(0,L.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,O.useOwner)(e=>e.staff),r=L.useReminders.getState(),[i,d]=(0,b.useState)(null),[h,u]=(0,b.useState)(null),c=s=>r.setRules(e,s);return(0,N.jsxs)(f.default,{style:{gap:10},testID:"reminders-settings",children:[(0,N.jsx)(y.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,N.jsx)(y.T,{weight:"semibold",children:"Break reminders"}),(0,N.jsx)(y.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,N.jsx)(K,{label:"first break reminder",step:15,min:30,max:P.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Remind once more after"}),(0,N.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,N.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,N.jsxs)(y.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,N.jsx)(f.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:T.colours.hairline,paddingBottom:8},children:i===e.id?(0,N.jsx)(X,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,N.jsx)(y.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,N.jsx)(y.Muted,{size:13,children:J(e)}),h===e.id?(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,N.jsx)(y.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,N.jsx)(y.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,N.jsx)(X,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,N.jsxs)(y.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,N.jsxs)(y.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (Fri and Sun, 21:00); your own reminders stay."]}),(0,N.jsx)(y.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1356,[1121,5,1341,796,1357,1358,1360,1361,1362,1156,1047,1048,1024,1029,34,402,102,794,14,1363,800,852,1075,851,840,1100,848,1150,1001,1002,865,1364,1310,1014,1043,1021,1123,978,25]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1357,[796,34,102,794,1120,851,840,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1358,[829,34,236,102,794,848,1014,1131,1205,985,1276,1359,25]); -__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1359,[829,1229]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrSettings=function({rid:e}){const s=(0,n.useFloor)(t=>t.settings[e]),h={...n.DEFAULT_SETTINGS,...s??{}},[p,y]=(0,t.useState)(h.giftQrUrl??''),[Q,b]=(0,t.useState)(''),S=t=>n.useFloor.getState().setSettings(e,{...h,...t}),x=(0,u.giftQrUrlOk)(p);return(0,c.jsxs)(l.default,{style:{gap:8},testID:"adv-giftqr-panel",children:[(0,c.jsx)(o.Toggle,{testID:"giftqr-on",label:"Show \u201cBuy a gift card\u201d on the Display",value:!!h.giftQrOn,disabled:!h.giftQrOn&&!(0,u.giftQrUrlOk)(h.giftQrUrl),onChange:e=>{S({giftQrOn:e}),b(e?'On: the Display shows Buy a gift card.':'Off: the Display hides Buy a gift card.')}}),(0,c.jsx)(o.Field,{testID:"giftqr-url",label:"Your gift card page (https://\u2026)",value:p,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>{y(e.slice(0,u.GIFT_QR_MAX)),b('')},placeholder:"https://www.example.com/gift-card"}),p&&!x?(0,c.jsx)(o.T,{size:13,colour:f.colours.amber,children:"Use the full address starting https://"}):null,(0,c.jsx)(o.Button,{small:!0,label:"Save the page address",testID:"giftqr-save",disabled:!x||p.trim()===(h.giftQrUrl??''),onPress:()=>{S({giftQrUrl:p.trim()}),b('Saved. The Display QR opens this page.')}}),Q?(0,c.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(o.Muted,{children:Q})}):null,(0,c.jsx)(o.Muted,{size:13,children:"Gift cards are sold through your website. The Display shows only a QR code and \u201cScan to buy a gift card on your phone\u201d: no prices or balances."})]})};var e,t=r(d[0]),s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),u=r(d[4]),f=r(d[5]),c=r(d[6])},1360,[34,102,794,1014,1285,840,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"websiteBlocksSynced",{enumerable:!0,get:function(){return m}}),_e.BlockSettings=function({rid:e}){const n=(0,s.useFloor)(n=>n.settings[e]),h={...s.DEFAULT_SETTINGS,...n??{}},b=h.serviceWindows??{},w=b.lunch??['12:00','17:00'],f=b.dinner??['17:00','21:00'],k=(n,t)=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:{...b,[n]:t}}),y=(e,n,t,s)=>(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{style:{flex:1},children:e}),(0,u.jsx)(o.Stepper,{testID:s,label:e,value:(0,l.toMins)(n),min:360,max:1425,step:15,format:e=>(0,c.fmt12)((0,l.fromMins)(e)),onChange:t})]});return(0,u.jsxs)(t.default,{style:{gap:8},testID:"adv-blocks-panel",children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Lunch and dinner"}),(0,u.jsx)(o.Muted,{children:"Used by Block now (the Lunch and Dinner buttons) and Spend per head. Always kept inside the kitchen hours for the day."}),b.lunch||b.dinner?null:(0,u.jsx)(o.Muted,{testID:"sw-usual",children:"Usual times now: lunch from opening to 5:00pm, dinner from 5:00pm to close. Change a time below to set your own."}),y('Lunch starts',w[0],e=>k('lunch',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(w[1])-15)),w[1]]),'sw-lunch-from'),y('Lunch ends',w[1],e=>k('lunch',[w[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(w[0])+15))]),'sw-lunch-to'),y('Dinner starts',f[0],e=>k('dinner',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(f[1])-15)),f[1]]),'sw-dinner-from'),y('Dinner ends',f[1],e=>k('dinner',[f[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(f[0])+15))]),'sw-dinner-to'),b.lunch||b.dinner?(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Use the usual times",onPress:()=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:void 0})}):null,(0,u.jsx)(o.T,{weight:"semibold",style:{marginTop:8},children:"Block on website bookings too"}),m(e)?(0,u.jsx)(o.Muted,{testID:"wix-block-sync-on",children:"On. A whole-day or time block made in CoverCharge also closes those times for online booking on your website, editing or removing it updates the website, and blocks made on the website show here too. Website bookings can only close the whole venue, not one area or some tables."}):(0,u.jsx)(o.Muted,{testID:"wix-block-sync-off",children:"Website bookings aren\u2019t connected for this venue yet. Once they are, a whole-day or time block made in CoverCharge also closes those times for online booking on your website. Until then, the website can still take bookings in a blocked time, so check those."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);const m=e=>!h.IS_ISOLATED_VENUE&&'anchorage'===e},1361,[34,102,794,1014,827,1318,5,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"advancedPrefill",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"takeAdvancedPrefill",{enumerable:!0,get:function(){return n}});const t={q:''},n=()=>{const n=t.q;return t.q='',n}},1362,[]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,u.staffServer)(),[s,h]=(0,t.useState)(null),[x,y]=(0,t.useState)([]),[p,j]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),v=(0,t.useCallback)(async()=>{try{const[e,t]=await Promise.all([(0,u.readSettings)(),(0,u.readOffers)()]);h(e),y(t)}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,u.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,c.jsx)(l.Banner,{kind:"info",title:"Not connected",children:"Loyalty settings are saved on the server. Not set up yet: sign in to the venue on this device to change them."});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const O=e=>{h({...s,...e}),j(null)},S=(0,o.checkSettings)(s),C=async()=>{if(!S){b(!0);try{await(0,u.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}b(!1)}},T=e=>e?`${e} days`:'Never';return(0,c.jsxs)(n.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Stamp card"}),(0,c.jsx)(l.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps for a reward"}),(0,c.jsx)(l.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,c.jsx)(l.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps run out after"}),(0,c.jsx)(l.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Rewards run out after"}),(0,c.jsx)(l.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Minutes between stamps (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most stamps a day (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,c.jsx)(l.T,{weight:"semibold",children:"Bring a friend"}),(0,c.jsx)(l.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,c.jsx)(l.Field,{label:"Reward for the guest who brings a friend",value:s.referralGiver,onChangeText:e=>O({referralGiver:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsx)(l.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most friend rewards a month (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:S}):null,p?(0,c.jsx)(l.Banner,{kind:p.kind,title:p.text}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{C()}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>h({...o.DEFAULT_LOYALTY})})]}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: a friend reward is given when the friend gets their first stamp, and a guest can\u2019t use their own code. Stamps only come from staff, or from a code or QR staff make."}),(0,c.jsx)(l.T,{weight:"semibold",children:"Offers"}),x.length?x.map(e=>(0,c.jsx)(f,{o:e,onSaved:v},e.id)):(0,c.jsx)(l.Muted,{children:"No offers yet."}),(0,c.jsx)(f,{onSaved:v}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: guests see an offer only while it\u2019s on and between its dates. Leave the dates blank to run it until you turn it off."})]})},_e.LoyaltySummaryCard=function({kind:e="card"}){const[s,a]=(0,t.useState)(null),[h,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,u.loyaltySummary)().then(a,e=>f((0,o.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,u.staffServer)())return x(),(0,u.watchLoyalty)(x)},[x]),!(0,u.staffServer)())return null;if(h)return(0,c.jsx)(l.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:h});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const y='card'===e?[['Guests with a card',s.members],['Joined this month',s.joinedMonth],['Stamps this week',s.stampsWeek],['Stamps this month',s.stampsMonth],['Rewards ready to use',s.rewardsReady],['Rewards used this month',s.rewardsUsedMonth],['Offers live now',s.offersLive]]:[['Friends waiting for their first stamp',s.referralsWaiting],['Friend rewards given',s.referralsRewarded]];return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,c.jsx)(l.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{children:e}),(0,c.jsx)(l.T,{weight:"semibold",children:t})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: these are your real numbers from the server. Change the card in Settings \u203a Advanced \u203a Loyalty."})]})})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=r(d[2]),l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]);const h=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function f({o:e,onSaved:s}){const[f,x]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[y,p]=(0,t.useState)(!!e),[j,w]=(0,t.useState)(null);if(!e&&!y)return(0,c.jsx)(l.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>p(!0)});const b=(!f.startsOn||h.test(f.startsOn))&&(!f.endsOn||h.test(f.endsOn))?(0,o.checkOffer)({title:f.title,details:f.details,startsOn:f.startsOn||null,endsOn:f.endsOn||null}):'Dates look like 2026-12-01.',v=async()=>{if(!b)try{await(0,u.saveOffer)({id:e?.id,title:f.title.trim(),details:f.details.trim(),startsOn:f.startsOn||null,endsOn:f.endsOn||null,isOn:f.isOn}),w('Saved.'),e||(x({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),p(!1)),s()}catch(e){w((0,o.plainError)(e))}};return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[e?(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{weight:"semibold",children:e.title}),(0,c.jsx)(l.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,c.jsx)(l.T,{weight:"semibold",children:"New offer"}),(0,c.jsx)(l.Field,{label:"Title",value:f.title,onChangeText:e=>x({...f,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,c.jsx)(l.Field,{label:"Details",value:f.details,onChangeText:e=>x({...f,details:e.slice(0,500)}),multiline:!0}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Field,{label:"Starts (optional)",value:f.startsOn,onChangeText:e=>x({...f,startsOn:e.trim()}),placeholder:"2026-12-01"}),(0,c.jsx)(l.Field,{label:"Ends (optional)",value:f.endsOn,onChangeText:e=>x({...f,endsOn:e.trim()}),placeholder:"2026-12-24"})]}),(0,c.jsx)(l.Toggle,{label:"Offer on",value:f.isOn,onChange:e=>x({...f,isOn:e})}),b&&(f.title||e)?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:b}):null,j?(0,c.jsx)(l.Muted,{size:13,children:j}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{small:!0,label:"Save offer",disabled:!!b,onPress:()=>{v()}}),e?null:(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>p(!1)})]})]})})}},1363,[34,102,840,794,1202,1205,25]); -__d(function(_g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.tidyWholePlan=u,_e.restoreTidy=h,_e.GridSettings=function({rid:e,me:s}){const p=(0,r.useFloor)(t=>t.settings[e]),c={...r.DEFAULT_SETTINGS,...p??{}},y=t=>r.useFloor.getState().setSettings(e,{...c,...t}),[b,S]=(0,t.useState)(''),f=(0,o.gridOf)(c.gridSize),v=c.tidyBackup,T=v?new Date(v.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'';return(0,g.jsxs)(n.default,{style:{gap:8},children:[(0,g.jsx)(a.Toggle,{testID:"adv-grid-snap",label:"Snap tables to the grid when dragging",value:!1!==c.gridSnap,onChange:e=>y({gridSnap:e}),a11y:"Snap tables to the grid when dragging"}),(0,g.jsx)(a.Muted,{size:13,children:!1!==c.gridSnap?'On: tables jump to the nearest grid line and line up with other tables (gold guides show when edges or centres match). Hold Alt (Option on a Mac) while dragging to move freely.':'Off: tables go exactly where you let go. Gold guides still help you line them up.'}),(0,g.jsx)(a.T,{children:"Grid size"}),(0,g.jsx)(a.Row,{wrap:!0,gap:8,children:o.GRID_SIZES.map(e=>(0,g.jsx)(a.Chip,{testID:`adv-grid-${e}`,label:10===e?'Fine (10)':25===e?'Normal (25)':'Coarse (50)',selected:f===e,onPress:()=>y({gridSize:e})},e))}),(0,g.jsx)(a.Button,{testID:"adv-grid-tidy",label:"Tidy up the whole plan",onPress:()=>{const t=u(e,s,(new Date).toISOString());S(t.moved?`Tidied: ${t.moved} tables lined up on the grid. The old positions are kept below.`:'Already tidy. Nothing moved.')}}),(0,g.jsx)(a.Muted,{size:13,children:"Tidy up snaps every table to the grid and evens out the rows, area by area. Only positions change: table numbers, areas, Covers, sizes and best tables stay as they are."}),v?(0,g.jsxs)(n.default,{testID:"adv-grid-backup",style:{borderWidth:1,borderColor:l.colours.gold,borderRadius:10,padding:10,gap:6},children:[(0,g.jsxs)(a.T,{size:14,children:["Positions from before the tidy on ",T,v.by?` (${v.by})`:''," are kept."]}),(0,g.jsx)(a.Button,{testID:"adv-grid-restore",kind:"secondary",label:"Put the tables back where they were",onPress:()=>{h(e)&&S('Done: every table is back where it was before the tidy.')}})]}):null,b?(0,g.jsx)(a.Banner,{kind:"success",title:b}):null,(0,g.jsx)(a.Muted,{size:13,children:"Tip: in the table plan editor, Tidy up does one area at a time and you can undo it with \u2318Z (Ctrl+Z)."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),g=_r(d[6]);function u(e,t,s){const n=r.useFloor.getState(),a=n.plans[e]??(0,r.planOf)(e),l={...r.DEFAULT_SETTINGS,...n.settings[e]??{}};let g=a;for(const e of a.areas)g=(0,o.tidyArea)(g,e.id,(0,o.gridOf)(l.gridSize));const u=(0,o.movedCount)(a,g);return u?(n.setSettings(e,{...l,tidyBackup:(0,o.backupOf)(a,s,t,'Before Tidy up')}),n.setPlan(e,g),{moved:u}):{moved:u}}function h(e){const t=r.useFloor.getState(),s={...r.DEFAULT_SETTINGS,...t.settings[e]??{}},n=s.tidyBackup;return!!n&&(t.setPlan(e,(0,o.restoreFrom)(t.plans[e]??(0,r.planOf)(e),n)),t.setSettings(e,{...s,tidyBackup:void 0}),!0)}},1364,[34,102,794,1014,1294,840,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1365,[798,34,283,364,236,102,426,900,794,796,840,1324,25]); -__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1366,[925,800,798,806,852,1061,1367,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1166,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1367,[499,1368]); -__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 t}});var t={}},1368,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProgressBar=B,_e.useSetupDone=O,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,C.useCtx)(6e4),n=O(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=f.SETUP_STEPS.findIndex(e=>e.id===a),s=f.SETUP_STEPS[e+1]?.id??null;return(0,E.jsx)(D,{id:a,wizard:!0,onBack:()=>l(e>0?f.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=f.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,E.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{gap:12,children:[(0,E.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsxs)(x.T,{size:20,weight:"bold",colour:S.colours.gold,children:["Set up ",t.name]}),(0,E.jsx)(x.Muted,{children:n.loading?'Checking what is already set up\u2026':i?'Everything is set up. Open any step to check or change it.':'Nine short steps. Do them in order or jump to any one; you can come back to each from Settings.'})]})]}),(0,E.jsx)(B,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,E.jsx)(x.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,E.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:S.colours.border,backgroundColor:S.colours.surface,overflow:'hidden'},children:f.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,E.jsxs)(h.default,{testID:`setup-step-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Step ${s+1}: ${e.title}${t?', done':o.length?`, still needed: ${o.join(', ')}`:''}`,onPress:()=>l(e.id),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',gap:12,padding:12,minHeight:60,borderTopWidth:s?1:0,borderColor:S.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,E.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?S.colours.gold:'transparent',borderWidth:1.5,borderColor:t?S.colours.gold:S.colours.border},children:(0,E.jsx)(x.T,{weight:"bold",colour:t?S.colours.onGold:S.colours.muted,children:t?'\u2713':s+1})}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"medium",children:e.title}),(0,E.jsx)(x.Muted,{children:e.sub}),o.length?(0,E.jsxs)(x.T,{size:13,colour:S.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,E.jsx)(x.Badge,{kind:"ok",label:"Done"}):null,(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=D,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return _}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,C.useCtx)(6e4),t=O(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,E.jsxs)(x.Card,{onPress:()=>e('more','setup'),highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:"Finish setting up"}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]}),(0,E.jsx)(B,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,E.jsxs)(x.Muted,{size:13,children:["Next: ",f.SETUP_STEPS.find(e=>!t.isDone(e.id))?.title]})]})};var s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),o=_r(_d[3]),a=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(_r(_d[4])),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=e(_r(_d[11])),g=e(_r(_d[12])),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),j=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),k=_r(_d[20]),w=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),T=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),E=_r(_d[27]);const M=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],R=[1,2,3,4,5,6,0],z=/^([01]\d|2[0-3]):[0-5]\d$/,$=e=>{const s=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(s)&&s>0?Math.round(100*s):null},I=e=>f.SETUP_STEPS.findIndex(s=>s.id===e)+1;function B({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,E.jsxs)(g.default,{testID:t,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:s,now:e},accessibilityLabel:`${e} of ${s} steps done`,style:{gap:4},children:[(0,E.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:S.colours.gold,borderRadius:5}})}),(0,E.jsxs)(x.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function O(e){const s=(0,f.useSiteSetup)(e),t=(0,p.useBrand)(e),{status:n,live:o}=(0,r.useSetupStatus)(),a=(0,c.useMemo)(()=>n?(0,l.evalSetup)(n,{logo:!!t.logo,email:s.email,bookingUrl:s.bookingUrl}):null,[n,t.logo,s.email,s.bookingUrl]),d=(0,i.useSetupMarksLoaded)(),u=e=>a?(0,i.applyMark)(!!a[e]?.done,d[e]):!!s.done[e],h=f.SETUP_STEPS.filter(e=>u(e.id)).length;return{isDone:u,markOf:e=>d[e],missing:e=>a?a[e]?.missing??[]:[],prog:{done:h,total:f.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function D({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,C.useCtx)(6e4),l=O(a),r=l.prog,d=(0,i.useLiveVenue)(),u=f.SETUP_STEPS.find(s=>s.id===e),[p,b]=(0,c.useState)(null),m=U[e];return(0,E.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsxs)(x.T,{size:12,weight:"semibold",colour:S.colours.gold,children:["STEP ",I(e)," OF ",f.SETUP_STEPS.length]}),s&&o?(0,E.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,E.jsx)(x.T,{size:13,colour:S.colours.muted,children:"All steps"})}):null]}),(0,E.jsx)(x.T,{size:22,weight:"bold",children:u.title}),(0,E.jsx)(B,{done:r.done,total:r.total})]}),(0,E.jsx)(m,{rid:a,done:(t="Saved.")=>{f.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():b(t)},wizard:!!s}),p?(0,E.jsx)(x.Banner,{kind:"success",title:p}):null,(0,E.jsx)(W,{rid:a,id:e,title:u.title,onDone:b}),s?(0,E.jsxs)(x.Row,{gap:10,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,E.jsx)(x.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const L=({wizard:e,onPress:s,disabled:t,label:n})=>(0,E.jsx)(x.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const A=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function F({rid:e,done:n,wizard:o,payList:a=!1}){const l=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,j.useOwner)(e=>e.hourly),i=(0,C.useHourly)(),d=(0,f.useSiteSetup)(e),u=(0,f.useSetup)(e=>e.looks),[p,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),v=e=>{const s=d.grades.find(s=>s.id===d.staffGrade[e.id]);return e.salaried&&null==r[e.id]?'Salaried, no hourly wage':s&&!a?`${s.name} grade`:null==r[e.id]?'Pay not set':null!=i[e.id]?`${(0,w.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];m({id:e.id,name:e.name,job:e.job,access:(0,f.accessOf)(e.level,e.role),pay:e.salaried&&null==r[e.id]?'salaried':s?'grade':'own',gradeId:s??d.grades[0]?.id??'',wage:null!=i[e.id]?(i[e.id]/100).toFixed(2):'',noTax:!!e.noTax,look:u[e.id]??null}),T(null)},M=!!p?.id&&(R=p.id,k.ROSTER.some(e=>e.id===R));var R;const z=p?$(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=z||M&&!p.wage);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Muted,{children:[l.length," people. Tap someone to change their pay, tax or avatar. People from your roster keep their name, access and personal link."]}),(0,E.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,E.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>P(e),style:({pressed:s})=>({flexDirection:'row',alignItems:'center',gap:10,padding:10,borderRadius:14,borderWidth:1,borderColor:p?.id===e.id?S.colours.gold:S.colours.border,backgroundColor:s?'#1d1a14':S.colours.surface}),children:[(0,E.jsx)(b.StaffAvatar,{id:e.id,size:42}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"semibold",children:e.name}),(0,E.jsxs)(x.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,f.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,E.jsx)(x.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,f.accessOf)(e.level,e.role)})]},e.id))}),y?(0,E.jsx)(x.Banner,{kind:"success",title:y}):null,p?(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsx)(x.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:S.colours.gold},children:(0,E.jsx)(b.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsx)(x.Muted,{children:"Choose an original icon or keep a crew look. A personal avatar takes priority. They can change their own in My avatar."}),(0,E.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>m({...p,look:e.look})}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>m({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>m({...p,look:null})}):null]})]})]}),M?(0,E.jsxs)(x.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,E.jsx)(x.Field,{label:"Name",value:p.name,onChangeText:e=>m({...p,name:e}),placeholder:"First and last name"}),(0,E.jsx)(x.Field,{label:"Job title",value:p.job,onChangeText:e=>m({...p,job:e}),placeholder:"e.g. Kitchen porter"}),M?null:(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Access level"}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,selected:p.access===e,onPress:()=>m({...p,access:e})},e))}),(0,E.jsxs)(x.Muted,{size:13,children:["Uses the ",f.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Pay"}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[a?null:(0,E.jsx)(x.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>m({...p,pay:'grade'})}),(0,E.jsx)(x.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>m({...p,pay:'own'})}),(0,E.jsx)(x.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>m({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,E.jsx)(x.Chip,{label:`${e.name} \xb7 ${(0,w.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>m({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,E.jsx)(x.Field,{label:"\xa3 per hour",value:p.wage,onChangeText:e=>m({...p,wage:e}),keyboardType:"decimal-pad",placeholder:M?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=z&&z<1271?(0,E.jsx)(x.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,E.jsx)(x.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>m({...p,noTax:e})}),(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>m(null),style:{flex:1}}),(0,E.jsx)(x.Button,{label:p.id?'Save':'Add to team',testID:"staff-save",disabled:!I,onPress:()=>{if(!p||!I)return;const s=j.useOwner.getState();let t=p.id;if(!t){const e=new Set(s.staff.map(e=>e.id));if(s.addStaff(p.name.trim(),f.ACCESS_ROLE[p.access],p.job.trim()||'Team member'),t=j.useOwner.getState().staff.find(s=>!e.has(s.id))?.id,!t)return}const n={job:p.job.trim()||'Team member',salaried:'salaried'===p.pay,noTax:p.noTax};M||Object.assign(n,{name:p.name.trim(),level:p.access,role:f.ACCESS_ROLE[p.access],dept:'Head Chef'===p.access?'Kitchen':void 0}),s.updateStaff(t,n);const o={...d.staffGrade};if('grade'===p.pay){const e=d.grades.find(e=>e.id===p.gradeId);e&&(a&&d.staffGrade[t]===p.gradeId||s.setRate(t,e.pence),o[t]=e.id)}else delete o[t],'own'===p.pay&&null!=z&&s.setRate(t,z);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),f.useSetup.getState().patch(e,{staffGrade:o}),f.useSetup.getState().setLook(t,p.look),T(`${p.name.trim()} ${p.id?'updated':'added'}.`),m(null)},style:{flex:1}})]}),p.id?null:(0,E.jsx)(x.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,E.jsx)(x.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{m(A(d.grades[0]?.id??'')),T(null)}}),(0,E.jsx)(L,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const U={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,f.useSiteSetup)(e),[i,d]=(0,c.useState)({name:o.name,address:o.address??o.location,phone:o.phone??'',email:r.email,tagline:o.tagline}),[u,h]=(0,c.useState)('');return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,E.jsx)(x.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,E.jsx)(x.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,E.jsx)(x.Field,{label:"Email",accessibilityLabel:"Venue email address",keyboardType:"email-address",inputMode:"email",autoCapitalize:"none",autoCorrect:!1,value:i.email,onChangeText:e=>d({...i,email:e})}),(0,E.jsx)(x.Field,{multiline:!0,numberOfLines:3,label:"Tagline",value:i.tagline,onChangeText:e=>d({...i,tagline:e}),placeholder:"e.g. Seafood and real ale by the harbour"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Logo"}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsxs)(x.Muted,{children:[l.custom?'Your uploaded logo.':'anchorage'===e?'The Anchorage logo in black and gold.':'greenside'===e?'The Greenside Restaurant logo.':'abbotsford'===e?'The Abbotsford Hotel logo.':'kirkton'===e?'The Kirkton Inn logo.':'wildings'===e?'The Wildings Hotel & Restaurant logo.':'kirkmichael'===e?'The Kirkmichael Arms logo.':'souters'===e?'The Souter\u2019s Inn logo.':'Placeholder initials.'," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,E.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,label:"Upload a logo",onPress:async()=>{const s=await a.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(s.canceled||!s.assets?.[0])return;const t=s.assets[0];j.useOwner.getState().setBranding(e,{logoUri:t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri})}}),l.custom?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,E.jsx)(P.OrderAtTableCard,{rid:e,compact:!0}),u?(0,E.jsx)(x.Banner,{kind:"warn",title:u}):null,(0,E.jsx)(L,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(m.useStore.getState().updateRestaurant(o.id,{name:i.name.trim(),address:i.address.trim(),phone:i.phone.trim(),contactEmail:i.email.trim(),tagline:i.tagline.trim()}),h(''),s('Venue details saved.')):h('Check the email address.')}})]})},hours:function({done:e,wizard:s}){const{r:t}=(0,C.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=R.filter(e=>{const s=n[e];return s&&(!z.test(s[0])||!z.test(s[1]))});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),M.map((e,s)=>{const t=R[s],l=n[t];return(0,E.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:S.colours.border,paddingTop:s?6:0},children:[(0,E.jsx)(x.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,E.jsxs)(x.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"to"}),(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,E.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,E.jsx)(x.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries(R.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,E.jsx)(x.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,E.jsx)(L,{wizard:s,disabled:!!l.length,onPress:()=>{m.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,y.usePlan)(e),o=(0,y.planCounts)(n);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v.TablePlan,{startStep:"areas"}),(0,E.jsx)(L,{wizard:t,disabled:!o.tables,label:t?`Looks right (${o.tables} tables, ${o.seats} seats), continue`:'Mark as done',onPress:()=>s('Table plan step marked as done.')})]})},paygrades:function(e){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{center:!0,children:"Your team's hourly rates. Tap a person to edit. Existing grades are retained in the background; opening this list never changes pay."}),(0,E.jsx)(F,{...e,payList:!0})]})},staff:F,permissions:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)('Manager'),l=e=>f.PERMS.filter(s=>n.perms[e]?.[s.id]).length;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Tick what each access level can do. We\u2019ve started you with sensible defaults; change any of them."}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,sub:`${l(e)} of ${f.PERMS.length}`,selected:o===e,onPress:()=>a(e)},e))}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:o}),'Owner'===o?(0,E.jsx)(x.Muted,{children:"The owner can always do everything."}):null,f.PERMS.map((s,t)=>{const a=!!n.perms[o]?.[s.id],l='Owner'===o;return(0,E.jsxs)(h.default,{testID:`perm-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:a,disabled:l},accessibilityLabel:`${o}: ${s.label}`,disabled:l,onPress:()=>f.useSetup.getState().setPerm(e,o,s.id,!a),style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:50,borderTopWidth:t?1:0,borderTopColor:S.colours.border,opacity:l?.75:1},children:[(0,E.jsx)(g.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:a?S.colours.gold:S.colours.muted,backgroundColor:a?S.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:a?(0,E.jsx)(x.T,{weight:"bold",colour:S.colours.onGold,children:"\u2713"}):null}),(0,E.jsx)(x.T,{style:{flex:1},children:s.label})]},s.id)})]}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Back to the suggested defaults",onPress:()=>f.useSetup.getState().resetPerms(e)}),(0,E.jsx)(x.Banner,{kind:"info",title:"Saved on this device",children:"For now the apps still follow the built-in Owner, Manager and Staff rules. These ticks will control access once staff accounts go live."}),(0,E.jsx)(L,{wizard:t,onPress:()=>s('Permissions saved.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Work email address",value:o,onChangeText:a,placeholder:"e.g. hello@yourvenue.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),l?null:(0,E.jsx)(x.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,E.jsx)(x.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Link your inbox"}),(0,E.jsx)(x.Badge,{kind:"amber",label:"Coming soon"})]}),(0,E.jsx)(x.Muted,{children:"Later you\u2019ll be able to link your inbox so booking emails appear in CoverCharge. Nothing is linked yet: CoverCharge doesn\u2019t read or send email from here."}),(0,E.jsx)(x.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,E.jsx)(L,{wizard:t,disabled:!l,onPress:()=>{m.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),a=(0,f.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,T.appUrl)('/customer-app/index.html'),[]),[d,u]=(0,c.useState)(!1),h=l.trim()&&!/^https?:\/\//i.test(l.trim())?`https://${l.trim()}`:l.trim(),p=!h||/^https?:\/\/[^\s.]+\.[^\s]+$/i.test(h);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,E.jsx)(x.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Your booking link"}),(0,E.jsx)(x.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:S.colours.border,padding:10},children:(0,E.jsx)(x.T,{size:14,colour:S.colours.goldLight,children:i})}),(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,T.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,E.jsx)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,E.jsx)(x.Badge,{kind:"gold",label:"Coming soon"})}),(0,E.jsx)(x.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,E.jsx)(L,{wizard:t,disabled:!p,onPress:()=>{m.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),f.useSetup.getState().patch(e,{website:h,bookingUrl:i}),s('Website saved.')}})]})},invites:function({rid:e,done:s,wizard:t}){const n=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),{role:o}=(0,C.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Every person has an Android app download and an iPhone app link. Both sign in automatically. Share privately; nothing is sent from here."}),n.map(e=>(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,E.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,E.jsx)(L,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},_=e=>function(){return(0,E.jsx)(D,{id:e})};function W({rid:e,id:s,title:t,onDone:n}){const o=O(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,E.jsxs)(g.default,{style:{gap:4},children:[(0,E.jsx)(x.Button,{kind:"secondary",label:r?'Saving\u2026':'Mark as not done',disabled:r,testID:`setup-notdone-${s}`,accessibilityLabel:`${t}, mark as not done`,style:{minHeight:44},onPress:async()=>{d(!0),f.useSetup.getState().markDone(e,s,!1);const o=!a||await i.useSetupMarks.getState().set(a,s,!1);d(!1),n(o?`${t} marked as not done.`:'Could not save. Check the connection and try again.')}}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: use this if a step needs another look. It goes back on your to-do list until you mark it done again."})]}):l&&!1===l.done&&l.by?(0,E.jsxs)(x.Muted,{size:13,testID:`setup-notdone-by-${s}`,children:["Marked as not done by ",l.by,l.at?` on ${new Date(l.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})}`:'',"."]}):null}},1369,[927,926,798,796,1061,1370,1371,1372,1373,1375,34,402,102,847,899,794,848,865,1014,925,15,836,840,1100,1376,1379,1383,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1370,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1371,[34,985]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1372,[34,815,985]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1373,[2,796,34,236,383,102,794,1374,985,840,1151,997,865,988,25]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1374,[]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1375,[34,402,794,985,840,1373,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1376,[796,1120,985,900,1174,1176,34,281,379,236,402,102,426,853,794,848,1185,865,836,827,840,1147,1100,838,1366,1135,1377,1378,1119,1126,1125,1024,13,1123,1365,1166,25]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1377,[796,34,1172,1041,839,379,402,102,794,865,836,827,840,1147,1100,1166,25]); -__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1378,[1042,34,402,102,794,865,840,1100,985,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1379,[796,34,1033,395,102,1107,1108,1292,1315,794,1011,1014,827,840,1100,1015,1380,1381,1035,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1380,[796,34,402,102,794,840,1014,5,1015,846,985,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1381,[34,102,794,1014,1382,828,840,1060,931,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1382,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderAtTableCard=c,_e.OrderAtTableSettings=function(){const e=(0,h.useOwner)(e=>e.site);return(0,u.jsxs)(n.default,{style:{gap:10},children:[(0,u.jsx)(c,{rid:e}),(0,u.jsx)(o.Banner,{kind:"info",title:"Takeaway is separate",children:"Takeaway ordering, slots and the live takeaway queue work the same whichever way this is set. Each venue sets this for itself."})]})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var r,s=_r(d[3]),n=(r=s)&&r.__esModule?r:{default:r},o=_r(d[4]),l=_r(d[5]),h=_r(d[6]),u=_r(d[7]);function c({rid:r,compact:s}){const h=(0,l.useOrderAtTable)(r),c=(0,l.useStore)(e=>e.restaurants.find(e=>e.id===r)?.name??'this venue');return e.IS_GREENSIDE?(0,u.jsx)(t.GreensideCashOnly,{}):(0,u.jsx)(n.default,{testID:"order-at-table-card",children:(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Order at table"}),(0,u.jsx)(o.Muted,{children:"Guests scan a QR code on the table and order from their phone, then pay at the bar or till. Tables, hours and QR codes: Settings \u203a Advanced \u203a Order at the table."})]}),(0,u.jsx)(o.Toggle,{label:"Order at table",value:h,onChange:e=>l.useStore.getState().updateSettings(r,{orderAtTable:e})})]}),(0,u.jsx)(o.T,{size:13,colour:h?'#E2C489':'#D8CFBF',children:h?`On for ${c}: table QR codes, table orders and table tickets are shown.`:`Off for ${c}: in-house orders go through your till. Takeaway ordering stays on.`}),s?null:(0,u.jsx)(o.Muted,{children:"When it is off: no Order at table or table QR screen in the customer app, no Tables & QR codes page or Table option in Take an order here, no table orders in Live orders, and no table tickets in the Head Chef app."})]})})}},1383,[5,1341,34,102,794,848,865,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=M,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=M(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',O[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:O[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withWildingsQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function M(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const O={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from Bidfood or Booker? Add them here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1384,[801,1153,34,281,283,364,395,236,295,102,36,794,847,850,865,1014,1051,1052,5,828,1049,1059,840,846,1100,1385,1388,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=k,_e.importQuestionnaireAccounts=T,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Listing them lets the Assistant help with them later. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:i}=(0,x.useCtx)(6e4),j='owner'===n,B=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],A=(0,p.useQuestionnaire)(e),{mark:M}=(0,p.useProvenance)(e),[P,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(A?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!B.some(n=>n.provider===e.provider)),[A,B]),W=(A?.accounts??[]).some((e,n)=>M('accounts',n,'provider'));return(0,y.jsxs)(l.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:i})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>A&&T(e,A,i)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${B.length}`})]}),B.length?B.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(A?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(l.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:I[e.status].kind,label:I[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(k,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=B.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:P,owner:j,by:i,onClose:()=>z(null)}),$?(0,y.jsx)(C,{rid:e,c:$,by:i,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),i=e(r(d[4])),l=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(l.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function k({rid:e,compact:n}){const{role:o,me:i}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,k]=(0,t.useState)({}),[T,B]=(0,t.useState)(null),I=u.useAccounts.getState();return(0,y.jsxs)(l.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(l.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(l.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(l.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(l.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>k({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(l.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>I.update(e,o.id,{accountNo:u},i,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>B(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>I.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:i})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),T?(0,y.jsx)(C,{rid:e,c:T,by:i,onClose:()=>B(null)}):null]})}function C({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(l.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["The Assistant will stop using ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function T(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const i of n.accounts??[])o.some(e=>e.provider===i.provider)||s.add(e,{provider:i.provider,handle:i.handle,status:'listed',from:'questionnaire',addedBy:t})}function B({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,k]=(0,t.useState)(p?.handle??''),[C,T]=(0,t.useState)(p?.customName??''),[B,I]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const A=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${A?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(i.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:A?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),A?(0,y.jsx)(a.Field,{label:"Service name",value:C,onChangeText:T,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>I(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),B?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below so the Assistant knows you use it, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:k,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:A?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:A&&C.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:A?C.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:A&&!C.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(l.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const I={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(B,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1385,[796,34,379,402,295,102,794,1386,1387,840,1384,1100,865,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1386,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.looksSecret=l,Object.defineProperty(_e,"useAccounts",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),s=r(d[2]);const c=/^\s*(password|passwd|pwd|passcode|pin|otp|secret|token|api[ _-]?key)\s*[:=]/i,u=/\b(sk|pk|rk)_(live|test)_|\bghp_|\bxox[abp]-|\bAKIA[0-9A-Z]{12}|\beyJ[A-Za-z0-9_-]{10,}\./;function l(e){return!(!c.test(e)&&!u.test(e))||e.split(/\s+/).some(e=>e.length>=24&&/[A-Za-z]/.test(e)&&/\d/.test(e)&&!/^[\w.+-]+@[\w-]+\.[\w.]+$/.test(e)&&!/^(https?:\/\/|www\.)/i.test(e))}const b=e=>e&&!l(e)&&e.trim().slice(0,120)||void 0,p=e=>{const t=e?.trim();return t&&/^[A-Za-z0-9 -]{1,20}$/.test(t)?t:void 0},y=(0,n.create)()((0,s.persist)(e=>({byVenue:{},log:{},add:(t,o)=>e(e=>{const n={...o,handle:b(o.handle),customName:b(o.customName),accountNo:p(o.accountNo),id:`c-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,addedAt:(new Date).toISOString()};return{byVenue:{...e.byVenue,[t]:[...e.byVenue[t]??[],n]},log:{...e.log,[t]:[{at:n.addedAt,by:o.addedBy,what:`Added ${o.customName??o.provider}`},...e.log[t]??[]].slice(0,200)}}}),update:(t,o,n,s,c)=>e(e=>({byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).map(e=>e.id===o?{...e,...n,handle:void 0!==n.handle?b(n.handle):e.handle,accountNo:void 0!==n.accountNo?p(n.accountNo):e.accountNo}:e)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:s,what:c},...e.log[t]??[]].slice(0,200)}})),remove:(t,o,n)=>e(e=>{const s=(e.byVenue[t]??[]).find(e=>e.id===o);return{byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).filter(e=>e.id!==o)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:n,what:`Removed ${s?.customName??s?.provider??'an account'}`},...e.log[t]??[]].slice(0,200)}}})}),{name:'covercharge-accounts-v1',version:1,storage:(0,s.createJSONStorage)(()=>o.default)}))},1387,[808,815,818]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1388,[34,402,102,794,850,1387,1014,828,1389,1059,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1389,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1390,[798,34,283,364,236,402,102,815,794,840,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const v=(0,m.useInStaffApp)(),{now:L,meId:N,me:A,r:z,today:H}=(0,m.useCtx)(3e4),O=(0,s.useTravelDay)('staff',H),P=(0,c.useOwner)(e=>e.shifts),R=(0,c.useOwner)(e=>e.attendance),F=(0,c.useOwner)(e=>e.staffCanViewSuppliers),_=(0,c.useOwner)(e=>e.quickLinks),E=(0,c.useOwner)(e=>e.chat),W=(0,c.useOwner)(e=>e.swaps),V=(0,c.useOwner)(e=>e.leave),q=P.filter(e=>e.staffId===N&&e.published&&e.date>=H).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),G=q.find(e=>e.date===H),U=R.filter(e=>e.staffId===N&&e.in&&!e.out&&L.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Y=(0,x.usePay)(N,0),Q=(0,b.useOrders)(z.id),K=(0,b.useBookings)(z.id),J=Q.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,K))),X=K.filter(e=>e.date===H&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,Q.filter(T.LIVE))),Z=K.filter(e=>(0,S.undoKind)(e,H)||e.walkIn&&'cancelled'===e.status&&e.date===H).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),ee=E.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],se=W.filter(e=>e.fromId===N&&'open'===e.status).length+V.filter(e=>e.staffId===N&&'pending'===e.status).length,te=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & leave',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...F?[['Suppliers',()=>e('more','suppliers')]]:[]];return!v&&O?(0,$.jsxs)(o.default,{style:{gap:10},children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(s.DayView,{rid:z.id,day:O,today:H,app:"staff"})]}):(0,$.jsxs)(o.default,{style:{gap:10},children:[v?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(t.CoversToday,{rid:z.id})]}),(0,$.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,$.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,$.jsx)(C.StaffAvatar,{id:N,size:52})}),(0,$.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",A.replace(' (example)','').split(' ')[0]]})]}),(0,$.jsx)(r.Badge,{kind:"gold",label:v?z.name:'Staff app preview'})]}),(0,$.jsx)(r.Muted,{children:v?`${L.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,$.jsx)(M.StaffTipsTile,{rid:z.id,today:H,onPress:()=>e('more','mytips')}),(0,$.jsxs)(r.Card,{highlight:U?u.colours.ok:void 0,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{weight:"semibold",children:U?`On shift since ${(0,h.hm)(new Date(U.in))}`:'Not clocked in'}),U?(0,$.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((L.getTime()-new Date(U.in).getTime())/6e4)))}):null]}),G?(0,$.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(G.start),"\u2013",(0,m.fmtH)(G.end)]}):q[0]?(0,$.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[q[0].day]," ",Number(q[0].date.slice(8))," ",(0,m.fmtH)(q[0].start),"\u2013",(0,m.fmtH)(q[0].end)]}):(0,$.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,$.jsx)(r.Button,{small:!0,kind:U?'secondary':'success',label:U?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),(0,$.jsx)(p.ShellfishTile,{rid:z.id,by:A.replace(' (example)',''),app:"staff"}),Z.length?(0,$.jsx)(r.Card,{children:(0,$.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",Z.length,")"]}),(0,$.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),Z.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,$.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,$.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,$.jsxs)(r.Muted,{children:[e.table?(0,D.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,$.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(z.id,e)}):null,e.walkIn?(0,$.jsx)(a.CancelWalkInButton,{rid:z.id,b:e,small:!0}):null,e.walkIn?(0,$.jsx)(a.ReinstateWalkInButton,{rid:z.id,b:e,today:H,small:!0}):null,(0,$.jsx)(S.BookingUndo,{b:e,rid:z.id,today:H,who:s})]})]},e.id)})]})}):null,J.length+X.length?(0,$.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",J.length+X.length,")"]}),(0,$.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),J.map(e=>(0,$.jsx)(j.AllergyChain,{o:e,me:A},e.id)),X.map(e=>(0,$.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,I.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,$.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsx)(j.BookingAllergyChain,{b:e,me:A}),(0,$.jsx)(o.default,{style:{flexDirection:'row'},children:(0,$.jsx)(w.WhatsAppGuest,{b:e,rid:z.id,kind:"auto"})})]},e.id))]}):null,ee?(0,$.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,$.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,$.jsx)(r.T,{size:14,children:ee.text})]}):null,(0,$.jsxs)(r.Card,{children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,$.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Y.paid)," paid hours"]})]}),se?(0,$.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,$.jsxs)(r.T,{size:14,children:["You have ",se," request",se>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(_,'staff').length?(0,$.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,$.jsx)(y.QuickLinksRow,{compact:!0})]}):null,v?null:(0,$.jsx)(o.default,{style:{gap:6},children:te.map(([e,s])=>(0,$.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),D=_r(d[23]),I=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27])},1391,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1366,1136,850,1149,838,1147,899,1345,1014,829,1096,1154,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:C,now:$,today:S}=(0,x.useCtx)(3e4),{width:T}=(0,r.default)(),B=(0,n.useBookings)(v),M=(0,n.useOrders)(v),D=(0,n.useEvents)(v),[H,R]=(0,t.useState)(7),A=(0,b.useRealHistory)(v,$),P=(0,t.useMemo)(()=>(0,s.forecastToday)(C,B,M,D,$,A??void 0),[C,B,M,D,A,$.getTime()/6e4|0]),E=(0,t.useMemo)(()=>Array.from({length:H},(e,t)=>{const o=(0,c.addMins)((0,c.parseYmd)(S),1440*t);return{d:o,f:(0,s.forecastToday)(C,B,M,D,o,A??void 0)}}),[C,B,M,D,S,H,A]),F=P.hours.reduce((e,s)=>e+s.booked,0),L=Math.max(C.settings.capacityPerHour,...P.hours.map(e=>e.coversHigh)),I=(0,i.showTakeaway)(C),[N,O]=(0,t.useState)(I),_=D.filter(e=>e.date>=S).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),z=Math.min(T,900)-60,Y=e=>E.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,p.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,p.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:H===e,onPress:()=>R(e),testID:`forecast-range-${e}`},e))});return P.enough?(0,p.jsxs)(a.default,{style:{gap:12},children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsxs)(d.Muted,{children:["Hourly labels use the upper end of the Covers range. Steady starts at ",P.busy.steady,"; Busy starts at ",P.busy.busy,"."]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(d.T,{weight:"semibold",colour:u.colours.gold,children:["Today by hour \xb7 ",(0,c.niceDate)($)]}),P.example?(0,p.jsx)(b.ExampleBadge,{}):(0,p.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),P.open?(0,p.jsx)(y.Bars,{data:P.hours.map(e=>({key:String(e.hour),label:String(e.hour),a:e.booked,b:e.walkIns})),max:L,highlight:P.nextHour?String(P.nextHour.hour):void 0}):(0,p.jsx)(d.Muted,{children:"Closed today."}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#9C7C45'}}),(0,p.jsx)(d.Muted,{children:"Booked"})]}),(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#6B5A3A'}}),(0,p.jsx)(d.Muted,{children:"Expected walk-ins and later bookings"})]})]}),P.hours.map(e=>{const t=(0,y.busyLevel)(e.coversHigh,P.busy.busy);return(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{size:14,children:(0,x.fmtH)(e.hour)}),(0,p.jsxs)(d.T,{size:14,colour:u.colours.muted,children:[(0,s.coversRange)(e.coversLow,e.coversHigh),I?` \xb7 about ${e.takeaway} takeaway`:'']}),(0,p.jsx)(d.T,{size:14,weight:"semibold",colour:t.colour,children:t.label})]},e.hour)})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),P.suggestions.map((e,s)=>(0,p.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,p.jsx)(d.Muted,{children:P.example?`${l.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Next ",H," days (covers)"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Covers for the next ${H} days`}),E.filter(e=>e.f.flags.length).map(e=>(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",colour:I?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,p.jsx)(d.Button,{small:!0,kind:"ghost",label:N?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>O(!N)})]}),N?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,p.jsx)(j.LineChart,{width:z,series:[P.hours.map(e=>e.takeaway),P.hours.map(e=>e.takeawayPlaced)],labels:P.hours.map(e=>String(e.hour))}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsx)(d.Muted,{children:"Gold: forecast"}),(0,p.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.map(s=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(s.title)}),(0,p.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,p.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${k(s.date,S)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${k(s.date,S)}`,body:`${s.title} at ${C.name} ${k(s.date,S)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${f(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:f(s.title),body:`${f(s.title)} at ${C.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,p.jsxs)(a.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsx)(b.NotEnoughHistory,{weeks:P.minWeeks,booked:F}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",H," days"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${H} days`}),(0,p.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.slice(0,6).map(e=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(e.title)}),(0,p.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=e(_r(_d[3])),r=e(_r(_d[4])),d=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),j=_r(_d[14]),b=_r(_d[15]),p=_r(_d[16]);const k=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},f=e=>`${(0,o.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1392,[1120,34,1075,102,426,794,848,1122,851,827,840,865,1147,1100,1365,1125,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1393,[815]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=P,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,x]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)).slice(0,8),R=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),A=R.filter(e=>'due'===e.state||'overdue'===e.state),M=R.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,B.jsxs)(o.default,{style:{gap:12},children:[(0,B.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),b?(0,B.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,B.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,B.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,B.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,B.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,B.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===A.length?(0,B.jsx)(i.Muted,{children:"Nothing due right now."}):null,A.map(e=>(0,B.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,y.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,B.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,B.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),M.map(e=>(0,B.jsxs)(i.Muted,{children:[(0,y.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,y.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,B.jsx)(k.SectionHead,{title:"Live orders",right:(0,B.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,B.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,B.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,B.jsx)(P,{o:e},e.id)),v.length?(0,B.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,B.jsx)(i.Card,{style:{opacity:.7},children:(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,B.jsx)(O,{onClose:e=>{h(!1),e&&x(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),x=_r(d[13]),y=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]);const R={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function O({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),y=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,R]=(0,r.useState)(''),[O,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[N,$]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,F]=(0,r.useState)(''),[_,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,x.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries(N).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(y.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.ukPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(_),J=K.length>0&&Y&&(Q?O.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(y.map(e=>e.section)));return(0,B.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,B.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,B.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,B.jsx)(i.Field,{label:"Table number",value:O,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,B.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:R,placeholder:"e.g. Mrs Reid"}),Q?null:(0,B.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:F,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,B.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,B.jsx)(i.Field,{label:"Email (optional)",value:_,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too"}),'phone'===T?(0,B.jsxs)(o.default,{style:{gap:4},children:[(0,B.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,B.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,B.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,B.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),y.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,B.jsxs)(o.default,{style:{flex:1},children:[(0,B.jsx)(i.T,{size:15,children:e.name}),(0,B.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,B.jsx)(i.Stepper,{value:N[e.id]??0,min:0,max:20,label:e.name,onChange:t=>$({...N,[e.id]:t})})]},e.id)),(0,B.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,B.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,B.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,B.jsx)(l.GreensideCashOnly,{}):(0,B.jsx)(i.Banner,{kind:"demo",title:"Card payments: not set up yet",children:"Pay on collection or at the table. Nothing is charged in the app."}),(0,B.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?O.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:_.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${O.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function P({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),x=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,B.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,y.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",R[e.channel??(e.type,'app')]," \xb7 ",(0,y.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,B.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,B.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,B.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,B.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,B.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,B.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,y.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,B.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,B.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,B.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,B.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:x,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,B.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,B.jsx)(i.Button,{small:!0,kind:"ghost",label:"Reject",onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1394,[5,1341,829,1310,34,102,794,848,850,855,830,836,1134,1104,827,840,1147,1100,1135,1136,838,1347,833,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return le}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),p=_r(d[8]),b=_r(d[9]),h=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),v=_r(d[16]),w=_r(d[17]),E=_r(d[18]),N=_r(d[19]),P=_r(d[20]),W=_r(d[21]),A=_r(d[22]),T=_r(d[23]),R=_r(d[24]),M=(e=R)&&e.__esModule?e:{default:e},B=_r(d[25]),O=_r(d[26]),G=_r(d[27]),x=_r(d[28]),D=_r(d[29]),I=_r(d[30]),L=_r(d[31]),H=_r(d[32]),F=_r(d[33]),_=_r(d[34]),Q=_r(d[35]),V=_r(d[36]),q=_r(d[37]),U=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),$=_r(d[42]),J=_r(d[43]),K=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),ae=_r(d[49]),se=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),de=_r(d[55]);const le=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},ue=e=>n.CAN.manage(e);(0,y.register)([{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>ue(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:ue,C:o.ServiceBoard},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:ue,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:ue,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',badge:'NEW',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:ue,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:ue,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:ue,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:ue,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:b.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:ue,badge:'NEW',C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:h.PLAN_SUB,group:'Account',can:n.CAN.billing,C:h.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',badge:'NEW',C:W.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',badge:'NEW',C:N.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:N.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',badge:'NEW',can:ue,C:P.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:N.Timesheets}]),(0,y.register)([{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:A.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:A.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',badge:'NEW',can:ue,C:w.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',badge:'NEW',can:ue,C:E.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'Photo of the cash up sheet, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',badge:'NEW',can:ue,C:v.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:A.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:A.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:A.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:ue,C:A.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:ue,C:A.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:ue,C:A.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:ue,C:A.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:ue,C:A.ReviewEmailSettings},{id:'compliance',title:'Daily checks & allergen log',sub:'Fridge temps, opening checks, audit log',group:'Compliance',C:A.Compliance},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:A.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:ue,badge:'NEW',C:A.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:A.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:T.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>le(),C:T.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:ue,C:T.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:ue,C:T.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:T.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:ue,C:T.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:ue,C:T.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:ue,C:T.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:ue,C:T.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:T.TabletPreview}]);const ge=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',badge:'NEW',C:()=>M.default.createElement(O.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:B.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',badge:'NEW',can:ge,C:B.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',badge:'NEW',can:ge,C:O.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',badge:'NEW',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:G.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',badge:'NEW',C:x.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:ue,C:x.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:ue,badge:'NEW',C:x.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:ue,badge:'NEW',C:D.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:ue,badge:'NEW',C:D.DisplaySettingsPage}]);const ce=e=>'owner'===e||'manager'===e;I.ASSISTANT_AVAILABLE&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ce,badge:'NEW',C:I.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off, voice, connected services',group:'Account',can:ce,C:I.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',badge:'NEW',can:e=>'owner'===e&&!r.IS_CAR,C:H.CarScreen}]);const pe=e=>'owner'===e||'manager'===e,be=()=>{const e=l.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,u.costsAllowedFor)(t)},he=e=>pe(e)&&be();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:pe,badge:'NEW',C:L.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Creator},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Prices},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning, allergen checks; filters; CSV and print for the EHO',group:'Compliance',can:pe,badge:'NEW',C:L.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:pe,badge:'NEW',C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',badge:'NEW',C:L.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:ue,badge:'NEW',C:F.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:ue,badge:'NEW',C:F.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:ue,badge:'NEW',C:F.Outbox}]);const fe=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:fe,badge:'NEW',C:Q.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:fe,badge:'NEW',C:_.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:fe,badge:'NEW',C:V.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:fe,badge:'NEW',C:q.OrderSheetSettings},...U.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:fe,C:(0,_.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:fe,badge:'NEW',C:Y.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:fe,badge:'NEW',C:j.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:ue,badge:'NEW',C:j.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:fe,badge:'NEW',C:j.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:fe,badge:'NEW',C:z.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:ue,badge:'NEW',C:$.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:ue,badge:'NEW',C:$.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:ue,badge:'NEW',C:$.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:ue,badge:'NEW',C:J.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos, Show me where, or ask the Assistant',group:'Start here',can:ue,badge:'NEW',C:K.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:ue,badge:'NEW',C:Z.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, Booker and Bidfood lists, offers, events and specials the voice helper prepared; nothing is sent',group:'Run the day',can:ue,badge:'NEW',C:ee.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift, left by voice or typing',group:'Run the day',badge:'NEW',C:ee.ShiftNotesPage},{id:'voice',title:'Voice helper',sub:'Hold-to-talk input, text-only replies, who gets it and microphone privacy',group:'Settings',can:ue,badge:'NEW',C:ee.VoiceSettingsPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(te.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update',group:'Compliance',can:pe,badge:'NEW',C:function(){return M.default.createElement(ae.FoodSafetyCard,null)}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(ie.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:pe,badge:'NEW',C:function(){const{rid:e,today:t}=(0,se.useCtx)(6e4);return M.default.createElement(ie.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',badge:'NEW',C:function(){const{rid:e,me:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(re.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:ue,badge:'NEW',C:X.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',badge:'NEW',C:function(){const{me:e,role:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(oe.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:ue,C:ne.NightlyReportPage},{id:'support',title:'Chat with CoverCharge support',sub:'A message to the CoverCharge team',group:'Start here',can:ue,C:de.SupportChatPage}])},1395,[806,1396,846,1399,865,997,988,800,855,1401,1406,1416,1378,1417,1418,1420,1421,1422,1423,1155,1157,1425,1376,1426,34,1154,1145,1377,1366,1379,1410,1431,1432,1433,1369,1356,1383,1434,925,1435,1436,1437,1151,1384,1438,1310,1385,1450,1082,1043,1100,1156,1130,1451,1454,1457]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LookBackResult=k,_e.monthCells=v,_e.calendarDayLabel=C,_e.LookBackCalendar=T,_e.LookBack=function(){const{rid:e,today:s}=(0,d.useCtx)(3e4),[o,l]=(0,t.useState)((0,c.addDays)(s,-1)),[x,j]=(0,t.useState)((0,b.ukHistoryDate)(o)),[p,f]=(0,t.useState)(0),[m,D]=(0,t.useState)(!1),v=(0,u.useHistoricalBookingDay)(e,o,s,p),C=(0,b.parseHistoryInput)(x),w=!!C&&(0,b.validPastDate)(C,s);if(!v.allowed)return(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"Sign in to the Managers app with manager or owner access to Look back."})});const $=e=>{l(e),j((0,b.ukHistoryDate)(e))};return(0,h.jsxs)(i.default,{style:{gap:14},testID:"look-back",children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Look back"}),(0,h.jsx)(n.T,{size:18,center:!0,children:"Find bookings for one exact past date. Read-only; nothing is sent or changed."}),(0,h.jsx)(n.Field,{label:"Past booking date (DD MM YYYY)",value:x,onChangeText:j,placeholder:"05 11 2025",accessibilityLabel:"Exact past booking date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"look-back-date",style:{textAlign:'center'}}),w?null:(0,h.jsx)(n.T,{size:18,center:!0,children:"Enter a past date as DD MM YYYY, for example 09 11 2026, including the four-digit year."}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"look-back-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,c.longDay)(o)}`,onPress:()=>D(!0)}),(0,h.jsx)(n.Button,{label:"Show bookings",accessibilityLabel:`Look back at bookings for ${w&&C?(0,b.historyDateLabel)(C):'a valid past date'}`,disabled:!w,onPress:()=>{C&&$(C),f(p+1)}})]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Previous day",accessibilityLabel:`Previous day, ${(0,c.longDay)((0,c.addDays)(o,-1))}`,onPress:()=>$((0,c.addDays)(o,-1))}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Next day",accessibilityLabel:`Next day, ${(0,c.longDay)((0,c.addDays)(o,1))}`,disabled:!(0,b.validPastDate)((0,c.addDays)(o,1),s),onPress:()=>$((0,c.addDays)(o,1))})]})]})}),(0,h.jsx)(T,{visible:m,today:s,selected:o,onClose:()=>D(!1),onPick:e=>{$(e),D(!1)}}),v.data?(0,h.jsx)(k,{day:v.data}):(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:v.error||'Loading booking history\u2026'})})]})};var t=r(_d[0]),s=e(t),o=e(r(_d[1])),l=e(r(_d[2])),i=e(r(_d[3])),n=r(_d[4]),c=r(_d[5]),d=r(_d[6]),u=r(_d[7]),b=r(_d[8]),y=r(_d[9]),h=r(_d[10]);function k({day:e}){return(0,h.jsxs)(i.default,{testID:"look-back-result",style:{gap:14},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.T,{size:24,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:(0,b.historyDateLabel)(e.date)}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`Booked Covers: ${null===e.booked_covers?'not recorded':e.booked_covers}`,children:[(0,h.jsx)(n.T,{size:20,children:"Booked Covers"}),(0,h.jsx)(n.T,{size:36,weight:"bold",colour:y.colours.gold,children:null===e.booked_covers?'Not recorded':e.booked_covers})]}),e.historical_records?(0,h.jsx)(n.T,{size:20,colour:y.colours.gold,weight:"semibold",children:b.HISTORY_LABEL}):null,(0,h.jsx)(n.T,{size:18,children:b.HISTORY_NOTE}),e.missing_covers?(0,h.jsxs)(n.T,{size:18,children:[e.missing_covers," booking records have no party size; not filled in."]}):null]})}),e.bookings.length?null:(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"No booking records found for this date. The history is incomplete; this does not prove there were no bookings."})}),e.bookings.map((e,t)=>(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{testID:"look-back-booking",style:{gap:8},accessible:!0,accessibilityLabel:`${e.time??'Time not recorded'}, party size ${null===e.covers?'not recorded':`${e.covers} Covers`}, ${e.table?`table ${e.table}`:'table not recorded'}, ${e.status??'status not recorded'}${e.counted?'':', excluded from Booked Covers'}`,children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:20,children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,children:e.time??'Time not recorded'}),(0,h.jsxs)(n.T,{size:22,children:["Party size: ",null===e.covers?'Not recorded':`${e.covers} Covers`]})]}),(0,h.jsxs)(n.T,{size:20,children:["Table: ",e.table??'Not recorded']}),(0,h.jsxs)(n.T,{size:18,children:[e.status??'Status not recorded',e.counted?'':' \xb7 excluded from Booked Covers']}),(0,h.jsxs)(n.T,{size:18,colour:y.colours.muted,children:['favourite_table'===e.source?'previous booking system':'CoverCharge'," \xb7 ",e.ref]})]})},`${e.source}:${e.ref}:${t}`))]})}const x=['January','February','March','April','May','June','July','August','September','October','November','December'],j=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],p=e=>String(e).padStart(2,'0'),f=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=(e,t)=>{const[s,o]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1+t,1,12));return`${l.getUTCFullYear()}-${p(l.getUTCMonth()+1)}`},D=e=>{const[t,s]=e.split('-').map(Number);return`${x[s-1]} ${t}`};function v(e){const[t,s]=e.split('-').map(Number),o=new Date(Date.UTC(t,s,0)).getUTCDate();return[...Array(f(`${e}-01`)).fill(null),...Array.from({length:o},(t,s)=>`${e}-${p(s+1)}`)]}function C(e,t,s){const o=(0,b.validPastDate)(e,t);return`${(0,c.longDay)(e)}${e===t?', today':''}${e===s?', selected':''}${o?'':', not available. Look back is for past days only'}`}function T({visible:e,today:d,selected:u,onPick:k,onClose:x}){const[p,f]=(0,t.useState)(u.slice(0,7)),[T,w]=(0,t.useState)(0);s.default.useEffect(()=>{e&&f(u.slice(0,7))},[e,u]);const $=v(p),L=m(p,-1),z=m(p,1),P=`${z}-01`I>=46?e.slice(0,3):e.slice(0,2);return(0,h.jsx)(n.Sheet,{visible:e,onClose:x,title:"Pick a day",maxWidth:420,testID:"look-back-calendar",footer:(0,h.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,h.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:"look-back-cal-close",onPress:x})}),children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'stretch'},children:[(0,h.jsx)(n.T,{size:20,weight:"bold",colour:y.colours.goldLight,center:!0,accessibilityRole:"header",testID:"look-back-cal-month",children:D(p)}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:`Previous month, ${D(L)}`,testID:"look-back-cal-prev",onPress:()=>f(L)}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:P?`Next month, ${D(z)}`:`Next month, ${D(z)}, not available. Look back is for past days only`,disabled:!P,testID:"look-back-cal-next",onPress:()=>f(z)})]}),(0,h.jsxs)(i.default,{onLayout:e=>w(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,h.jsx)(i.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:j.map(e=>(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,h.jsx)(n.T,{size:13,colour:y.colours.muted,center:!0,children:S(e)})},e))}),(0,h.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:"look-back-cal-grid",children:$.map((e,t)=>{if(!e)return(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`blank-${t}`);const s=(0,b.validPastDate)(e,d),x=e===u;return(0,h.jsx)(l.default,{testID:`look-back-cal-${e}`,accessibilityRole:"button",accessibilityLabel:C(e,d,u),accessibilityState:{selected:x,disabled:!s},disabled:!s,onPress:()=>{k(e),o.default.announceForAccessibility?.(`Looking back at ${(0,c.longDay)(e)}`)},style:{width:"14.285714285714286%",height:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:x||e===d?1.5:0,borderColor:y.colours.gold,backgroundColor:x?y.colours.goldTint:'transparent',opacity:s?1:.35},children:(0,h.jsx)(n.T,{size:17,weight:x?'bold':'regular',colour:x?y.colours.goldLight:y.colours.text,center:!0,children:Number(e.slice(8))})},e)})})]})]})})}},1396,[34,281,402,102,794,1346,1100,1397,1398,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1397,[34,846,1398,827,985,931]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1398,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return k}}),_e.DashCorners=I,_e.ServiceBoard=function(){const{role:e}=(0,j.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,D.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,D.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,D.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,D.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,D.jsx)(I,{onLeave:y}),(0,D.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,D.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,D.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,D.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,D.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,D.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?w((0,D.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]),D=r(d[16]);const k=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function C({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,D.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,D.jsxs)(s.default,{children:[(0,D.jsx)(p.Icon,{name:t,colour:h.colours.gold}),u?(0,D.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,D.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function I({onLeave:e}){const t=(0,x.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>y.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,D.jsx)(C,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,D.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,D.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:k.filter(e=>'left'===e.side).map(n)}),(0,D.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[k.filter(e=>'right'===e.side).map(n),(0,D.jsx)(C,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')}),(0,D.jsx)(f.VoiceSlot,{size:44,layer:1})]})]})}function w(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[17]);return t(e,document.body)}},1399,[34,395,236,402,102,36,794,1041,1278,865,840,1116,1400,1153,1393,1100,25,277]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1400,[815]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),S=(0,c.useOwner)(e=>e.staff),$=(0,c.useOwner)(e=>e.previewRole),[B,P]=(0,t.useState)(''),[z,_]=(0,t.useState)(''),[H,E]=(0,t.useState)('staff'),[N,Y]=(0,t.useState)({}),F=c.CAN.staffAdmin(f),[G,U]=(0,t.useState)(null),[W,J]=(0,t.useState)(''),[K,V]=(0,t.useState)({});return(0,C.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(r.default,{testID:"access-tip",children:(0,C.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(r.default,{testID:"cashup-access-tip",children:(0,C.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, take a picture of the taking sheet and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,C.jsx)(r.default,{testID:"temp-access-tip",children:(0,C.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,C.jsx)(L,{ask:G,onClose:()=>U(null)}),(0,C.jsx)(O,{}),(0,C.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,C.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,C.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,C.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:$===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,C.jsx)(i.Muted,{children:T[$]})]}),'owner'===f||'manager'===f?(0,C.jsx)(v.AddTempStaffButton,{}):null,(0,C.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:W,onChangeText:J,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),S.filter(e=>(0,c.staffMatches)(e,W)).map(t=>(0,C.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,C.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,C.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,C.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,C.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,C.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,C.jsx)(A,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(i.Row,{gap:6,children:(0,C.jsx)(k.CashUpAccessBadge,{m:t})}),(0,C.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,C.jsxs)(r.default,{style:{gap:4},children:[(0,C.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:N[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>Y(e=>({...e,[t.id]:!e[t.id]}))}),N[t.id]?(0,C.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,C.jsx)(M,{person:t,actor:j,onAsk:U}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,C.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,C.jsx)(R,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsxs)(i.Row,{gap:6,children:[(0,C.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,C.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:K[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>V(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(K[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(I,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,C.jsx)(k.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,C.jsx)(v.StaffDisplayControls,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,C.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,F&&t.id!==w&&'owner'!==t.role?(0,C.jsx)(i.Row,{wrap:!0,gap:6,children:(0,C.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),F?(0,C.jsxs)(i.Card,{children:[(0,C.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,C.jsx)(i.Field,{label:"Name",value:B,onChangeText:P}),(0,C.jsx)(i.Field,{label:"Job title",value:z,onChangeText:_,placeholder:"e.g. Kitchen porter"}),(0,C.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,C.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:H===e,onPress:()=>E(e)},e))}),(0,C.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:B.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(B.trim(),H,z.trim()||'Team member'),P(''),_('')}})]}):(0,C.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]);const T={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function A({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,C.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function I({person:e}){const s=(0,S.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,C.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,C.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,$.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,C.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,S.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,C.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,C.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function M({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,C.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,C.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function R({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,C.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,C.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,C.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,C.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,C.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,C.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,C.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,C.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function D({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,C.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,C.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,C.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,C.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,C.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,C.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,C.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,C.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,C.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,C.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,C.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,C.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function O(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,C.jsxs)(r.default,{style:{gap:4},children:[(0,C.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,C.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,C.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1401,[796,1375,34,836,102,794,865,840,1100,899,924,1402,985,994,1047,1373,1403,1404,1012,1405,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1402,[]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffDisplayControls=function({m:e}){const s=(0,p.usePinStatus)(t=>t[e.id]),[c,m]=(0,l.useState)(''),[h,y]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),b='owner'===e.role||'manager'===e.role?6:4,j=async()=>{S(!0);const t=await(0,p.setStaffPin)(e.id,c,b);S(!1),m(''),y(t.ok?`PIN ${s?.hasPin?'reset':'set'}. Tell ${e.name} in person; it isn\u2019t shown again.`:t.error??'Could not set the PIN.'),t.ok&&(0,p.refreshPinStatus)()};return(0,f.jsxs)(n.default,{testID:`display-controls-${e.id}`,style:{gap:6,paddingTop:4},children:[(0,f.jsx)(o.Toggle,{testID:`display-clock-${e.id}`,label:"Can clock in at the Display",value:!!e.displayClock,onChange:t=>u.useOwner.getState().updateStaff(e.id,{displayClock:t})}),e.displayClock?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Muted,{size:12,children:s?.locked?'PIN locked (5 wrong tries)':s?.hasPin?e.temp?'Code set':'PIN set':'No PIN yet'}),(0,f.jsx)(t.TextInput,{testID:`pin-input-${e.id}`,accessibilityLabel:`New PIN for ${e.name}`,value:c,onChangeText:e=>m(e.replace(/\D/g,'').slice(0,8)),placeholder:`${b}\u20138 digits`,placeholderTextColor:r.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",maxLength:8,style:{width:110,minHeight:34,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:`set-pin-${e.id}`,label:s?.hasPin?'Reset PIN':'Set PIN',disabled:x||c.length{j()}})]}):null,h?(0,f.jsx)(o.Muted,{children:h}):null,e.temp?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Badge,{kind:"gold",label:"Temp"}),(0,f.jsxs)(o.Muted,{size:12,children:[e.tempUntil?`Until ${e.tempUntil}`:'No end date'," \xb7 Display only, no phone app"]}),(0,f.jsx)(o.Button,{small:!0,kind:"ghost",testID:`make-full-${e.id}`,label:"Make full staff",onPress:()=>u.useOwner.getState().updateStaff(e.id,{temp:!1,tempUntil:void 0,job:'Temp'===e.job?'':e.job})})]}):null]})},_e.AddTempStaffButton=function({initialOpen:e}){const[t,s]=(0,l.useState)(!!e),[n,r]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),[y,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{(0,p.refreshPinStatus)()},[]);const S=()=>{s(!1),x(null),h(null)},b=async e=>{r(!0);const t=await(0,p.addTempStaff)(e);r(!1),t.ok&&t.ref&&t.code?(u.useOwner.setState(l=>({staff:[...l.staff.filter(e=>e.id!==t.ref),{id:t.ref,name:t.name??e.name,role:'staff',job:'Temp',active:!0,level:'Staff',dept:e.dept??'',displayClock:!0,temp:!0,tempUntil:e.until??void 0}],hourly:null!=e.rate?{...l.hourly,[t.ref]:Math.round(100*e.rate)}:l.hourly})),x({name:t.name??e.name,code:t.code})):h(t.error??'Could not add them.')};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Button,{testID:"add-temp-btn",kind:"secondary",label:"Add temp staff",onPress:()=>s(!0)}),t?(0,f.jsx)(o.Sheet,{visible:!0,onClose:S,title:y?'Temp added':'Add temp staff',maxWidth:560,testID:"add-temp",children:y?(0,f.jsx)(c.TempCode,{name:y.name,code:y.code,onClose:S}):(0,f.jsx)(c.AddTempForm,{busy:n,error:m,onSubmit:e=>{b(e)}})}):null]})};var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),n=(e=s)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),u=_r(d[5]),p=_r(d[6]),c=_r(d[7]),f=_r(d[8])},1403,[796,34,102,794,840,865,1320,1331,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1404,[34,102,794,840,993,1037,985,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setCanChangeBookings=async function(o,s){const c=n.useSync.getState().venueId;if(!c||'staff'!==n.useSync.getState().kind)return{ok:!1,error:'Saved on this device. Connect to the shared team to store it for everyone.'};const h=(0,t.getSupabase)();try{const{error:t}=await h.rpc('set_can_change_bookings',{p_venue:c,p_staff_ref:o,p_on:s});return t?{ok:!1,error:/owner or manager/i.test(t.message)?'Only an owner or manager can change this.':'Saved on this device. The server did not take the change.'}:{ok:!0}}catch{return{ok:!1,error:'Saved on this device. The server did not take the change.'}}};var t=r(d[0]),n=r(d[1])},1405,[931,985]); -__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PRICING_AVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_VOICE_LINE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_SUPPLIER_LINE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DONE_FOR_YOU",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"doneForYouLine",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return v}}),_e.PlanBilling=function(){const{now:e,role:n,rid:b}=(0,p.useCtx)(6e4),j=(0,c.trialStatus)((0,l.defaultSimStart)(),e),[x,w]=(0,s.useState)(!1);return u.CAN.billing(n)?x?(0,y.jsx)(M,{onBack:()=>w(!1)}):(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(o.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,y.jsx)(t.VoiceUsageCard,{rid:b,now:e}),(0,y.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,y.jsxs)(i.default,{testID:"plan-founding",children:[(0,y.jsx)(o.T,{size:12,weight:"semibold",colour:h.colours.goldMuted,children:"FOUNDING OFFER \xb7 FIRST 50 VENUES"}),(0,y.jsxs)(o.T,{size:30,weight:"bold",children:["\xa349",(0,y.jsx)(o.T,{size:14,colour:h.colours.muted,children:" a month + VAT if applicable, per venue"})]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(o.Badge,{kind:"gold",label:"Every Full Restaurant Pro feature"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"One month free"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"\xa349 net locked in"})]}),(0,y.jsx)(o.Muted,{children:"Early adopter price for the first 50 venues: every Full Restaurant Pro App feature, including the owner's dashboard and admin and the voice Assistant. \xa349 net stays locked in while your subscription stays active."}),(0,y.jsxs)(o.T,{size:13,testID:"plan-early-done-for-you",children:["\u2713 ",T(P.early)]}),(0,y.jsx)(o.Muted,{children:"From venue 51, usual prices:"}),(0,y.jsxs)(i.default,{testID:"plan-usual-lite",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[k," \xb7 ",C," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:S}),O.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e)),(0,y.jsx)(o.T,{size:13,testID:"plan-lite-not-included",children:"Not included: the owner's dashboard and admin, or the voice Assistant."})]}),(0,y.jsxs)(i.default,{testID:"plan-usual-pro",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[_," \xb7 ",L," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:v}),R.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e))]}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>w(!0),style:{marginTop:6}})]}),(0,y.jsx)(o.Card,{children:(0,y.jsxs)(i.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,y.jsx)(o.T,{weight:"bold",colour:h.colours.gold,children:"free"}),"."]}),(0,y.jsx)(o.Muted,{children:"Your own app would cost about \xa398 in store fees in the first year alone (Apple \xa378.99 a year in the UK, Google US$25 one-off), then \xa378.99 a year."})]})}),(0,y.jsx)(o.Muted,{children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, and subscribers get free lifetime 24/7 customer support. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{children:"Free trial"}),(0,y.jsxs)(o.T,{weight:"bold",colour:h.colours.gold,children:[j.daysLeft," day",1===j.daysLeft?'':'s'," left"]})]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(100*(1-j.daysLeft/j.total))}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),(0,y.jsxs)(o.Muted,{children:["Then \xa3",c.PLAN.monthlyPence/100," a month + VAT if applicable. The trial start date is not set up yet."]})]}),(0,y.jsx)(f.AssistantPlanCard,{}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{weight:"semibold",children:"Free lifetime customer support"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"Included"})]}),(0,y.jsx)(o.Muted,{children:"Free for as long as you subscribe, day or night. Setup is all done digitally. Support contact details: not set up yet."})]})]}):(0,y.jsx)(o.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),i=(e=n)&&e.__esModule?e:{default:e},o=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),p=r(d[8]),f=r(d[9]),y=r(d[10]);const b=!0,j='Founding offer, free trial, set-up guide',x='. The owner\'s dashboard and admin come with Full Restaurant Pro App (\xa399 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',w='Voice Assistant (hold to talk) for seating guests, marking tables as cleared, temperature logs and finding something in the app: fair usage 1,000 voice tasks a month per venue',A='Supplier links: open your suppliers\' ordering sites and keep order lists',P={lite:1,pro:3,early:3},T=e=>`${e} done-for-you ${1===e?'change':'changes'} a month`,k='Customer & Takeaway App',_='Full Restaurant Pro App',C='\xa349',L='\xa399',S='A lite version of CoverCharge: 3 core customer and takeaway functions tailored to you, set up digitally with the in-app guided setup and step-by-step guides, free lifetime 24/7 customer support while subscribed, and unlimited self-edits of your basic info. The owner\'s dashboard and admin, and the voice Assistant, are not included.',v='Every feature, every app, including the owner\'s dashboard and admin and the voice Assistant. Set up digitally with the in-app guided setup and step-by-step guides, the Assistant (fair use 300 tasks a month), free lifetime 24/7 customer support while subscribed, and unlimited self-edits.',O=['Customer app: menu, allergens, bookings and loyalty','Takeaway ordering','Set up digitally: in-app guided setup and step-by-step guides','Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits of your basic info',T(P.lite)],R=['Every feature, every app','The owner\'s dashboard and admin',A,'Set up digitally: in-app guided setup and step-by-step guides','The Assistant, fair use 300 tasks a month',w,'Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits',T(P.pro)],I=[['Choose your 3 core functions','Pick what matters most to you, for example menu & allergens, takeaway ordering or the stamp card.'],['Add your logo and colours','More \u203a Branding: upload your logo; the apps use it everywhere.'],['Check your opening hours','More \u203a Opening hours: set your normal week and any closed days.'],['Add your menu and allergens','Menu & allergens: add dishes, prices and the 14 allergens, then sign each dish off.'],['Invite your team','More \u203a Team: add staff so they can use CoverCharge for Staff.'],['Share the customer app','More \u203a Your apps: copy the link or show the QR code at the counter.'],['Try a test order','Place a test order in the customer app and watch it arrive.']];function M({onBack:e}){const[t,n]=(0,s.useState)([]);return(0,y.jsxs)(i.default,{style:{gap:10},testID:"setup-guide",children:[(0,y.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,y.jsx)(o.H2,{children:"Set-up guide"}),(0,y.jsxs)(o.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",t.length," of ",I.length," done."]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(t.length/I.length*100)}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),I.map(([e,s],l)=>{const u=t.includes(l);return(0,y.jsx)(o.Card,{children:(0,y.jsxs)(o.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,y.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:u?h.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(o.T,{size:14,weight:"bold",colour:u?'#1a1610':h.colours.gold,children:u?'\u2713':String(l+1)})}),(0,y.jsxs)(i.default,{style:{flex:1,gap:4},children:[(0,y.jsx)(o.T,{weight:"semibold",children:e}),(0,y.jsx)(o.Muted,{children:s}),(0,y.jsx)(o.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>n(u?t.filter(e=>e!==l):[...t,l])})]})]})},e)}),(0,y.jsx)(o.Muted,{children:"Stuck? Free lifetime customer support is included while you subscribe. Ticks on this guide are not saved."})]})}},1406,[1407,34,102,794,819,865,1409,840,1100,1410,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceUsageCard=function({rid:e,now:o}){const h=(0,l.useVoiceUsage)(e,o);return(0,c.jsx)(s.Card,{children:(0,c.jsxs)(n.default,{testID:"voice-usage",style:{gap:6},children:[(0,c.jsx)(s.T,{weight:"semibold",children:h.line}),(0,c.jsx)(n.default,{style:{height:8,borderRadius:4,backgroundColor:t.colours.surface2,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${Math.min(100,Math.round(100*h.pct))}%`,height:8,backgroundColor:h.reached?t.colours.red:h.warn?t.colours.amber:t.colours.ok}})}),(0,c.jsxs)(s.Muted,{children:[l.VOICE_FAIR_USAGE,", shared by all of this venue\u2019s apps and devices. Food safety logging always works."]}),h.reached?(0,c.jsx)(s.Banner,{kind:"info",title:"Allowance reached for this month",children:l.REACHED_TEXT}):h.warn?(0,c.jsx)(s.Banner,{kind:"warn",title:"80% of this month\u2019s allowance used",children:"The voice helper keeps working until 1,000; it starts again on the 1st."}):null,(0,c.jsx)(s.Muted,{children:"For now the count is kept on each device; it will become one venue-wide count."})]})})},r(d[0]);var e,o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),l=r(d[4]),c=r(d[5])},1407,[34,102,794,840,1408,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1408,[808,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PLAN",{enumerable:!0,get:function(){return t}}),e.trialStatus=function(n,o){const l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),u=new Date(l.getFullYear(),l.getMonth()+t.trialMonths,l.getDate()),c=Math.max(0,Math.ceil((u.getTime()-o.getTime())/864e5));return{start:l,end:u,daysLeft:c,total:Math.round((u.getTime()-l.getTime())/864e5)}};const t={name:'CoverCharge',monthlyPence:4900,trialMonths:1,vatNote:'+ VAT if applicable'}},1409,[]); -__d(function(g,_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,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return S}}),_e.AssistantFab=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)(e=>e.enabled);return T(e)&&t?(0,k.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:y.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,k.jsx)(v,{size:22}),(0,k.jsx)(h.T,{weight:"bold",colour:A,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=S(e=>e.open),s=()=>S.getState().setOpen(!1),{rid:n,role:u,me:w}=(0,j.useCtx)(3e4),A=(0,x.useAssistant)(),B=R(),[P,O]=(0,o.useState)([]),[E,L]=(0,o.useState)(''),[z,W]=(0,o.useState)(!1),$=(0,o.useRef)(null),_=(0,o.useRef)(null);if((0,o.useEffect)(()=>{setTimeout(()=>$.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!T(u))return null;const N=(e,t,s)=>x.useAssistant.getState().record({at:(new Date).toISOString(),by:w,role:u,asked:e,action:t,outcome:s}),F=(e,t="result")=>O(s=>[...s,{id:I(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;L(''),O(e=>[...e,{id:I(),from:'you',text:t}]);try{s=await(0,m.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),O(e=>[...e,{id:I(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>O(s=>s.map(s=>s.id===e?{...s,state:t}:s)),V=async(e,t,s)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(s??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(C,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await b.repo.bookings.seatWalkIn(n,Number(o.party),s,'Added by Assistant'),s&&(0,p.resetTableLive)(n,s),F(`Done: Walk-in \xb7 ${o.party} seated${s?` at table ${s}`:' (table to assign)'}. It's in Bookings now.`),N(e.asked,t.title,'done');break}case'eightysix':await b.repo.menu.updateItem(String(o.itemId),{soldOut:Boolean(o.soldOut)}),F(o.soldOut?`Done: ${o.name} is marked sold out. Staff see it on the Display.`:`Done: ${o.name} is back on.`),N(e.asked,t.title,'done');break;case'price':await b.repo.menu.updateItem(String(o.itemId),{price:Number(o.pence)}),F(`Done: ${o.name} is now \xa3${(Number(o.pence)/100).toFixed(2)}.`),N(e.asked,t.title,'done');break;case'offer':f.useOwner.getState().addOffer({title:String(o.title),body:String(o.body),kind:'offer',live:!1}),F(`Done: draft offer \u201c${o.title}\u201d saved in Offers & specials (not live).`),N(e.asked,t.title,'done');break;case'rota':case'bookings':F(String(o.result)),N(e.asked,t.title,'looked up')}},G=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===A.tier,Y=(0,x.tasksUsed)(A);return(0,k.jsx)(a.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:s,children:(0,k.jsx)(c.default,{style:[h.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(c.default,{testID:"assistant-sheet",style:{backgroundColor:y.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:y.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:8,style:{flex:1},children:[(0,k.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:18})}),(0,k.jsx)(h.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,k.jsx)(r.default,{accessibilityLabel:"Close",onPress:s,hitSlop:10,children:(0,k.jsx)(h.T,{size:22,colour:y.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(c.default,{testID:"assistant-demo-badge",children:(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,k.jsxs)(c.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"info",title:"The Assistant is switched off in this preview",children:"Ask for things in plain English \u2014 add a walk-in, mark a dish sold out, check the rota, draft posts and replies \u2014 and confirm each one before anything happens. To use it, turn off the preview switch in More \u203a Account \u203a Assistant settings."}),(0,k.jsx)(h.Button,{kind:"secondary",label:"Close",onPress:s})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(l.default,{ref:$,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,k.jsxs)(c.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,k.jsxs)(h.T,{children:["Hi ",w.split(' ')[0]," \u2014 what can I do? I\u2019ll always show you what I\u2019m about to do and wait for you to confirm."]}),(0,k.jsx)(h.Muted,{children:"Try:"}),m.SUGGESTED_PROMPTS.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:y.colours.surface2},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,k.jsx)(c.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(h.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,k.jsx)(D,{m:e,onConfirm:(t,s)=>V(e,t,s),onCancel:()=>G(e)},e.id):'choose'===e.proposal.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,k.jsxs)(c.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:8},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]},e.id):(0,k.jsx)(c.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?y.colours.amberBg:y.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:y.colours.amber},children:(0,k.jsx)(h.T,{children:e.text})},e.id))]}),(0,k.jsxs)(h.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:E,onChangeText:L,onSubmitEditing:()=>H(E),returnKeyType:"send",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),A.voice?(0,k.jsx)(r.default,{testID:"assistant-mic",accessibilityRole:"button",accessibilityLabel:z?'Stop listening':'Speak',onPress:()=>{const e=M();if(e)if(z)_.current?.stop?.();else try{const t=new e;_.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&L(t)},t.onend=()=>W(!1),t.onerror=()=>{W(!1),F("Sorry, I didn't catch that. You can type instead.",'note')},W(!0),t.start()}catch{W(!1),F("Voice input isn't available here. Please type instead.",'note')}else F("Voice input isn't available in this browser (for example Huawei Browser). Please type your request instead.",'note')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:y.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:z?y.colours.gold:'transparent'},children:(0,k.jsx)(h.T,{size:20,children:"\ud83c\udfa4"})}):null,(0,k.jsx)(h.Button,{label:"Send",accessibilityLabel:"Send",disabled:!E.trim(),onPress:()=>H(E)})]}),(0,k.jsxs)(h.Muted,{center:!0,children:["Demo on this device \xb7 ",Y," of ",x.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,j.useCtx)(6e4),s=(0,x.useAssistant)();return T(t)?(0,k.jsxs)(c.default,{style:{gap:12},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(c.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:22})}),(0,k.jsxs)(c.default,{style:{flex:1},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,k.jsx)(h.Muted,{children:"Add walk-ins, mark dishes sold out, change prices, check the rota or bookings, draft offers, posts and replies. You confirm every action."})]})]}),(0,k.jsx)(h.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>S.getState().setOpen(!0)}),(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,k.jsxs)(c.default,{testID:"assistant-log",style:{gap:6},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>x.useAssistant.getState().clearLog()}):null]}),(0,k.jsx)(h.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,k.jsx)(h.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,k.jsxs)(c.default,{style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.T,{size:12,colour:y.colours.muted,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,")"]}),(0,k.jsx)(h.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,k.jsxs)(h.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,k.jsxs)(h.T,{size:13,colour:y.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,k.jsx)(h.Muted,{children:"The activity log is visible to the owner."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)();return T(e)?(0,k.jsxs)(c.default,{style:{gap:12},testID:"assistant-settings",children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,k.jsx)(h.Muted,{children:"Shows the gold Assistant button on every Managers screen."}),(0,k.jsx)(h.Toggle,{label:"Voice input (microphone)",value:t.voice,onChange:e=>t.set({voice:e})}),(0,k.jsx)(h.Muted,{children:"What you say is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. If this device can\u2019t record, just type."})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,k.jsxs)(c.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:y.colours.border,paddingTop:8},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:e.name}),(0,k.jsx)(h.Badge,{kind:"neutral",label:"Not connected"})]}),(0,k.jsxs)(h.Muted,{children:["Needed for ",e.does,". Until it\u2019s connected, the Assistant only shows you a preview \u2014 nothing is sent or changed."]})]},e.id)),(0,k.jsx)(h.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,k.jsx)(h.Muted,{children:"The Assistant comes with Full Restaurant Pro App and the early adopter offer. It isn\u2019t part of Customer & Takeaway App. This switch only shows how the app looks with it switched off."})]}):null,(0,k.jsx)(h.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to the voice assistant to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,x.useAssistant)(),t=(0,x.tasksUsed)(e),s=Math.min(1,t/x.FAIR_USE);return(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,k.jsx)(h.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,k.jsx)(c.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${x.FAIR_USE} tasks used`,style:{height:8,backgroundColor:y.colours.border,borderRadius:4},children:(0,k.jsx)(c.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:y.colours.gold,borderRadius:4}})}),(0,k.jsxs)(h.Muted,{children:[t," of ",x.FAIR_USE," tasks used this month (mock). A task is one confirmed action or look-up."]})]})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),o=_r(d[3]),a=e(_r(d[4]));_r(d[5]);var r=e(_r(d[6])),l=e(_r(d[7])),c=e(_r(d[8])),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),m=_r(d[14]),x=_r(d[15]),y=_r(d[16]),j=_r(d[17]),k=_r(d[18]);const w=!0,C='Nothing was sent or changed: this connection is not set up yet.',A='#1A1408',S=(0,u.create)(e=>({open:!1,setOpen:t=>e({open:t})})),T=e=>'owner'===e||'manager'===e,I=()=>Math.random().toString(36).slice(2,9);function v({size:e=24,colour:t=A}){return(0,k.jsx)(h.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function R(){const{rid:e,r:t,now:n,today:a}=(0,j.useCtx)(3e4),r=(0,b.useAllMenu)(e),l=(0,p.useTableNames)(e),c=(0,b.useBookings)(e),u=(0,f.useOwner)(e=>e.staff),h=(0,f.useOwner)(e=>e.shifts),m=(0,f.useOwner)(e=>e.offers),x=(0,f.useOwner)(e=>e.suppliers);return(0,o.useMemo)(()=>({venue:t.name,now:n.toISOString(),menu:r.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:l,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:h.filter(e=>e.published&&e.date>=(0,f.addDays)(a,-(0,f.weekdayOf)(a))&&e.date<=(0,f.addDays)(a,6-(0,f.weekdayOf)(a))),bookingsToday:c.filter(e=>e.date===a).sort((e,t)=>e.time.localeCompare(t.time)).map(e=>({name:e.walkIn?'Walk-in':e.name,party:e.partySize,time:e.time,table:e.table,status:e.status})),specials:m.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,s.examplesAllowed)()?{from:`${x[0]?.contact??'Alex Sample'}, ${x[0]?.name??'Example Fish Co.'}`,subject:'Price update for next week (example)',body:'Langoustine is up about 8% next week because of the weather. Haddock and hake unchanged. Same delivery days.'}:null}),[t,n.getMinutes(),r,l,c,u,h,m,x])}function D({m:e,onConfirm:s,onCancel:n}){const a=e.proposal,[r,l]=(0,o.useState)(!1),[u,p]=(0,o.useState)('external'===a.kind?a.text:''),b='open'===e.state;return'inapp'!==a.kind&&'external'!==a.kind?null:(0,k.jsxs)(c.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?y.colours.gold:y.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:y.colours.surface2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:a.title}),'external'===a.kind?(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,k.jsx)(h.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===a.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[a.detail?(0,k.jsx)(h.Muted,{children:a.detail}):null,(0,k.jsx)(h.T,{size:14,colour:y.colours.muted,children:a.label}),r&&b?(0,k.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:u,onChangeText:p,style:[h.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,k.jsx)(c.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:y.colours.gold,paddingLeft:10},children:(0,k.jsxs)(h.T,{children:["\u201c",u,"\u201d"]})}),(0,k.jsxs)(h.Muted,{children:["Sends to: ",a.service.map(e=>m.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,k.jsxs)(c.default,{style:{gap:4},children:[(0,k.jsx)(h.Muted,{children:a.detail}),a.warning?(0,k.jsxs)(h.T,{size:13,colour:y.colours.amber,children:["\u26a0 ",a.warning]}):null]}),b?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,k.jsx)(h.Button,{small:!0,label:'inapp'===a.kind?a.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(a,u)}),'external'===a.kind?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:r?'Done editing':'Edit',testID:"edit-action",onPress:()=>l(!r)}):null,(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,k.jsx)(h.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,k.jsxs)(h.Muted,{children:["Nothing happens until you tap ",'inapp'===a.kind?a.confirmLabel:'Confirm',"."]}):null]})}function M(){return'undefined'==typeof window?null:(0,n.speechRecognizer)()}const B=[{id:'facebook',name:'Facebook (Page & Messenger)',does:'posts and the Messenger auto-reply'},{id:'instagram',name:'Instagram',does:'posts'},{id:'gmail',name:'Gmail',does:'drafting and replying to email'},{id:'wix',name:'Website bookings',does:'website changes such as opening hours'}]},1410,[796,858,929,34,395,236,402,295,102,815,794,1096,848,865,1411,1415,840,1100,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"interpretDemo",{enumerable:!0,get:function(){return t.interpretDemo}}),e.getProvider=function(o="demo"){return'xai'===o?n.xaiProvider:t.demoProvider};var t=r(d[0]),n=r(d[1]),o=r(d[2]);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]}})})},1411,[1412,1414,1413]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.interpretDemo=u,Object.defineProperty(_e,"demoProvider",{enumerable:!0,get:function(){return m}});var e=r(_d[0]),t=r(_d[1]);const a=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],n=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,o=e=>e.toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').trim(),s=e=>o(e).replace(/\([^)]*\)/g,' ').split(/[^a-z0-9]+/).filter(e=>e.length>2&&!['the','and','with','our'].includes(e)),l={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},d=e=>e?l[e]??Number(e):NaN,c=e=>(e.match(/["\u201c\u201d']([^"\u201c\u201d]{3,})["\u201c\u201d']?\s*$/)||e.match(/\bto[:\s]+(.{3,})$/i)||[])[1]?.replace(/["\u201c\u201d]+$/,'').trim();function p(e,t){const a=s(t),n=e.menu.map(e=>{const n=s(e.name);return{m:e,hits:a.filter(e=>n.includes(e)).length,exact:o(e.name).includes(o(t))}}),l=n.filter(e=>e.exact);if(1===l.length)return[l[0].m];const d=Math.max(0,...n.map(e=>e.hits));if(!d)return[];const c=n.filter(e=>e.hits===d).map(e=>e.m);return d===a.length&&1===c.length?c:c.slice(0,4)}function u(s,l){const u=o(s),m=new Date(l.now);if(/messenger|auto-?reply|away message/.test(u)){return{kind:'external',intent:'messenger-autoreply',service:['messenger'],title:'Facebook Messenger auto-reply',label:'Change Messenger auto-reply to:',text:c(s)||`Thanks for getting in touch with ${l.venue}! We'll reply as soon as we can. To book a table, use our app.`}}if(/\b(post|share|publish)\b/.test(u)&&/facebook|instagram|\bfb\b|\binsta|\big\b|social/.test(u)){const e=/facebook|\bfb\b|social/.test(u),t=/instagram|\binsta|\big\b|social/.test(u),a=/special/.test(u)&&l.specials.length?`Tonight at ${l.venue}: ${l.specials.map(e=>e.title.replace(/\s*\(example\)/i,'')).join(' \xb7 ')}. Book in the app or just walk in!`:c(s)||`Tonight at ${l.venue} \u2014 come and see us!`,n=[...e?['facebook']:[],...t?['instagram']:[]];return{kind:'external',intent:'social-post',service:n,title:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}`,label:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}:`,text:a}}if(/(reply|respond|answer|draft).*(e-?mail|gmail|supplier)|(e-?mail|gmail).*(reply|draft)/.test(u)){const e=l.latestSupplierEmail;if(!e)return{kind:'unknown',message:"I can't read your email yet: CoverCharge isn't linked to Gmail. Paste the supplier's message here and I'll draft a reply for you to check and send yourself.",suggestions:[]};const t=`Hi ${e.from.split(' ')[0]},\n\nThanks for letting us know. That's fine for this week \u2014 please keep our usual standing order and let me know if anything changes.\n\nBest wishes,\n${l.venue}`;return{kind:'external',intent:'gmail-reply',service:['gmail'],title:`Gmail reply to ${e.from}`,label:`Reply to "${e.subject}" (${e.from}):`,text:t,detail:`Latest supplier email (example): "${e.body}"`}}if(/\bwix\b|website|web site/.test(u)&&/hour|open|clos/.test(u)){return{kind:'external',intent:'wix-hours',service:['wix'],title:'Website bookings opening hours',label:'Update website bookings opening hours to:',text:[1,2,3,4,5,6,0].map(e=>{const t=l.kitchenHours[e];return`${a[(e+6)%7]}: ${t?`${t[0]}\u2013${t[1]}`:'Closed'}`}).join('\n'),detail:'From the kitchen hours saved in CoverCharge.'}}const h=u.match(/walk-?in\b.*?\b(?:for|of)\s+(\d+|[a-z]+)(?:.*?\btable\s+([a-z]?\d+[a-z]?(?:\+\d+)?))?/)||u.match(/\b(\d+|[a-z]+)\s+walk-?ins?\b(?:.*?\btable\s+([a-z]?\d+))?/);if(h&&!Number.isNaN(d(h[1]))){const t=d(h[1]),a=h[2]?h[2].toUpperCase():'';if(a&&!l.tables.map(e=>e.toUpperCase()).includes(a))return{kind:'unknown',message:`There's no table ${a} on the table plan. Try one of: ${l.tables.slice(0,12).join(', ')}.`,suggestions:[`Add a walk-in for ${t} at table ${l.tables[0]}`]};const n=a?l.bookingsToday.find(e=>e.table?.toUpperCase().split('+').includes(a)&&['seated','confirmed'].includes(e.status)):void 0;return{kind:'inapp',intent:'walkin',title:`Seat a walk-in for ${t}${a?` at table ${a}`:''}`,detail:`Adds \u201cWalk-in \xb7 ${t}\u201d to today's bookings${a?` at table ${a}`:' (table to assign)'} and counts ${t} covers.`,confirmLabel:'Seat walk-in',params:{party:t,table:a},warning:n?`${(0,e.tableNumbers)(a)} also has a ${n.status} booking at ${n.time} (party of ${n.party}).`:void 0}}const b=u.match(/^(?:please )?(?:mark |set |make )?(?:the )?(.+?)\s+(?:as |to )?(?:86'?d?|86ed|sold out)(?=\W|$)/)||u.match(/^86 (?:the )?(.+)$/),f=u.match(/^(?:put |mark |set )?(?:the )?(.+?)\s+(?:back on|as available|available again|un-?86'?d?)/);if((b||f)&&!/walk|book|rota|price/.test(u)){const e=(b||f)[1].replace(/^mark |^set /,''),t=p(l,e),a=!!f&&!b;return 1===t.length?{kind:'inapp',intent:'eightysix',title:a?`Put ${t[0].name} back on`:`Mark ${t[0].name} sold out`,detail:a?'Takes it off the Sold out list and the Display.':'A reminder for staff: it shows on the Display and in the Sold out list until you put it back on. It doesn\'t change your till.',confirmLabel:a?'Back on':'Mark sold out',params:{itemId:t[0].id,name:t[0].name,soldOut:!a}}:t.length>1?{kind:'choose',message:`I couldn't find "${e}" exactly on the menu. Did you mean:`,options:t.map(e=>({label:e.name,prompt:`Mark ${e.name} sold out`}))}:{kind:'unknown',message:`I couldn't find "${e}" on the menu.`,suggestions:['Mark the Fish Supper sold out']}}const k=u.match(/(?:change|set|update|make)\s+(?:the\s+)?(?:price\s+of\s+(?:the\s+)?)?(.+?)\s+(?:price\s+)?to\s+\xa3?\s?(\d+(?:\.\d{1,2})?)/);if(k&&/\xa3|price|\d/.test(u)){const e=p(l,k[1].replace(/\s*price$/,'')),t=Math.round(100*Number(k[2]));if(1===e.length)return{kind:'inapp',intent:'price',title:`Change ${e[0].name} to \xa3${(t/100).toFixed(2)}`,detail:`Now ${null==e[0].price?'board price':`\xa3${(e[0].price/100).toFixed(2)}`}. Updates the menu in the customer app.`,confirmLabel:'Change price',params:{itemId:e[0].id,name:e[0].name,pence:t}};if(e.length>1)return{kind:'choose',message:'Which dish?',options:e.map(e=>({label:e.name,prompt:`Change the price of ${e.name} to \xa3${(t/100).toFixed(2)}`}))}}if(/rota|who'?s on|who is on|working|on shift/.test(u)){let e=(m.getDay()+6)%7,t='today';/tomorrow/.test(u)&&(e=(e+1)%7,t='tomorrow');const o=a.findIndex(e=>u.includes(e.toLowerCase()));o>=0&&(e=o,t=a[o]);const s=l.shifts.filter(t=>t.day===e).sort((e,t)=>e.start-t.start).map(e=>{const t=l.staff.find(t=>t.id===e.staffId);return`${t?.name??'Someone'} (${t?.job??''}) ${n(e.start)}\u2013${n(e.end)}`});return{kind:'inapp',intent:'rota',title:`Show the rota for ${t} (${a[e]})`,detail:'Read-only: looks up the rota saved in CoverCharge. Nothing is changed.',confirmLabel:'Show rota',params:{day:e,label:t,result:s.length?s.join('\n'):'Nobody is on the rota.'}}}if(/booking|covers|reservations?/.test(u)&&!/^(add|make|create)/.test(u)){const t=l.bookingsToday.filter(e=>!['cancelled','noshow'].includes(e.status)),a=t.map(t=>`${t.time} \xb7 ${t.name} \xb7 ${t.party}${t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:''} \xb7 ${t.status}`);return{kind:'inapp',intent:'bookings',title:"Show today's bookings",detail:'Read-only: looks up bookings saved in CoverCharge. Nothing is changed.',confirmLabel:'Show bookings',params:{result:`${t.length} bookings, ${t.reduce((e,t)=>e+t.party,0)} covers\n${a.join('\n')}`}}}if(/(draft|create|write|make|add).*(offer|deal|promo|special)/.test(u)){const e=(s.match(/(?:offer|deal|promo|special)\s+(?:for|on)\s+(.+)$/i)||[])[1]?.trim(),t=e?`${e[0].toUpperCase()}${e.slice(1)}`:'Midweek offer (draft)';return{kind:'inapp',intent:'offer',title:`Draft an offer: ${t}`,detail:'Saved as a draft in Offers & specials (not live, nothing sent). Edit it there before you publish.',confirmLabel:'Save draft',params:{title:t,body:e?`${t} at ${l.venue}. Ask your server for details.`:`A midweek treat at ${l.venue}. Add the details before you publish.`}}}return{kind:'unknown',message:"Sorry \u2014 I can't do that yet. Here are some things I can help with:",suggestions:t.SUGGESTED_PROMPTS.slice(1,6)}}const m={id:'demo',label:'On-device assistant',interpret:async(e,t)=>u(e,t)}},1412,[829,1413]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUGGESTED_PROMPTS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SERVICE_LABEL",{enumerable:!0,get:function(){return t}});const o=['Change our Facebook Messenger auto-reply to "Thanks for your message \u2014 we reply within the hour. To book, use the app."','Draft a reply to the latest supplier email','Add a walk-in for 4 at table 7',"Post tonight's specials to Facebook & Instagram",'Mark the fish pie sold out',"Who's on the rota tomorrow?",'Update website bookings opening hours'],t={facebook:'Facebook',messenger:'Facebook Messenger',instagram:'Instagram',gmail:'Gmail',wix:'Website bookings'}},1413,[]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_TOOLS",{enumerable:!0,get:function(){return o}}),e.callToText=a,e.interpretWithServer=s,Object.defineProperty(e,"xaiProvider",{enumerable:!0,get:function(){return u}});var t=_r(d[0]),n=_r(d[1]);const r=(t,n,r,o=[])=>({type:'function',function:{name:t,description:n,parameters:{type:'object',properties:r,required:o}}}),o=[r('walk_in','Seat a walk-in party now',{party:{type:'integer',description:'Number of covers'},table:{type:'string',description:'Table name, optional'}},['party']),r('sold_out','Mark a dish sold out, or put it back on',{dish:{type:'string',description:'Dish name'},back_on:{type:'boolean',description:'True to put it back on'}},['dish']),r('set_price','Change the menu price of a dish',{dish:{type:'string',description:'Dish name'},pounds:{type:'number',description:'New price in pounds'}},['dish','pounds']),r('show_rota','Show who is on the rota',{day:{type:'string',description:'today, tomorrow or a weekday'}}),r('show_bookings',"Show today's bookings and covers",{}),r('draft_offer','Draft an offer (saved as a draft, not live)',{what:{type:'string',description:'What the offer is for'}})];function a(t,n){const r=t=>String(n[t]??'').trim();switch(t){case'walk_in':return Number(n.party)>0?`walk-in for ${Number(n.party)}${r('table')?` table ${r('table')}`:''}`:null;case'sold_out':return r('dish')?n.back_on?`put ${r('dish')} back on`:`mark ${r('dish')} sold out`:null;case'set_price':return r('dish')&&Number(n.pounds)>0?`change the price of ${r('dish')} to \xa3${Number(n.pounds)}`:null;case'show_rota':return`who's on the rota ${r('day')||'today'}`;case'show_bookings':return"today's bookings";case'draft_offer':return"draft an offer"+(r('what')?` for ${r('what')}`:'');default:return null}}async function s(r,s,u=n.askServer){const c=(0,t.interpretDemo)(r,s);if('unknown'!==c.kind)return c;const p=await u('owner',r,o);if('call'===p.kind){const n=a(p.name,p.args);if(n){const r=(0,t.interpretDemo)(n,s);if('unknown'!==r.kind)return r}return c}return'text'===p.kind?{kind:'unknown',message:p.text,suggestions:[]}:c}const u={id:'xai',label:'Voice assistant (server, with on-device fallback)',interpret:s}},1414,[1412,930]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FAIR_USE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useAssistant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tasksUsed",{enumerable:!0,get:function(){return b}});var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]);const c=300,u=(0,s.create)()((0,l.persist)(e=>({enabled:!0,voice:!0,tier:'pro',baseUsed:41,log:[],set:t=>e(t),record:t=>e(e=>({log:[{...t,id:`as-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`},...e.log].slice(0,200)})),clearLog:()=>e({log:[]})}),{name:'covercharge-assistant-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:(e,t)=>t<2?{...e,enabled:!0,voice:!0}:e})),b=e=>((0,t.examplesAllowed)()?e.baseUsed:0)+e.log.filter(e=>['done','demo (nothing sent)','looked up'].includes(e.outcome)).length},1415,[858,808,815,818]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.InfoHours=function(){const{r:e}=(0,w.useCtx)(6e4),[t,s]=(0,d.useState)(e.tagline),[n,i]=(0,d.useState)(e.phone??''),[a,r]=(0,d.useState)(e.about??''),[o,h]=(0,d.useState)(e.kitchenHours),[g,x]=(0,d.useState)(!1);return(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"info",title:"Edit basic info yourself anytime",children:"Prices, sold-out, hours and specials are free to change on any plan, as often as you like."}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.location}),(0,T.jsx)(p.Field,{label:"Tagline",value:t,onChangeText:s}),(0,T.jsx)(p.Field,{label:"Phone",value:n,onChangeText:i,keyboardType:"phone-pad"}),(0,T.jsx)(p.Field,{label:"About",value:a,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Kitchen hours"}),k.map((e,t)=>{const s=P[t],n=o[s];return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{style:{width:44},children:e}),n?(0,T.jsxs)(p.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>h({...o,[s]:[e,n[1]]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,T.jsx)(p.T,{children:"\u2013"}),(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>h({...o,[s]:[n[0],e]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,T.jsx)(p.Muted,{style:{flex:1},children:"Closed"}),(0,T.jsx)(c.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>h({...o,[s]:e?['12:00','20:00']:null}),trackColor:{true:b.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:b.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,T.jsx)(p.Muted,{children:e.hoursNote}):null]}),(0,T.jsx)(p.Button,{label:"Save changes",onPress:()=>{R().updateRestaurant(e.id,{tagline:t,phone:n,about:a,kitchenHours:o}),x(!0)}}),g?(0,T.jsx)(p.Banner,{kind:"success",title:"Saved",children:"Shared with your other devices and the customer app. Guests see it next time they open the app."}):null]})},_e.Photos=function(){const e=(0,x.useOwner)(e=>e.photos),[t,s]=(0,d.useState)('');return i.LIVE_VENUE_BUILD?(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,T.jsx)(p.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Placeholder photos",children:"Adding photos from the camera or gallery isn\u2019t set up yet. Tiles stand in for uploaded photos."}),(0,T.jsx)(p.Row,{wrap:!0,gap:8,children:e.map(e=>(0,T.jsxs)(u.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,T.jsx)(p.T,{size:13,children:e.caption}),(0,T.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>x.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,T.jsx)(p.T,{size:13,colour:b.colours.gold,children:"Remove"})})]},e.id))}),(0,T.jsx)(p.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,T.jsx)(p.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{x.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:n,role:l}=(0,w.useCtx)(6e4),a=(0,g.useAllMenu)(t),[r,c]=(0,d.useState)(null),[h,x]=(0,d.useState)(!1),[f,m]=(0,d.useState)(5),[C,v]=(0,d.useState)([]),[k,P]=(0,d.useState)('all'),B=(0,g.useStore)(e=>e.menu),O=e=>!!B.find(t=>t.id===e)?.hidden,$=a.filter(e=>!e.signOff&&!O(e.id)).length;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Button,{small:!0,label:"Add dish",onPress:()=>c('new')}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{x(!h),v([])}}),!e||'owner'!==l&&'manager'!==l?null:(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),$?(0,T.jsx)(o.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,T.jsx)(p.Banner,{kind:"warn",title:`${$} dish${1===$?'':'es'} awaiting the head chef's sign-off`,children:"Allergens, section and price come from each dish\u2019s recipe card. The head chef signs cards off in the Head Chef app. Tap to open Recipe cards."})}):null,h?(0,T.jsx)(p.Banner,{kind:"warn",title:"Price changes reset sign-off",children:"Each dish\u2019s price is on its recipe card, so a price change sets that card back to \u201cAwaiting sign-off\u201d until the head chef signs it off."}):null,i.LIVE_VENUE_BUILD?(0,T.jsx)(p.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Scheduled menus"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:"All day",selected:'all'===k,onPress:()=>P('all')}),(0,T.jsx)(p.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>P('lunch')}),(0,T.jsx)(p.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>P('dinner')})]}),(0,T.jsx)(p.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,T.jsxs)(p.Card,{highlight:b.colours.gold,children:[(0,T.jsxs)(p.T,{weight:"semibold",children:["Bulk price edit \xb7 ",C.length," selected"]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Change by %"}),(0,T.jsx)(p.Stepper,{value:f,onChange:m,min:-30,max:30,label:"percent"})]}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>v(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,T.jsx)(p.Button,{small:!0,label:`Apply ${f>0?'+':''}${f}%`,disabled:!C.length||0===f,onPress:()=>{C.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&R().updateMenuItem(e,{price:5*Math.round(t.price*(100+f)/100/5)})}),v([])}})]}),(0,T.jsx)(p.Muted,{children:"Prices round to the nearest 5p."})]}):null,s.sections.map(e=>{const t=a.filter(t=>t.section===e&&('all'===k||'lunch'!==k||!/supper|steak|lobster/i.test(t.name)));return t.length?(0,T.jsxs)(u.default,{style:{gap:6},children:[(0,T.jsx)(y.SectionHead,{title:e}),t.map(e=>(0,T.jsxs)(u.default,{style:[p.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,T.jsx)(p.Toggle,{label:`select ${e.name}`,value:C.includes(e.id),onChange:t=>v(t?[...C,e.id]:C.filter(t=>t!==e.id))}):null,(0,T.jsxs)(o.default,{style:{flex:1},onPress:()=>c(e),accessibilityRole:"button",children:[(0,T.jsx)(p.T,{weight:"medium",children:e.name}),(0,T.jsxs)(p.Muted,{children:[null!=e.price?(0,j.gbp)(e.price):e.priceNote??'Board price'," \xb7 ",Object.keys(e.allergens).length," allergens \xb7 ",e.signOff?`signed off by ${e.signOff.by}, ${e.signOff.at}`:'awaiting sign-off']})]})]}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>(R().updateMenuItem(e.id,{soldOut:!e.soldOut}),(0,S.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,T.jsx)(p.Chip,{label:O(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:O(e.id),onPress:()=>R().updateMenuItem(e.id,{hidden:!O(e.id)})})]})]},e.id))]},e):null}),r?(0,T.jsx)(M,{item:'new'===r?null:r,onClose:()=>c(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:s}=(0,w.useCtx)(6e4),n=(0,g.useEvents)(t).filter(e=>e.restaurantId===t),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[h,x]=(0,d.useState)(null),f=(()=>{const e=a.trim(),t=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(e);if(t){const e=Number(t[1]),s=Number(t[2]);return e>=1&&e<=31&&s>=1&&s<=12?`${t[3]}-${String(s).padStart(2,'0')}-${String(e).padStart(2,'0')}`:''}return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:''})(),j=l.trim().length>2&&!!f&&!Number.isNaN((0,m.parseYmd)(f).getTime());return(0,T.jsxs)(u.default,{style:{gap:10},children:[n.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:t.date=s?(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{g.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),x(null)}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>x(null)})]}):(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>x(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Add an event"}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i,placeholder:"e.g. Seafood night"}),(0,T.jsx)(p.Field,{label:"Date (DD/MM/YYYY)",value:a,onChangeText:r,placeholder:"20/11/2026"}),(0,T.jsx)(p.Field,{label:"Description",value:o,onChangeText:c,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add event",disabled:!j,onPress:()=>{R().addEvent({restaurantId:t,date:f,title:l.trim(),kind:'event',description:o.trim(),example:!1}),i(''),r(''),c('')}}),(0,T.jsx)(p.Muted,{children:"Events show in the customer app\u2019s What\u2019s on and on its booking dates, and feed the forecast."})]})]})},_e.GiftCardsPage=function(){const{rid:e}=(0,w.useCtx)(6e4),n=(0,g.useStore)((0,h.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[l,i]=(0,d.useState)(25),[a,r]=(0,d.useState)(''),o=n.reduce((e,t)=>e+t.initial,0),c=n.reduce((e,t)=>e+t.balance,0);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Sold (all time)"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(o)})]}),(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Outstanding balance"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(c)})]})]}),n.map(e=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,T.jsx)(p.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,T.jsxs)(p.Muted,{children:[e.code," \xb7 ",(0,j.gbp)(e.balance)," of ",(0,j.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,T.jsx)(p.Chip,{label:`\xa3${e}`,selected:l===e,onPress:()=>i(e)},e))}),(0,T.jsx)(p.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,T.jsx)(s.GreensideCashOnly,{}):(0,T.jsx)(p.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,T.jsx)(p.Button,{label:`Issue \xa3${l} card`,disabled:a.trim().length<2,onPress:()=>{R().buyGiftCard(e,100*l,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,w.useCtx)(6e4),t=(0,g.useRatings)(e),[s,n]=(0,d.useState)('all'),l=t.filter(e=>'all'===s||e.stars<=3).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),i=t.length?t.reduce((e,t)=>e+t.stars,0)/t.length:0;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,T.jsxs)(p.Row,{gap:4,children:[(0,T.jsx)(p.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,T.jsx)(p.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,T.jsx)(p.Banner,{kind:"danger",title:"Low-rating alert",children:`${t.filter(e=>e.stars<=2).length} rating(s) at 2\u2605 or below. Reply within 24 hours.`}):null,l.map(e=>(0,T.jsxs)(p.Card,{highlight:e.stars<=2?b.colours.red:void 0,children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.customerName}),(0,T.jsxs)(p.T,{colour:b.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,T.jsx)(p.T,{size:14,children:e.comment||'(no comment)'}),(0,T.jsx)(p.Muted,{children:e.context??''})]},e.id)),(0,T.jsx)(p.Banner,{kind:"info",title:"No review gating",children:"After private feedback, every customer (whatever their rating) is shown the link to leave a public Google review. Low ratings alert you here so you can put it right."}),(0,T.jsx)(p.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return y.DemoTag}}),_e.StampSettings=function(){return i.LIVE_VENUE_BUILD||(0,a.staffServer)()?(0,T.jsx)(r.LoyaltySettingsPanel,{}):(0,T.jsx)(O,{})},_e.Offers=function({go:e}){return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,a.staffServer)()?(0,T.jsx)(p.Banner,{kind:"info",title:"Stamp card offers are in Settings \u203a Advanced \u203a Loyalty",children:"Offers there are saved on the server and shown on every guest\u2019s stamp card. Specials below stay as they were."}):null,(0,T.jsx)(B,{go:e})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),o=e(_r(_d[8])),c=e(_r(_d[9])),u=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),m=_r(_d[17]),b=_r(_d[18]),y=_r(_d[19]),w=_r(_d[20]),S=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]);const k=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],P=[1,2,3,4,5,6,0],R=()=>g.useStore.getState();function M({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,w.useCtx)(6e4),[i,a]=(0,d.useState)(e?.name??''),[r,o]=(0,d.useState)(e?.description??''),[c,u]=(0,d.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,g]=(0,d.useState)(e?.section??l.sections[0]??'Mains'),[x,j]=(0,d.useState)(e?.prepMins??0),m=''===c.trim()?null:Math.round(100*Number(c)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},S=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,T.jsx)(p.Field,{label:"Name",value:i,onChangeText:a}),(0,T.jsx)(p.Field,{label:"Description",value:r,onChangeText:o,multiline:!0}),(0,T.jsx)(p.Field,{label:"Price \xa3 (blank = board price)",value:c,onChangeText:u,keyboardType:"decimal-pad"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,T.jsx)(p.Chip,{label:e,selected:h===e,onPress:()=>g(e)},e))}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Prep time (min)"}),(0,T.jsx)(p.Stepper,{value:x,onChange:j,min:1,max:60,label:"prep minutes"})]}),(0,T.jsx)(p.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[f.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,T.jsx)(p.Badge,{label:'may'===y[e.id]?`May contain ${e.short.toLowerCase()}`:e.short,kind:'may'===y[e.id]?'amber':'red'},e.id)),e&&!Object.keys(y).length?(0,T.jsx)(p.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,T.jsx)(p.Muted,{children:e?e.signOff?`Signed off by ${e.signOff.by} on ${e.signOff.at}.`:'Awaiting sign-off by the head chef.':'Saving adds the dish and its recipe card. Add the ingredients and allergens on the card; the dish stays off the menu until the head chef signs it off.'}),s?(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,S&&e?.signOff?(0,T.jsx)(p.Banner,{kind:"warn",title:"Sign-off resets",children:"Name, price and section live on the recipe card. Changing them sets the card back to \u201cAwaiting sign-off\u201d until the head chef signs it off again."}):null,(0,T.jsx)(p.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?R().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:x}):R().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:x,soldOut:!1,signOff:null}),t()}})]})}function B({go:e}){const{now:t}=(0,w.useCtx)(6e4),s=(0,x.useOwner)(e=>e.offers),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)('special'),[h,g]=(0,d.useState)(null);return(0,T.jsxs)(u.default,{style:{gap:10},children:[s.map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,T.jsxs)(p.Muted,{children:[t.body,t.until?` \xb7 until ${(0,m.niceDate)((0,m.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,T.jsx)(p.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Toggle,{label:"Live in app",value:t.live,onChange:e=>x.useOwner.getState().updateOffer(t.id,{live:e})}),(0,T.jsx)(p.Muted,{children:t.live?'Live in app':'Hidden'}),(0,T.jsx)(u.default,{style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>g(t.id)})]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"New special or offer"}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Chip,{label:"Special",selected:'special'===o,onPress:()=>c('special')}),(0,T.jsx)(p.Chip,{label:"Offer",selected:'offer'===o,onPress:()=>c('offer')})]}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i}),(0,T.jsx)(p.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add",disabled:l.trim().length<3,onPress:()=>{x.useOwner.getState().addOffer({title:l.trim(),body:a.trim(),kind:o,live:!0}),i(''),r('')}})]}),h?(()=>{const e=s.find(e=>e.id===h);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:()=>g(null),title:"Push notification composer",children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,T.jsxs)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,T.jsx)(p.Muted,{children:"CoverCharge \xb7 now"}),(0,T.jsx)(p.T,{weight:"semibold",children:e.title}),(0,T.jsx)(p.T,{size:14,children:e.body})]}),(0,T.jsxs)(p.Muted,{children:["Audience: customers who opted in to ",(0,v.venueInfo)().name," offers. No audience count is available."]}),(0,T.jsx)(p.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{x.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,m.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),g(null)}})]})})():null]})}function O(){const{r:e}=(0,w.useCtx)(6e4),t=e.settings,[s,n]=(0,d.useState)(t.stampReward);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Stamp card"}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Stamps for a reward"}),(0,T.jsx)(p.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>R().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Minimum spend"}),(0,T.jsx)(p.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>R().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,T.jsxs)(p.Muted,{children:[(0,j.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,T.jsx)(p.Field,{label:"Reward",value:s,onChangeText:n}),(0,T.jsx)(p.Button,{small:!0,label:"Save reward",onPress:()=>R().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,T.jsx)(u.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:b.colours.gold,backgroundColor:t<3?b.colours.gold:'transparent'}},t))}),(0,T.jsxs)(p.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1416,[5,1341,798,796,806,1205,1363,34,402,410,102,853,794,848,865,830,836,827,840,1147,1100,1135,1366,1166,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1417,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandingSettings=function(){const{rid:e,r:t}=(0,h.useCtx)(6e4),p=(0,l.useBrand)(e),x=(0,c.useOwner)(e=>e.setBranding),[j,f]=(0,r.useState)(''),y=(0,c.useOwner)(o=>o.branding[e]?.recent)??[],[w,C]=(0,r.useState)(p.accent);(0,r.useEffect)(()=>{C(p.accent)},[p.accent]);const v=(0,r.useMemo)(()=>(0,a.checkAccent)(w,u.colours.bg,u.colours.onGold,u.colours.text),[w]);return(0,b.jsxs)(n.default,{style:{gap:10},children:[(0,b.jsx)(d.Muted,{children:"Your logo, name and accent colour lead every CoverCharge app: Managers, Staff, Display, Head Chef and the customer app. A small \u201cpowered by CoverCharge\u201d stays at the top left."}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Customer header preview"}),(0,b.jsxs)(n.default,{testID:"branding-preview",style:{backgroundColor:u.colours.bg,borderRadius:12,borderWidth:1,borderColor:u.colours.border,padding:12,gap:4},children:[(0,b.jsx)(l.PoweredBy,{}),(0,b.jsxs)(d.Row,{gap:10,children:[(0,b.jsx)(l.RestaurantLogo,{rid:e,size:52}),(0,b.jsxs)(n.default,{style:{flex:1},children:[(0,b.jsx)(d.T,{weight:"semibold",size:18,children:t.name}),(0,b.jsx)(d.T,{size:12,colour:v.accentText,children:t.location})]})]}),(0,b.jsx)(n.default,{testID:"branding-preview-button",style:{marginTop:8,backgroundColor:w,borderRadius:10,paddingVertical:10,alignItems:'center'},children:(0,b.jsx)(d.T,{weight:"semibold",colour:v.onAccent,children:"Book a table"})})]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Logo"}),(0,b.jsxs)(d.Muted,{children:[p.custom?'Your uploaded logo.':'anchorage'===e?'Built in: The Anchorage logo in black and gold.':l.BUILTIN_LOGOS[e]?`Built in: ${t.name} logo.`:'Built in: placeholder initials for this demo venue.'," Square images work best."]}),(0,b.jsxs)(d.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(d.Button,{label:"Upload a logo",onPress:async()=>{const r=await o.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(r.canceled||!r.assets?.[0])return;const t=r.assets[0],n=t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri;x(e,{logoUri:n}),f('Logo updated in all apps on this device.')},testID:"branding-upload"}),p.custom?(0,b.jsx)(d.Button,{kind:"secondary",label:"Use the built-in logo",onPress:()=>{x(e,{logoUri:void 0}),f('Back to the built-in logo.')}}):null]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Accent colour"}),(0,b.jsx)(d.Muted,{children:"Any colour you like for your own brand. The preview above changes as you drag."}),(0,b.jsx)(s.ColourPicker,{value:w,onChange:C,onCommit:o=>{o===p.accent&&y[0]===o||(x(e,{accent:o,recent:(0,a.pushRecent)(y,o)}),f(`Accent set to ${o}.`))},quick:l.ACCENTS,recent:y}),v.tips.length?(0,b.jsx)(n.default,{testID:"accent-tip",style:{borderWidth:1,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg,borderRadius:10,padding:10,gap:4},children:v.tips.map(e=>(0,b.jsx)(d.T,{size:13,colour:u.colours.amber,children:e},e))}):null,(0,b.jsx)(d.Muted,{children:"Used for the restaurant line in headers, the logo ring and main buttons. Text on it is picked to stay readable."})]}),j?(0,b.jsx)(d.Banner,{kind:"success",title:"Saved",children:j}):null,(0,b.jsx)(d.Button,{kind:"ghost",label:"Restore default branding",onPress:()=>{x(e,null),f('Default branding restored.')}}),(0,b.jsx)(d.Muted,{children:"Saved the same way as your logo: on this device, shared by all the apps on it. Nothing is uploaded."})]})};var e,o=(function(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(r){if('default'!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),o.default=e,o})(_r(_d[0])),r=_r(_d[1]),t=_r(_d[2]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),b=_r(_d[10])},1418,[1061,34,102,1419,799,847,794,865,840,1100,25]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ColourPicker=function({value:e,onChange:p,onCommit:v,quick:y,recent:w}){const[R,C]=(0,t.useState)(()=>(0,c.hexToHsv)(e)),[H,T]=(0,t.useState)(e),[S,M]=(0,t.useState)(!1),F=(0,t.useRef)(e);(0,t.useEffect)(()=>{(0,c.normaliseHex)(e)!==(0,c.normaliseHex)(F.current)&&(F.current=e,C((0,c.hexToHsv)(e)),T(e))},[e]);const k=e=>{C(e);const o=(0,c.hsvToHex)(e);F.current=o,T(o),M(!1),p(o)},D=(0,t.useMemo)(()=>(0,c.hsvToHex)({h:R.h,s:R.s,v:1}),[R.h,R.s]),E=(0,t.useMemo)(()=>f.map(e=>(0,c.hsvToHex)({h:e,s:1,v:1})),[]),I=e=>{const o=(0,c.normaliseHex)(e);o&&(F.current=o,C((0,c.hexToHsv)(o)),T(o),M(!1),p(o),v(o))},z=(o,t,n)=>(0,x.jsx)(s.default,{testID:`accent-${n}-${t}`,accessibilityRole:"button",accessibilityLabel:`Accent ${o}`,onPress:()=>I(o),hitSlop:4,style:{width:40,height:40,borderRadius:20,backgroundColor:o,borderWidth:3,borderColor:(0,c.normaliseHex)(e)===(0,c.normaliseHex)(o)?u.colours.text:u.colours.border}},n+o+t);return(0,x.jsxs)(n.default,{testID:"colour-picker",style:{gap:10},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Drag across for the colour, up and down for how strong it is"}),(0,x.jsxs)(b,{testID:"picker-area",label:"Colour and strength",height:170,onMove:(e,o)=>k({h:360*e,s:1-o,v:R.v}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:[(0,x.jsxs)(l.Defs,{children:[(0,x.jsx)(l.LinearGradient,{id:"cpHue",x1:"0",y1:"0",x2:"1",y2:"0",children:E.map((e,o)=>(0,x.jsx)(l.Stop,{offset:o/(E.length-1),stopColor:e},o))}),(0,x.jsxs)(l.LinearGradient,{id:"cpSat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#FFFFFF",stopOpacity:0}),(0,x.jsx)(l.Stop,{offset:1,stopColor:"#FFFFFF",stopOpacity:1})]})]}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpHue)"}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpSat)"})]}),(0,x.jsx)(j,{x:R.h/360*100+"%",y:100*(1-R.s)+"%",colour:D})]}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Brightness"}),(0,x.jsxs)(b,{testID:"picker-brightness",label:"Brightness",height:36,onMove:e=>k({...R,v:Math.max(.04,e)}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 10",children:[(0,x.jsx)(l.Defs,{children:(0,x.jsxs)(l.LinearGradient,{id:"cpVal",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#000000"}),(0,x.jsx)(l.Stop,{offset:1,stopColor:D})]})}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"10",fill:"url(#cpVal)"})]}),(0,x.jsx)(j,{x:100*R.v+"%",y:"0%",colour:(0,c.hsvToHex)(R),round:!1})]}),(0,x.jsxs)(h.Row,{gap:10,style:{alignItems:'center'},children:[(0,x.jsx)(n.default,{testID:"picker-swatch",style:{width:46,height:46,borderRadius:10,backgroundColor:(0,c.normaliseHex)(H)??e,borderWidth:1,borderColor:u.colours.border}}),(0,x.jsxs)(n.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Hex code"}),(0,x.jsx)(o.TextInput,{testID:"picker-hex",value:H,autoCapitalize:"characters",autoCorrect:!1,maxLength:7,placeholder:"#CFA45F",placeholderTextColor:u.colours.muted,accessibilityLabel:"Hex code",onChangeText:e=>{T(e);const o=(0,c.normaliseHex)(e);M(!o&&e.replace('#','').length>=6),o&&6===e.replace('#','').length&&(F.current=o,C((0,c.hexToHsv)(o)),p(o))},onBlur:()=>{const e=(0,c.normaliseHex)(H);e?I(e):(T(F.current),M(!1))},onSubmitEditing:()=>{const e=(0,c.normaliseHex)(H);e?I(e):M(!0)},style:{minHeight:46,borderRadius:10,borderWidth:1,borderColor:S?u.colours.amber:u.colours.accentBorder,backgroundColor:u.colours.surface2,color:u.colours.text,paddingHorizontal:12,fontSize:16}})]})]}),S?(0,x.jsx)(h.T,{size:13,colour:u.colours.amber,children:"Use six letters or numbers after #, like #CFA45F."}):null,(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Quick picks"}),(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:y.map((e,o)=>z(e,o,'quick'))}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Recent colours"}),w.length?(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:w.map((e,o)=>z(e,o,'recent'))}):(0,x.jsx)(h.Muted,{children:"Colours you choose show here."})]})};var o=r(d[0]),t=r(d[1]);r(d[2]);var s=e(r(d[3])),n=e(r(d[4])),l=r(d[5]),i=e(l),c=r(d[6]),u=r(d[7]),h=r(d[8]),x=r(d[9]);const p={touchAction:'none',cursor:'crosshair',userSelect:'none'},f=[0,30,60,90,120,150,180,210,240,270,300,330,360];function b({height:e,onMove:o,onEnd:s,children:l,testID:i,label:c}){const h=(0,t.useRef)({w:1,h:e}),f=e=>{const{locationX:t,locationY:s}=e.nativeEvent;o(Math.min(1,Math.max(0,t/h.current.w)),Math.min(1,Math.max(0,s/h.current.h)))};return(0,x.jsx)(n.default,{testID:i,accessibilityLabel:c,onLayout:e=>{h.current={w:Math.max(1,e.nativeEvent.layout.width),h:Math.max(1,e.nativeEvent.layout.height)}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:f,onResponderMove:f,onResponderRelease:s,onResponderTerminate:s,style:[{height:e,borderRadius:10,overflow:'hidden',borderWidth:1,borderColor:u.colours.border},p],children:(0,x.jsx)(n.default,{pointerEvents:"none",style:{flex:1},children:l})})}const j=({x:e,y:o,colour:t,round:s=!0})=>(0,x.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:e,top:o,width:26,height:s?26:'100%',marginLeft:-13,marginTop:s?-13:0,borderRadius:s?13:6,borderWidth:3,borderColor:u.colours.text,backgroundColor:t,shadowColor:'#000',shadowOpacity:.6,shadowRadius:3}})},1419,[796,34,236,402,102,900,799,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.RecipeCardsPage=function(){const{rid:c,role:u,me:f}=(0,o.useCtx)(),_=(0,o.useSignedIn)(),l='owner'===u?'owner':'manager'===u?'manager':'staff';return(0,s.jsx)(t.RecipeCards,{rid:c,actor:(0,n.cardActorFor)(f,l,_),mode:'staff'===l?'read':'edit'})},r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4])},1420,[34,1132,832,1100,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:c,role:s,me:u,meId:l,today:p}=(0,t.useCtx)(6e4),_='owner'===s||'manager'===s;return(0,o.jsx)(n.CashUpScreen,{rid:c,today:p,canEdit:_,who:{id:l??'me',name:u.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),t=r(d[2]),o=r(d[3])},1421,[34,1048,1100,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1422,[34,1316,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=y,_e.SpendPerHeadPage=function(){const{rid:e,today:s}=(0,c.useCtx)(6e4),a=(0,r.useBookings)(e),n=(0,o.useCashUp)(e=>e.cashUps),[b,j]=(0,t.useState)('day'),k=(0,d.hasAnyTakings)(n,e),w=(0,d.dayRows)(n,a,e,s,14),f=(0,d.weekRows)(n,a,e,s,8),v=(0,d.averageSph)(w),$=(e,t,s,a,n)=>(0,u.jsxs)(l.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:h.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${t}: ${'No takings entered'===a?'no takings entered':`spend per head ${a}`}, ${s}${n?`, ${n}`:''}`,children:[(0,u.jsx)(i.T,{center:!0,children:t}),(0,u.jsx)(i.T,{center:!0,colour:h.colours.muted,children:s}),(0,u.jsx)(i.T,{center:!0,weight:"semibold",colour:'No takings entered'===a?h.colours.muted:h.colours.goldLight,size:'No takings entered'===a?13:16,children:a}),n?(0,u.jsx)(i.Muted,{center:!0,children:n}):null]},e);return(0,u.jsxs)(l.default,{style:{gap:12},testID:"sph-screen",children:[(0,u.jsx)(i.Muted,{children:"Tip: spend per head is Gross takings \xf7 Covers. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,u.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,u.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==v?(0,u.jsx)(i.T,{size:22,weight:"semibold",colour:h.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,u.jsxs)(i.T,{size:34,weight:"bold",colour:h.colours.goldLight,testID:"sph-avg",children:[p(v)," ",(0,u.jsx)(i.T,{size:16,colour:h.colours.muted,children:"per head"})]}),(0,u.jsx)(i.Muted,{children:k?'Only days with gross takings entered are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has Gross takings.'})]}),(0,u.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(i.Chip,{testID:"sph-day",label:"By day",selected:'day'===b,onPress:()=>j('day')}),(0,u.jsx)(i.Chip,{testID:"sph-week",label:"By week",selected:'week'===b,onPress:()=>j('week')})]}),'day'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by day"}),(0,u.jsx)(y,{testID:"sph-trend-day",label:"Spend per head trend by day",points:w.map(e=>({label:x(e.date),value:e.sph}))}),[...w].reverse().map(e=>$(e.date,x(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':p(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${p(e.foodPh)}, drink ${p(e.drinkPh)} per head`:void 0))]}):null,'week'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,u.jsx)(y,{testID:"sph-trend-week",label:"Spend per head trend by week",points:f.map(e=>({label:`w/c ${x(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...f].reverse().map(e=>$(e.weekStart,`w/c ${x(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':p(e.sph)))]}):null,(0,u.jsx)(i.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var t=_r(_d[0]),s=e(t),l=e(_r(_d[1])),a=_r(_d[2]),n=e(a),i=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,x=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function y({points:e,testID:r,label:o}){const[d,c]=(0,t.useState)(320),[x,y]=(0,t.useState)(e.length);(0,t.useEffect)(()=>y(e.length),[e.length,r]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,x)),k=Math.max(0,j-b),w=e.slice(k,j),f=Math.max(140,d-68),v=e.map(e=>e.value).filter(e=>null!=e),$=Math.max(5,5*Math.ceil(Math.max(0,...v)/5)),T=e=>38+e*(f-76)/Math.max(1,w.length-1),S=e=>140-e/$*106,L=[];let D=[];w.forEach((e,t)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:t,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${p(e.value)}`).join(', ');return(0,u.jsxs)(l.default,{testID:r,onLayout:e=>c(e.nativeEvent.layout.width),style:{gap:8},children:[(0,u.jsxs)(l.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,u.jsx)(n.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,u.jsx)(a.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:h.colours.muted,children:p($*e/4)},e))}),(0,u.jsxs)(n.default,{width:f,height:170,children:[[0,1,2,3,4].map(e=>(0,u.jsx)(a.Line,{x1:0,x2:f,y1:S($*e/4),y2:S($*e/4),stroke:h.colours.border,strokeWidth:1},e)),L.map((e,t)=>(0,u.jsx)(a.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:h.colours.gold,strokeWidth:2.5},t)),w.map((e,t)=>(0,u.jsx)(s.default.Fragment,{children:null==e.value?(0,u.jsx)(a.Circle,{cx:T(t),cy:140,r:2,fill:"#444"}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Circle,{cx:T(t),cy:S(e.value),r:4,fill:h.colours.goldLight}),(0,u.jsx)(a.Text,{x:T(t),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:h.colours.goldLight,children:p(e.value)})]})},k+t))]})]}),(0,u.jsx)(l.default,{style:{flexDirection:'row',gap:12},children:w.map((e,t)=>(0,u.jsxs)(l.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':p(e.value)}`,children:[(0,u.jsx)(i.T,{center:!0,size:12,colour:h.colours.muted,children:e.label}),(0,u.jsx)(i.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?h.colours.muted:h.colours.goldLight,children:null==e.value?'No takings entered':p(e.value)})]},k+t))}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===k,onPress:()=>y(Math.max(b,j-b))}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Later",accessibilityLabel:"Later spend per head chart points",disabled:j>=e.length,onPress:()=>y(Math.min(e.length,j+b))})]})]})}},1423,[34,102,900,794,848,1024,1424,840,1100,25]); -__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COUNTED",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"serviceOfBooking",{enumerable:!0,get:function(){return o}}),e.coversOn=d,e.dayRows=i,e.weekRows=function(n,t,s,o,d){const u=(0,r.weekStartOf)(o);return Array.from({length:d},(l,f)=>{const h=(0,r.addDaysYmd)(u,7*(f-d+1)),m=i(n,t,s,(0,r.addDaysYmd)(h,6),7).filter(r=>r.date<=o&&null!=r.gross),p=m.length?Math.round(100*m.reduce((r,n)=>r+n.gross,0))/100:null,v=m.reduce((r,n)=>r+n.covers,0);return{weekStart:h,gross:p,covers:v,days:m.length,sph:c(p,v)}})},e.serviceRows=function(n,t,s,o,i,l=1020){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r])),h=[];for(let n=0;nnull!=r.gross&&r.covers>0);return n.length?c(n.reduce((r,n)=>r+n.gross,0),n.reduce((r,n)=>r+n.covers,0)):null},Object.defineProperty(e,"hasAnyTakings",{enumerable:!0,get:function(){return l}});var r=_r(_d[0]);const n=['seated','finished'],t=r=>n.includes(r.status),s=r=>{const[n,t]=r.split(':').map(Number);return 60*n+(t||0)},o=(r,n)=>s(r.time)r.restaurantId===n&&r.date===s&&t(r)&&(!d||o(r,u)===d)).reduce((r,n)=>r+(n.partySize||0),0)}const u=r=>'number'==typeof r&&Number.isFinite(r)?r:null,c=(r,n)=>null==r||n<=0?null:Math.round(r/n*100)/100;function i(n,t,s,o,i){const l=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,f)=>{const h=(0,r.addDaysYmd)(o,f-i+1),m=l.get(h)?.vals??{},p=(0,r.grossOf)(m),v=d(t,s,h),y=u(m.food),b=u(m.drink);return{date:h,gross:p,covers:v,sph:c(p,v),food:y,drink:b,foodPh:c(y,v),drinkPh:c(b,v)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.grossOf)(n.vals))},1424,[13]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1425,[34,793,1100,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(W,{})},_e.Merch=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(X,{})},_e.TablesQr=function({go:e}={}){const{rid:s,r:t,now:r,me:a}=(0,A.useCtx)(1e4);return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(l.StaffTableOrders,{rid:s,me:a}),(0,V.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(t)?(0,V.jsx)(q,{rid:s,now:r,me:a}):(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:s,r:t,now:r}=(0,A.useCtx)(3e4),n=(0,T.useOrders)(s),a=t.settings,l=(0,P.takeawaySlots)(t,n,r).slice(0,10),i=e=>_().updateSettings(s,e),o=n.filter(e=>'takeaway'===e.type&&(0,B.LIVE)(e));return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:a.takeawayPaused?I.colours.red:I.colours.ok,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:a.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,V.jsx)(v.Toggle,{label:"Takeaway on",value:!a.takeawayPaused,onChange:e=>i({takeawayPaused:!e})})]}),(0,V.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Slot length (min)"}),(0,V.jsx)(v.Stepper,{value:a.slotMinutes,min:5,max:30,onChange:e=>i({slotMinutes:e}),label:"slot minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Orders per slot"}),(0,V.jsx)(v.Stepper,{value:a.slotCap,min:1,max:20,onChange:e=>i({slotCap:e}),label:"orders per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,V.jsx)(v.Stepper,{value:a.leadMins,min:5,max:60,onChange:e=>i({leadMins:e}),label:"lead minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,V.jsx)(v.Stepper,{value:a.bufferMins,min:0,max:20,onChange:e=>i({bufferMins:e}),label:"buffer minutes"})]}),(0,V.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Next slots"}),l.map(e=>(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{size:14,children:e.label}),(0,V.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:I.colours.border,borderRadius:4},children:(0,V.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?I.colours.red:I.colours.gold,borderRadius:4}})}),(0,V.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,V.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,V.jsxs)(v.Muted,{children:[e.slotTime?(0,O.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,B.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:r,r:n}=(0,A.useCtx)(6e4),a=n.settings,l=(0,S.useOwner)(e=>e.reminders),i=e=>_().updateSettings(r,e),o=e=>S.useOwner.getState().setOwner({reminders:{...l,...e}});return(0,V.jsxs)(w.default,{style:{gap:10},children:[s.IS_GREENSIDE?(0,V.jsx)(t.GreensideCashOnly,{}):(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,V.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(a);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,V.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,V.jsx)(v.Toggle,{label:"24h reminder",value:l.h24,onChange:e=>o({h24:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,V.jsx)(v.Toggle,{label:"2h reminder",value:l.h2,onChange:e=>o({h2:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,V.jsx)(v.Toggle,{label:"confirm",value:l.confirmText,onChange:e=>o({confirmText:e})})]}),(0,V.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,V.jsx)(v.Stepper,{value:a.bookingCoversPerSlot,min:2,max:60,onChange:e=>i({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Typical table turn (min)"}),(0,V.jsx)(v.Stepper,{value:a.turnMins,min:30,max:180,onChange:e=>i({turnMins:e}),label:"turn minutes"})]}),(0,V.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,V.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:s,today:t,role:r,me:n}=(0,A.useCtx)(1e4),[a,l]=(0,x.useState)(null),i=(0,T.useOrders)(s),o=(0,T.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===s&&e.date===t))),d=(0,T.useAudit)(s).filter(e=>'allergy'===e.kind),c=(0,z.useUnsignedDishes)(s),h=(0,T.useStore)(e=>e.bookings),u=i.filter(e=>(0,B.LIVE)(e)&&(0,D.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i.filter(B.LIVE))).length,g=(0,A.useSignedIn)(),p=(0,F.cardActorFor)(n,'owner'===r?'owner':'manager'===r?'manager':'staff',g);if('unsigned'===a)return(0,V.jsx)(z.UnsignedDishList,{rid:s,actor:p,onClose:()=>l(null),onOpenCards:()=>e('more','recipecards')});if('pending'===a)return(0,V.jsx)(K,{go:e,onClose:()=>l(null)});const b={flex:1,minHeight:48};return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>l('pending'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?I.colours.red:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,V.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>l('unsigned'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?I.colours.amber:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,V.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,V.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,V.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,V.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,V.jsxs)(v.Muted,{children:[(0,O.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,V.jsx)(v.Muted,{children:"No allergy events yet."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,V.jsx)(w.default,{style:{gap:10},children:(0,V.jsxs)(v.Card,{highlight:I.colours.gold,style:{alignItems:'center'},children:[(0,V.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:I.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,V.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,V.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,V.jsx)(v.T,{size:20,weight:"bold",colour:I.colours.gold,children:"CoverCharge for Display"}),(0,V.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:s,r:t}=(0,A.useCtx)(6e4),r=(0,d.useLiveVenue)(),n=s=>s.startsWith('tab:')?e(s.slice(4)):e('more',s),a=e=>e.startsWith('tab:')?'tab:forecast'!==e||S.CAN.forecasts(s):(()=>{const t=L.PAGES.find(s=>s.id===e);return!!t&&(!t.can||t.can(s))})();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:I.colours.gold,children:[(0,V.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(t)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,s,t])=>(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"medium",children:e}),(0,V.jsx)(v.Muted,{children:s})]}),(0,V.jsx)(v.Badge,{kind:'This app'===t?'ok':'gold',label:t})]},e)),'owner'===s?(0,V.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{S.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,V.jsx)(v.Muted,{children:r?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,V.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...Y].filter(e=>4!==e.n||(0,M.orderAtTableOn)(t)).sort((e,s)=>e.n-s.n).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(v.T,{weight:"bold",colour:I.colours.gold,style:{width:26},children:[e.n,"."]}),(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"semibold",children:e.title}),(0,V.jsx)(v.Muted,{children:e.note})]})]}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>a(e)).map(([e,s])=>(0,V.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>n(s)},s))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"card"}):(0,V.jsx)(G,{})},_e.Referrals=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"referrals"}):(0,V.jsx)(H,{})};var s=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),I=_r(_d[30]),B=_r(_d[31]),A=_r(_d[32]),N=_r(_d[33]),$=_r(_d[34]),L=_r(_d[35]),D=_r(_d[36]),E=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),V=_r(_d[41]);const _=()=>T.useStore.getState();function G(){const{rid:e,r:t,me:n}=(0,A.useCtx)(3e4),a=t.settings,l=(0,T.useStore)((0,k.useShallow)(s=>s.stampCards.filter(s=>s.restaurantId===e))),i=(0,T.useStore)(e=>e.customer.name),o=(0,T.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,x.useMemo)(()=>(0,N.crmCustomers)(),[]),[c,h]=(0,x.useState)(a.stampReward),[u,g]=(0,x.useState)('');(0,x.useEffect)(()=>{(0,$.examplesAllowed)()&&e===s.VENUE_RID&&!l.some(e=>e.customerId.startsWith('cr-'))&&T.useStore.setState(s=>({stampCards:[...s.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((s,t)=>({restaurantId:e,customerId:s.id,stamps:s.stamps%a.stampTarget,rewardsAvailable:t%5==0?1:0,history:[{at:'2026-10-20',source:t%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(s=>s.id===e)?.name??(e===T.useStore.getState().customer.id?i||'Guest':e),b=l.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,s)=>s.stamps-e.stamps),m=(0,$.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(m?31:0);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Active cards"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.length})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Rewards ready"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.reduce((e,s)=>e+s.rewardsAvailable,0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Redeemed"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,V.jsx)(v.Muted,{children:m?'all time (example)':'all time'})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Stamps for a reward"}),(0,V.jsx)(v.Stepper,{value:a.stampTarget,min:3,max:15,onChange:s=>_().updateSettings(e,{stampTarget:s}),label:"stamps"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Min spend \xa3"}),(0,V.jsx)(v.Stepper,{value:a.stampMinSpend/100,min:0,max:50,onChange:s=>_().updateSettings(e,{stampMinSpend:100*s}),label:"minimum spend"})]}),(0,V.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,V.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>_().updateSettings(e,{stampReward:c.trim()||a.stampReward})}),(0,V.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,V.jsx)(B.SectionHead,{title:"Members"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),b.map(s=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(s.customerId)}),s.rewardsAvailable?(0,V.jsx)(v.Badge,{kind:"ok",label:`${s.rewardsAvailable} reward ready`}):null]}),(0,V.jsx)(v.Row,{gap:4,children:Array.from({length:a.stampTarget},(e,t)=>(0,V.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:te.source))).join(', ')||'\u2013']}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>_().addStamp(e,s.customerId,`Manual (${n})`)}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!s.rewardsAvailable,onPress:()=>_().redeemReward(e,s.customerId)})]})]},s.customerId))]})}function H(){const e=(0,S.useOwner)(e=>e.referral),s=(0,S.useOwner)(e=>e.referrals),[t,r]=(0,x.useState)(e.giverReward),[n,a]=(0,x.useState)(e.friendReward),l=e=>s.filter(s=>s.status===e).length,i=(0,$.examplesAllowed)();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[i?(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Invites sent"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,V.jsx)(v.Muted,{children:"example"})]}):null,(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sign-ups"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:s.length+(i?23:0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Ordered"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l('first order')+l('rewarded')+(i?9:0)})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,V.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:s=>S.useOwner.getState().setOwner({referral:{...e,active:s}})})]}),(0,V.jsx)(v.Field,{label:"Reward for the customer who invites",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Reward for the friend (first order)",value:n,onChangeText:a}),(0,V.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>S.useOwner.getState().setOwner({referral:{...e,giverReward:t.trim(),friendReward:n.trim()}})}),(0,V.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,V.jsx)(B.SectionHead,{title:"Referrals"}),s.map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,V.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,V.jsx)(v.Muted,{children:e.at})]},e.id))]})}function Q(){const{me:e}=(0,A.useCtx)(6e4),s=(0,A.useSignedIn)();return(0,V.jsx)(p.GiftCardsPage,{me:(s?.name??e).replace(' (example)','')})}function W(){const{rid:e,me:s}=(0,A.useCtx)(6e4),t=(0,T.useStore)((0,k.useShallow)(s=>s.giftCards.filter(s=>s.restaurantId===e))),[n,a]=(0,x.useState)(25),[l,i]=(0,x.useState)(''),[o,d]=(0,x.useState)(''),[c,h]=(0,x.useState)(''),[u,g]=(0,x.useState)(''),[p,b]=(0,x.useState)(''),[m,f]=(0,x.useState)(null),j=t.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=t.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sold"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.initial,0))})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Outstanding"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.balance,0))})]})]}),m?(0,V.jsx)(v.Banner,{kind:"success",title:m}):null,(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,V.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"No card with that code."}):null,(0,V.jsx)(v.Field,{label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{_().redeemGiftCard(o,Math.round(100*Number(c)),s)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,V.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,V.jsx)(v.Field,{label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const t=_().honourLegacyCard(e,u,Math.round(100*Number(p)),s);f(`Website bookings card ${t.code} honoured`),d(t.code),g(''),b('')}})]}):null]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,V.jsx)(v.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>a(e)},e))}),(0,V.jsx)(v.Field,{label:"Recipient",value:l,onChangeText:i}),(0,V.jsx)(v.Button,{label:`Record a \xa3${n} card paid at the till`,disabled:l.trim().length<2,onPress:()=>{const s=_().buyGiftCard(e,100*n,l.trim(),'Sold at the till');f(`Created ${s.code}`),i('')}}),(0,V.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,V.jsx)(B.SectionHead,{title:"All cards"}),t.map(e=>(0,V.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,V.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,V.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function q({rid:e,now:s,me:t}){const r=(0,T.useOrders)(e).filter(e=>'table'===e.type),[n,l]=(0,x.useState)(null),i=(0,m.useTableUse)(e,s),o=(0,m.useTableNames)(e);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,V.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const s=r.filter(s=>s.tableNo===e&&(0,B.LIVE)(s)),t=s.reduce((e,s)=>e+s.total-s.paid,0);return(0,V.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,a.tableNumbers)(e)}`,onPress:()=>l(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:s.length?I.colours.gold:I.colours.border,backgroundColor:I.colours.surface,gap:2},children:[(0,V.jsx)(v.T,{weight:"bold",children:(0,a.tableNumbers)(e)}),(0,V.jsx)(v.T,{size:12,colour:i[e]?.busy?'#FFD9D4':'#E2C489',children:i[e]?.busy?i[e].label:'Free'}),(0,V.jsx)(v.Muted,{children:s.length?`${s.length} order${s.length>1?'s':''}`:'No orders'}),t?(0,V.jsxs)(v.T,{size:12,colour:I.colours.amber,children:[(0,R.gbp)(t)," to pay"]}):(0,V.jsx)(v.T,{size:12,colour:I.colours.muted,children:"View QR"})]},e)})}),(0,V.jsx)(B.SectionHead,{title:"Live table orders"}),r.filter(B.LIVE).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:[(0,a.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,V.jsx)(v.Badge,{kind:(0,B.statusKind)(e.status),label:(0,B.statusLabel)(e)})]}),(0,V.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,O.minsBetween)(new Date(e.createdAt),s)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),r.filter(B.LIVE).length?null:(0,V.jsx)(v.Muted,{children:"No live table orders."}),n?(0,V.jsxs)(v.Sheet,{visible:!0,onClose:()=>l(null),title:`${(0,a.tableNumbers)(n)} QR code`,children:[(0,V.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,V.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${n}`,size:200})}),(0,V.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",n]}),(0,V.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,V.jsx)(v.Button,{label:`Preview customer table ordering (${(0,a.tableNumbers)(n)})`,onPress:()=>{const e=n;l(null),j.router.push(`/table/${e}`)}}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>l(n)})]}):null]})}function K({go:e,onClose:s}){const{rid:t,today:r,role:n}=(0,A.useCtx)(1e4),a=(0,T.useOrders)(t),l=(0,T.useStore)(e=>e.bookings);(0,E.useBackLayer)(!0,s);const i=a.filter(B.LIVE),o=[...i.filter(e=>(0,D.chainNeedsAction)(e,l)).map(e=>{const s=(0,D.nextStep)(e,(0,D.linkedBooking)(e,l)),t=D.CHAIN_STEPS.find(e=>e.id===s);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,O.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:t?`Next: ${t.n}. ${t.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...l.filter(e=>e.restaurantId===t&&e.date===r&&'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,s)=>e.at.localeCompare(s.at));return(0,V.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,V.jsx)(E.BackButton,{onPress:s,testID:"pending-back"}),(0,V.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:I.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,V.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(s=>(0,V.jsxs)(v.Card,{highlight:I.colours.red,style:{alignItems:'center',gap:8},children:[(0,V.jsxs)(w.default,{testID:`pending-row-${s.id}`,accessible:!0,accessibilityLabel:`${s.title}, ${s.when}, allergies: ${s.allergies}. ${s.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,V.jsx)(v.T,{center:!0,weight:"bold",size:18,children:s.title}),(0,V.jsx)(v.T,{center:!0,children:s.when}),(0,V.jsxs)(v.Muted,{center:!0,children:["Allergies: ",s.allergies]}),(0,V.jsx)(v.T,{center:!0,colour:I.colours.gold,children:s.next})]}),(0,V.jsx)(v.Button,{small:!0,label:s.open,onPress:()=>e(s.tab),style:{alignSelf:'stretch'}})]},s.id)),'owner'===n||'manager'===n?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function X(){const e=(0,S.useOwner)(e=>e.merch),s=(0,S.useOwner)(e=>e.merchOrders),[t,r]=(0,x.useState)(''),[n,a]=(0,x.useState)(''),l=(s,t)=>S.useOwner.getState().setOwner({merch:e.map(e=>e.id===s?{...e,...t}:e)});return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,V.jsx)(B.SectionHead,{title:"Products & stock"}),e.map(e=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,V.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,V.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:s=>l(e.id,{live:s})})}),(0,V.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:s=>l(e.id,{stock:s}),label:`${e.name} stock`})]}),0===e.stock?(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"Out of stock"}):e.stock<8?(0,V.jsx)(v.T,{size:13,colour:I.colours.amber,children:"Low stock"}):null]},e.id)),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,V.jsx)(v.Field,{label:"Name",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Price \xa3",value:n,onChangeText:a,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Add product",disabled:t.trim().length<2||!(Number(n)>0),onPress:()=>{S.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:t.trim(),price:Math.round(100*Number(n)),stock:10,live:!0}]}),r(''),a('')}})]}),(0,V.jsx)(B.SectionHead,{title:"Shop orders"}),s.map(t=>{const r=e.find(e=>e.id===t.productId);return(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[t.qty,"\xd7 ",r?.name," \xb7 ",t.customer]}),(0,V.jsx)(v.Badge,{kind:'new'===t.status?'amber':'ready'===t.status?'blue':'ok',label:t.status})]}),(0,V.jsxs)(v.Muted,{children:[t.at," \xb7 ",(0,R.gbp)((r?.price??0)*t.qty)]}),'collected'!==t.status?(0,V.jsx)(v.Button,{small:!0,label:'new'===t.status?'Mark ready':'Mark collected',onPress:()=>S.useOwner.getState().setOwner({merchOrders:s.map(e=>e.id===t.id?{...e,status:'new'===t.status?'ready':'collected'}:e)})}):null]},t.id)})]})}const Y=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const J=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},Z=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function ee({kind:e}){const{r:s}=(0,A.useCtx)(6e4),t=(0,S.useOwner)(e=>e.offers);(0,x.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:t},J,Z).catch(()=>{})},[]);const r=(0,u.can)('venue.settings');return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(b.LoyaltySummaryCard,{kind:e}),(0,V.jsx)(g.StaffLoyalty,{venue:s.name,canRemove:r,onOpenSettings:r?()=>{i.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),r?(0,V.jsx)(v.Card,{children:(0,V.jsxs)(w.default,{style:{gap:8},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,V.jsx)(b.LoyaltySettingsPanel,{})]})}):null]})}},1426,[5,1341,796,806,829,1427,1362,1400,1172,14,1205,985,1428,1430,1363,34,1096,1406,30,402,102,853,1225,794,848,865,836,855,1104,827,840,1147,1100,1119,858,1378,838,1041,1132,832,830,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1427,[829,34,102,794,830,836,1131,848,838,840,25]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1428,[985,34,281,236,102,1225,794,1202,1205,840,1429,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1429,[34,236,102,794,1202,25]); -__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1430,[5,1341,34,102,794,836,1202,1203,1204,985,1205,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SafetyPages",{enumerable:!0,get:function(){return l}}),r(d[0]);var n=r(d[1]),t=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]);const l={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s,initial:"items"})},Haccp:()=>{const{me:n,meId:t,now:o}=(0,c.useCtx)(3e4);return(0,u.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:l}=(0,c.useCtx)(3e4);return(0,u.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===l||'manager'===l})}}},1431,[34,1161,1133,1162,1169,1100,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CAR_LINK",{enumerable:!0,get:function(){return h}}),_e.CarScreen=function(){const e=(0,o.useSync)(e=>'staff'===e.kind&&!!e.venueId),[n,c]=(0,t.useState)(''),[b,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[f,w]=(0,t.useState)(null),[v,k]=(0,t.useState)(null),S=async()=>{try{w(await(0,o.carList)())}catch{w([])}};(0,t.useEffect)(()=>{e&&S()},[e]);const C=n.replace(/\D/g,''),D=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(C);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is signed in as you. It opens the owner screen in a few seconds.'}),S()):y({ok:!1,text:e.message})};return(0,u.jsxs)(s.default,{testID:"car-screen-page",style:{gap:12},children:[(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Sign the car in"}),(0,u.jsx)(r.T,{center:!0,children:`In the car, while parked, open the browser and type ${h}`}),(0,u.jsx)(r.T,{center:!0,children:"The car shows 6 numbers on its screen."}),(0,u.jsx)(r.Field,{testID:"car-code-field",label:"Code shown on the car (6 numbers)",accessibilityLabel:"Code shown on the car, 6 numbers",value:n,onChangeText:e=>c(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,u.jsx)(r.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Signs the car in as you",disabled:!e||x||6!==C.length,onPress:()=>{D()},style:{minHeight:56}}),e?null:(0,u.jsx)(r.Muted,{center:!0,children:"Your phone needs to be connected to approve a car."}),(0,u.jsx)(s.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,u.jsx)(r.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,u.jsx)(r.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars signed in"}),null===f?(0,u.jsx)(r.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):f.length?f.map(e=>(0,u.jsxs)(s.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 signed in as ${e.staffName}`}),(0,u.jsx)(r.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,u.jsx)(r.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Sign this car out",accessibilityLabel:`Sign ${e.label} out`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,u.jsx)(r.Muted,{center:!0,children:"No cars are signed in."})]}),v?(0,u.jsxs)(r.Sheet,{visible:!0,onClose:()=>k(null),title:"Sign this car out?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,u.jsx)(r.T,{center:!0,children:`${v.label} stops working straight away. To use it again, make a new code in the car and approve it here.`}),(0,u.jsx)(r.Button,{testID:"car-revoke-yes",label:"Yes, sign it out",onPress:async()=>{const e=v;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is signed out.`}:{ok:!1,text:t.message}),S()},style:{minHeight:56}}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),u=_r(d[6]);const h='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1432,[34,102,794,985,827,840,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=k,_e.SmsBubble=v,_e.AlertSettings=function({go:e}){const{rid:s}=(0,w.useCtx)(6e4),t=(0,b.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,b.systemSupport)()),[r,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=!0;return'undefined'!=typeof navigator&&/Android/i.test(navigator.userAgent)?p('unsupported'):(0,f.pushState)().then(s=>{e&&p(s)}).catch(()=>{e&&m('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const y='granted'===l?'Allowed on this device':'denied'===l?'Blocked. Turn it back on in your browser or phone settings for this site.':'default'===l?'Not asked yet':'This browser can\u2019t show notifications. On iPhone, add the Managers app to your Home Screen first.';return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Alert sound"}),(0,T.jsx)(u.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,T.jsx)(u.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>b.useAlerts.getState().setPrefs({muted:!e})}),(0,T.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,j.chime)('bright')}),(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,j.lowChime)(.6)})]}),(0,T.jsx)(u.Muted,{children:"The Display is silent and shows alerts on screen. The Head Chef app flashes and plays a soft chime until a takeaway is confirmed and its allergies are ticked."})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Which alerts to show"}),(0,T.jsx)(u.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),b.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindChip,{kind:e,size:30}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(u.Toggle,{label:b.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>b.useAlerts.getState().setType(e,s)})})]},e))]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Send a test alert"}),(0,T.jsx)(u.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,T.jsx)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,T.jsx)(u.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${b.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,b.sendTestAlert)(s,e)},e))})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,T.jsx)(u.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,T.jsx)(u.Muted,{children:y}),(0,T.jsx)(u.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>b.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,T.jsx)(u.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,b.requestSystemPermission)()),b.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,b.showSystemNotification)({id:`test-sys:${Date.now()}`,kind:'test',rid:s,at:Date.now(),name:'Test guest',when:'Today 19:30',covers:4,source:'Phone',test:!0},!0)}):null,(0,T.jsx)(u.Muted,{children:(0,b.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,T.jsxs)(u.Banner,{kind:"info",title:"What works today",children:["Alerts show while the app is open. ",'unsupported'===x?'Locked-phone alerts for this phone are coming soon.':'on'===x?'Locked-phone alerts are on for this phone.':'To get alerts when your phone is locked, tap Turn on alerts.']}),'unsupported'!==x?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:'on'===x?'Check alerts':'Turn on alerts',onPress:async()=>{try{if('on'===x){const e=await(0,f.pushState)();p(e),m('on'===e?'Locked-phone alerts are on for this phone.':'Tap Turn on alerts to connect this phone.')}else{const e=await(0,f.turnOnPush)();m(e.message),e.ok&&(p('on'),o((0,b.systemSupport)()))}}catch{m('Could not turn on alerts. Please try again.')}}}):null,r?(0,T.jsx)(u.Muted,{children:r}):null]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindIcon,{kind:"email"}),(0,T.jsx)(u.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,T.jsx)(u.Badge,{kind:"neutral",label:b.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,T.jsx)(u.Muted,{children:b.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${b.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,T.jsx)(u.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,w.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),h=(0,n.useMemo)(()=>(0,p.templatesFor)(r),[r]),b=(0,x.useAssistant)(e=>e.enabled),[j,f]=(0,n.useState)('booking'),[P,M]=(0,n.useState)('sms'),A=h[j],B=s=>m.useStore.getState().setTemplate(e,j,s),L=Object.fromEntries(p.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),R=l.LIVE_VENUE_BUILD?{sms:L,email:L}:'order'===j?(0,p.orderVars)({...S,slotTime:`${o}T18:45:00`},s):(0,p.bookingVars)({...C,date:o},s),I=(0,p.toGsm)((0,p.fill)(A.sms,R.sms)),N=(0,p.fill)(A.subject,R.email),_=(0,p.emailHtml)((0,p.fillEmailText)(A.body,R.email),{venue:s.name,preheader:N}),O=!!r?.[j],D=s.settings;return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsx)(u.Banner,{kind:"demo",title:"Preview mode",children:p.PREVIEW_BANNER}),(0,T.jsxs)(u.Muted,{children:["Every booking and takeaway order gets a text (a phone number is needed to book) and an email if they gave one. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest."]}),(0,T.jsx)(u.Row,{wrap:!0,gap:6,children:Object.keys(p.DEFAULT_TEMPLATES).map(e=>(0,T.jsx)(u.Chip,{label:p.TEMPLATE_LABEL[e].title,selected:j===e,onPress:()=>f(e)},e))}),(0,T.jsx)(u.Muted,{children:p.TEMPLATE_LABEL[j].when}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Text message"}),(0,T.jsxs)(u.Muted,{children:[(0,p.smsParts)(I).chars," characters"]})]}),(0,T.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:A.sms,onChangeText:e=>B({sms:e}),style:[u.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,p.smsParts)(I).chars>300?(0,T.jsx)(u.T,{size:13,colour:y.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,T.jsx)(u.T,{weight:"semibold",children:"Email subject"}),(0,T.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:A.subject,onChangeText:e=>B({subject:e}),style:u.styles.input}),(0,T.jsx)(u.T,{weight:"semibold",children:"Email message"}),(0,T.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:A.body,onChangeText:e=>B({body:e}),style:[u.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,T.jsxs)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:[b?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>B(E(A))}):null,O?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,j,null)}):null]}),b?(0,T.jsx)(u.Muted,{children:"\u201cMake it warmer\u201d is an on-device wording tool: it rewrites on this device and keeps every detail. Check it reads right before you leave it."}):null,(0,T.jsxs)(u.Muted,{children:["Placeholders: ",p.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Live preview"}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:"Text",selected:'sms'===P,onPress:()=>M('sms')}),(0,T.jsx)(u.Chip,{label:"Email",selected:'email'===P,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,T.jsx)(u.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,T.jsxs)(u.Muted,{children:["Sample guest: Alex, ",'order'===j?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===P?(0,T.jsx)(v,{text:I,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),N]}),(0,T.jsx)(k,{html:_})]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,T.jsx)(u.Muted,{children:"Online bookings above this size wait for you to confirm. The guest gets a \u201cwe\u2019ve got your request\u201d message first, then the confirmation once you accept."}),(0,T.jsx)(u.Stepper,{label:"Auto-accept online bookings up to",value:D.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,T.jsx)(u.Toggle,{label:"Also check online bookings with a special request",value:!!D.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Going live"}),(0,T.jsxs)(u.Muted,{children:["Nothing is sent yet. To send real texts and emails: a text service account (for example Twilio) and an email service (for example Postmark), a small CoverCharge server to keep the keys safe, and your sender name (",s.name,") registered. Your venue name, address and phone come from Info & hours."]})]})]})},_e.Outbox=function(){const{rid:e}=(0,w.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[h,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:y.colours.gold,borderRadius:12,padding:12},children:[(0,T.jsx)(u.T,{weight:"semibold",colour:y.colours.gold,children:(0,p.isLive)()?'Live: messages are sent through your text and email service.':p.PREVIEW_BANNER}),(0,p.isLive)()?null:(0,T.jsx)(u.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,T.jsx)(u.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,T.jsx)(u.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,T.jsx)(u.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(h===e.id?null:e.id),style:{gap:4},children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,T.jsxs)(u.T,{weight:"semibold",children:[P[e.kind]," \xb7 ",e.ref]})]}),(0,T.jsx)(u.Muted,{children:e.at.slice(11,16)})]}),(0,T.jsxs)(u.Muted,{children:["To ",e.toName,", ",e.to]}),(0,T.jsx)(u.T,{size:13,colour:'sent'===e.status?y.colours.ok:'failed'===e.status?y.colours.red:y.colours.amber,children:(0,p.statusLabel)(e)})]}),'sms'===e.channel?(0,T.jsx)(v,{text:e.body}):h===e.id?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),e.subject]}),(0,T.jsx)(k,{html:e.html??'',height:560})]}):(0,T.jsxs)(u.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Clear the Outbox",onPress:()=>m.useStore.getState().clearOutbox(e)}):null]})};var s=_r(d[0]),t=_r(d[1]),l=_r(d[2]),n=_r(d[3]),o=e(n);_r(d[4]);var r=e(_r(d[5])),c=e(_r(d[6])),u=_r(d[7]),h=_r(d[8]),m=_r(d[9]),x=_r(d[10]),p=_r(d[11]),b=_r(d[12]),j=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]);function k({html:e,height:s=520}){return o.default.createElement('iframe',{srcDoc:e,title:'Email preview',sandbox:'',style:{width:'100%',height:s,border:'1px solid #2a2a2a',borderRadius:12,background:'#f4efe6'}})}function v({text:e,to:t}){const l=(0,p.smsParts)(e);return(0,T.jsxs)(c.default,{style:{gap:4},children:[t?(0,T.jsxs)(u.Muted,{children:["To ",t]}):null,(0,T.jsx)(c.default,{style:{alignSelf:'flex-start',maxWidth:420,backgroundColor:(0,s.soutersSurface)('#1f1f22'),borderRadius:18,borderBottomLeftRadius:4,padding:12,borderWidth:1,borderColor:'#2c2c30'},children:(0,T.jsx)(u.T,{size:15,children:e})}),(0,T.jsxs)(u.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const C={name:'Alex Morgan',partySize:4,date:'',time:'19:30',ref:'B-1042',allergies:[{allergen:'peanuts',severity:'allergy'}],notes:'It\u2019s my mum\u2019s birthday',table:void 0},S={customerName:'Alex Morgan',ref:'T-2093',total:3150,slotTime:void 0,readyBy:void 0,allergies:[{allergen:'milk',severity:'intolerance'}],lines:[{qty:2,name:'Fish and chips',choices:[]},{qty:1,name:'Sticky toffee pudding',choices:[]}]};function E(e){const s=e.sms.replace(/^Hi \{first\},/,'Hi {first}, lovely news!').replace(/See you soon,/,'We can\u2019t wait to see you,');let t=e.body;return/can\u2019t wait/.test(t)||(t=t.replace(/(Hi \{first\},\n\n)/,'$1We\u2019re so glad you chose us. ')),t=t.replace(/Warm wishes,/,'With very warm wishes from all of us,'),{sms:s,subject:e.subject,body:t}}const P={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1433,[798,796,806,34,236,402,102,794,1174,848,1415,833,1176,1033,840,1045,1100,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,i.useOwner)(e=>e.site),u=(0,o.useSheets)(e),[c,m]=(0,l.useState)(null);return c?(0,p.jsxs)(s.Card,{children:[(0,p.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===c.id)?`Edit ${c.name}`:'New supplier'}),(0,p.jsx)(x,{rid:e,s:c,onDone:()=>m(null)})]}):(0,p.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,p.jsx)(s.Banner,{kind:"info",title:"Used by the Head Chef app",children:"Each supplier gets an order sheet in Head Chef \u203a Ordering. Text, WhatsApp and phone orders open the phone\u2019s own app with the order written out, and the chef presses Send. Nothing is sent automatically."}),u.map(e=>(0,p.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,p.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,p.jsx)(s.Muted,{children:[e.goods,e.deliveryDays.length?`delivers ${(0,h.dayRange)(e.deliveryDays)}`:'',e.orderDays.length?`order ${(0,h.dayRange)(e.orderDays)}`:'',e.frequency,e.priceCapPerKg?`cap ${(0,d.gbp)(e.priceCapPerKg)}/kg`:''].filter(Boolean).join(' \xb7 ')}),'text'!==e.method&&'whatsapp'!==e.method&&'phone'!==e.method||e.number?null:(0,p.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,p.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,p.jsx)(s.Row,{wrap:!0,gap:8,children:(0,p.jsx)(s.Button,{label:"Add supplier",testID:"sheet-add",onPress:()=>m({id:(0,h.sid)(),name:'',goods:'',method:'text',number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:''})})})]})};var l=r(_d[0]),t=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),i=r(_d[4]),o=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]);const c=['online','phone','text','whatsapp','tbc'];function m({label:e,value:l,onChange:t}){return(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,p.jsx)(s.Chip,{label:e,selected:l.includes(n),onPress:()=>t(l.includes(n)?l.filter(e=>e!==n):[...l,n].sort())},e))})]})}function x({rid:e,s:t,onDone:i}){const d=(0,o.useOrderSheets)(e=>e.upsert),x=(0,o.useOrderSheets)(e=>e.remove),[b,f]=(0,l.useState)(t),[j,y]=(0,l.useState)(t.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[C,v]=(0,l.useState)(t.priceCapPerKg?(t.priceCapPerKg/100).toFixed(2):''),[w,T]=(0,l.useState)(!1),D=e=>f(l=>({...l,...e}));return(0,p.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,p.jsx)(s.Field,{label:"Supplier name",value:b.name,onChangeText:e=>D({name:e})}),(0,p.jsx)(s.Field,{label:"What they supply",value:b.goods,onChangeText:e=>D({goods:e})}),(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:c.map(e=>(0,p.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:b.method===e,onPress:()=>D({method:e})},e))})]}),'text'===b.method||'whatsapp'===b.method||'phone'===b.method?(0,p.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:b.number,keyboardType:"phone-pad",onChangeText:e=>D({number:e})}):null,'online'===b.method?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:b.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>D({url:e.trim()})}),(0,p.jsx)(s.Field,{label:"Button label",value:b.urlLabel??'',placeholder:"Open website",onChangeText:e=>D({urlLabel:e})})]}):null,(0,p.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:b.contact??'',onChangeText:e=>D({contact:e})}),(0,p.jsx)(m,{label:"Delivery days",value:b.deliveryDays,onChange:e=>D({deliveryDays:e})}),(0,p.jsx)(m,{label:"Order days (a reminder shows in the Head Chef app)",value:b.orderDays,onChange:e=>D({orderDays:e})}),(0,p.jsxs)(s.Row,{gap:10,children:[(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:b.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>D({cutoff:e})})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Price cap \xa3/kg (optional)",value:C,keyboardType:"decimal-pad",onChangeText:v})})]}),(0,p.jsx)(s.Field,{label:"Reminder text (optional)",value:b.reminder,onChangeText:e=>D({reminder:e})}),(0,p.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:b.frequency,onChangeText:e=>D({frequency:e})}),b.priceCapPerKg||C?(0,p.jsx)(s.Field,{label:"Seller",value:b.seller,onChangeText:e=>D({seller:e})}):null,(0,p.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:y}),(0,p.jsx)(s.Field,{label:"Notes for the chef",value:b.notes,multiline:!0,onChangeText:e=>D({notes:e})}),(0,p.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,p.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const l=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,l)=>{const[n,s]=e.split('|').map(e=>e.trim()),i=t.items.find(e=>e.name===n);return{id:i?.id??`${b.id}-i${l}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*parseFloat(C.replace(/[\xa3,]/g,'')));d(e,{...b,items:l,priceCapPerKg:n>0?n:0,placeholder:b.placeholder&&'tbc'===b.method}),i()},disabled:!b.name.trim()}),(0,p.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:i}),w?(0,p.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{x(e,t.id),i()}}):(0,p.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>T(!0)})]})]})}},1434,[34,402,102,794,865,1016,836,1017,840,25]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaySaverSettings=function(){const{rid:e,me:s}=(0,v.useCtx)(6e4),u=s.replace(' (example)','');(0,f.useSync)(e=>e.venueId);const x=(0,b.saverConnected)(),R=!x||(0,f.can)('venue.settings'),D=(0,b.useSaverSync)(),[k,M]=(0,t.useState)(D??p.SAVER_DEFAULT),[C,T]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[L,E]=(0,t.useState)(null);(0,t.useEffect)(()=>{C||M(D??p.SAVER_DEFAULT)},[D]);const O=e=>{R&&(M(t=>({...t,...e})),T(!0),E(null))},_=async()=>{P(!0);try{await(0,b.saveSaver)(k,u),T(!1),E({kind:'success',t:x?'Saved. The Display changes within a few seconds; no need to pair it again.':'Saved on this device (demo).'})}catch(e){E({kind:'danger',t:`Couldn't save: ${e.message}`})}finally{P(!1)}},{width:$}=(0,l.default)(),U=Math.min($-48,520),A=Math.round(10*U/16);return(0,j.jsxs)(n.default,{style:{gap:14,width:'100%',maxWidth:640,alignSelf:'center'},testID:"saver-settings",children:[(0,j.jsx)(i.T,{center:!0,size:22,weight:"semibold",colour:c.colours.gold,accessibilityRole:"header",children:"Display screensaver"}),(0,j.jsx)(i.Muted,{center:!0,children:"What the Display shows when nobody has touched it for a while. Tap anywhere on the Display to wake it; that tap doesn\u2019t press anything."}),R?null:(0,j.jsx)(i.Banner,{kind:"info",title:"Managers and owners only",children:"You can see the screensaver settings, but only a manager or owner can change them."}),!D&&x?(0,j.jsx)(i.Muted,{center:!0,children:"Not set yet: the Display shows your logo after the idle time set on that Display."}):null,(0,j.jsx)(i.Card,{children:(0,j.jsx)(i.Toggle,{label:"Screensaver on",value:k.on,onChange:e=>O({on:e}),testID:"saver-on",a11y:"Screensaver on or off"})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Start after"}),(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:p.IDLE_OPTIONS.map(e=>(0,j.jsx)(i.Chip,{label:e.label,selected:k.idleMins===e.mins,disabled:!k.on,onPress:()=>O({idleMins:e.mins}),testID:`saver-idle-${e.mins}`,accessibilityLabel:e.mins?`Start after ${e.mins} minutes with no touches`:'Never start the screensaver'},e.mins))}),(0,j.jsx)(i.Muted,{center:!0,children:k.on?k.idleMins?`Starts after ${k.idleMins} minutes with no touches.`:'Never: the Display stays on the board.':'Off: the Display never goes to the screensaver.'})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Style"}),(0,j.jsx)(n.default,{accessibilityRole:"radiogroup",style:{gap:8},children:p.SAVER_STYLES.map(e=>{const t=k.style===e.id;return(0,j.jsxs)(o.default,{testID:`saver-style-${e.id}`,onPress:()=>O({style:e.id}),disabled:!R,accessibilityRole:"radio",accessibilityState:{checked:t,disabled:!R},accessibilityLabel:`${e.label}. ${e.sub}`,style:{minHeight:64,borderRadius:14,borderWidth:2,borderColor:t?c.colours.gold:c.colours.border,backgroundColor:t?'rgba(201,162,74,0.12)':'transparent',paddingVertical:10,paddingHorizontal:14,alignItems:'center',justifyContent:'center'},children:[(0,j.jsxs)(i.T,{center:!0,weight:"semibold",colour:t?c.colours.gold:c.colours.text,children:[t?'\u25cf ':'\u25cb ',e.label]}),(0,j.jsx)(i.Muted,{center:!0,children:e.sub})]},e.id)})})]}),(0,j.jsx)(S,{rid:e,c:k,set:O,editor:R,connected:x,onMsg:E}),'photos'===k.style?(0,j.jsx)(w,{c:k,set:O,editor:R,connected:x,onMsg:E}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.Toggle,{label:"Dim at night",value:k.dimOn,onChange:e=>O({dimOn:e}),testID:"saver-dim",a11y:"Dim the screensaver at night"}),k.dimOn?(0,j.jsxs)(n.default,{style:{gap:8,alignItems:'center'},children:[(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"From"}),(0,j.jsx)(i.Stepper,{label:"Dim from",value:(0,y.toMins)(k.dimFrom),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimFrom:(0,y.fromMins)(e)}),testID:"saver-dim-from"})]}),(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"Until"}),(0,j.jsx)(i.Stepper,{label:"Dim until",value:(0,y.toMins)(k.dimTo),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimTo:(0,y.fromMins)(e)}),testID:"saver-dim-to"})]})]}):null,(0,j.jsxs)(i.Muted,{center:!0,children:[(0,p.dimWords)(k),". The screensaver is shown much darker between these times."]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Preview"}),(0,j.jsx)(n.default,{style:{alignItems:'center'},testID:"saver-preview",accessibilityLabel:"Preview of the screensaver",children:(0,j.jsx)(n.default,{style:{width:U,height:A,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:c.colours.border},children:k.on?(0,j.jsx)(h.Saver,{rid:e,cfg:k,box:{width:U,height:A}},`${k.style}-${k.photos.length}-${k.logo??''}`):(0,j.jsx)(n.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.Muted,{center:!0,children:"Screensaver off"})})})})]}),L?(0,j.jsx)(i.Banner,{kind:L.kind,children:L.t}):null,R?(0,j.jsx)(i.Button,{label:I?'Saving\u2026':C?'Save screensaver':'Saved',disabled:I||!C,onPress:()=>{_()},testID:"saver-save"}):null]})};var t=r(d[0]),s=e(t);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),l=e(r(d[4])),i=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),v=r(d[13]),j=r(d[14]);const x='undefined'!=typeof document;function w({c:e,set:o,editor:l,connected:h,onMsg:u}){const y=(0,t.useRef)(null),[f,v]=(0,t.useState)(!1),[w,S]=(0,t.useState)({});(0,t.useEffect)(()=>{let t=!0;return Promise.all(e.photos.map(async e=>[e,await(0,b.saverPhotoUrl)(e)])).then(e=>{t&&S(Object.fromEntries(e.filter(e=>e[1])))}),()=>{t=!1}},[e.photos.join('|')]);const R=async t=>{if(t?.length){v(!0);try{const s=[];for(const o of Array.from(t).slice(0,p.MAX_SAVER_PHOTOS-e.photos.length))s.push(h?await(0,b.uploadSaverPhoto)(o,e.photos.length+s.length):URL.createObjectURL(o));o({photos:[...e.photos,...s]}),u({kind:'success',t:`${s.length} photo${1===s.length?'':'s'} added. Tap Save screensaver to show ${1===s.length?'it':'them'} on the Display.`})}catch(e){u({kind:'danger',t:e.message})}finally{v(!1),y.current&&(y.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Slideshow photos"}),(0,j.jsxs)(i.Muted,{center:!0,children:["Your own photos of the venue, food and team, one every 8 seconds. Up to ",p.MAX_SAVER_PHOTOS,". With no photos the Display shows your logo."]}),e.photos.length?(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:e.photos.map((t,h)=>(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:4},children:[w[t]&&x?s.default.createElement('img',{src:w[t],alt:`Slideshow photo ${h+1}`,style:{width:96,height:64,objectFit:'cover',borderRadius:8}}):(0,j.jsx)(n.default,{style:{width:96,height:64,borderRadius:8,backgroundColor:c.colours.border}}),l?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove photo ${h+1} from the slideshow`,onPress:()=>o({photos:e.photos.filter(e=>e!==t)})}):null]},t))}):(0,j.jsx)(i.Muted,{center:!0,children:"No photos yet."}),l?(0,j.jsx)(i.Button,{kind:"secondary",label:f?'Uploading\u2026':'Upload photos',disabled:f||e.photos.length>=p.MAX_SAVER_PHOTOS,onPress:()=>{x&&y.current?.click()},testID:"saver-upload",accessibilityLabel:"Upload photos for the slideshow"}):null,x?s.default.createElement('input',{ref:y,type:'file',accept:'image/jpeg,image/png,image/webp',multiple:!0,style:{display:'none'},'aria-hidden':!0,onChange:e=>{R(e.target.files)}}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Removing a photo takes it off the slideshow; the file itself is kept."})]})}function S({rid:e,c:o,set:l,editor:y,connected:f,onMsg:v}){const w=(0,t.useRef)(null),[S,R]=(0,t.useState)(!1),[D,k]=(0,t.useState)(!1),M=(0,u.useBrand)(e).name,C=!!o.logo,T=async e=>{const t=e?.[0];if(t){R(!0);try{let e;if(f)e=await(0,b.uploadSaverLogo)(t);else{const s=(0,p.logoFileProblem)(t.type,t.size);if(s)throw new Error(s);if('image/svg+xml'===t.type&&!(0,p.svgSafe)(await t.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');e=URL.createObjectURL(t)}l({logo:e}),v({kind:'success',t:(C?'New logo ready':'Logo uploaded')+". Tap Save screensaver to show it on the Display."})}catch(e){v({kind:'danger',t:e.message})}finally{R(!1),w.current&&(w.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:10},testID:"saver-logo-card",children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Screensaver logo"}),(0,j.jsx)(i.Muted,{center:!0,children:'logo'===o.style?'Shown drifting slowly round the Display.':'Shown with the Logo style, and small on the clock and covers screens.'}),(0,j.jsx)(n.default,{style:{minWidth:132,maxWidth:240,height:132,paddingHorizontal:12,borderRadius:14,backgroundColor:'#000000',borderWidth:1,borderColor:c.colours.border,alignItems:'center',justifyContent:'center'},accessible:!0,accessibilityLabel:C?'Your uploaded logo':`Your standard logo, ${M}`,children:(0,j.jsx)(h.SaverLogoPreview,{rid:e,path:o.logo,size:108})}),(0,j.jsx)(i.Muted,{center:!0,children:C?'Your uploaded logo':'Your standard logo'}),y?(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:C?'secondary':'primary',label:S?'Uploading\u2026':C?'Replace logo':'Upload logo',disabled:S,onPress:()=>{x&&w.current?.click()},testID:"saver-logo-upload",accessibilityLabel:C?'Replace the screensaver logo':'Upload a logo for the screensaver'}),C?(0,j.jsx)(i.Button,{kind:"ghost",label:"Remove",disabled:S,onPress:()=>k(!0),testID:"saver-logo-remove",accessibilityLabel:"Remove the uploaded logo and go back to the standard one"}):null]}):null,(0,j.jsx)(i.Muted,{center:!0,children:"PNG, JPG or SVG, up to 2 MB (an SVG is saved as a picture). A square logo on a transparent or black background looks best."})]}),x?s.default.createElement('input',{ref:w,type:'file',accept:Object.keys(p.LOGO_TYPES).join(','),style:{display:'none'},'aria-hidden':!0,onChange:e=>{T(e.target.files)}}):null,D?(0,j.jsx)(i.Sheet,{visible:!0,onClose:()=>k(!1),title:"Remove the uploaded logo?",maxWidth:520,testID:"saver-logo-remove-confirm",children:(0,j.jsxs)(n.default,{style:{gap:12,alignItems:'center'},children:[(0,j.jsx)(i.Muted,{center:!0,children:"The screensaver goes back to your standard logo once you save. The uploaded file is kept, and the standard logo isn\u2019t changed."}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep it",onPress:()=>k(!1),testID:"saver-logo-remove-no"}),(0,j.jsx)(i.Button,{kind:"danger",label:"Remove logo",onPress:()=>{l({logo:null}),k(!1),v({kind:'success',t:'Logo removed. Tap Save screensaver to go back to the standard logo on the Display.'})},testID:"saver-logo-remove-yes"})]})]})}):null]})}},1435,[34,236,402,102,426,794,840,1300,847,1302,827,985,1303,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1436,[804,982,1376,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableQrPage=function(){const{rid:e,me:t}=(0,h.useCtx)(6e4),b=t.replace(' (example)','');return(0,u.jsxs)(s.default,{style:{gap:14,width:'100%',maxWidth:760,alignSelf:'center'},testID:"table-qr-page",children:[(0,u.jsx)(l.T,{center:!0,size:22,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Table QR codes"}),(0,u.jsx)(l.Muted,{center:!0,children:"Guests scan the code on their table, see the menu and send their order to the kitchen. They pay at the bar or with their server."}),(0,u.jsx)(c.TableOrderSettings,{rid:e,me:b}),(0,u.jsx)(l.T,{center:!0,size:20,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Orders from the tables"}),(0,u.jsx)(n.StaffTableOrders,{rid:e,me:b})]})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),n=r(d[5]),h=r(d[6]),u=r(d[7])},1437,[34,102,794,840,1358,1427,1100,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=m,_e.HelpPage=function({go:e}){const[i,o]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[m,y]=(0,s.useState)(null),w=(0,s.useMemo)(()=>i.trim()?(0,c.searchHelp)(r.HELP,i,10).map(e=>e.a):r.HELP.filter(e=>!h||e.topic===h),[i,h]);return(0,x.jsxs)(n.default,{style:{gap:10},testID:"help-page",children:[(0,x.jsxs)(n.default,{style:[a.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\ud83d\udd0d"}),(0,x.jsx)(t.TextInput,{testID:"help-search",value:i,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:u.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),i?(0,x.jsx)(l.default,{onPress:()=>o(''),accessibilityLabel:"Clear search",children:(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\u2715"})}):null]}),(0,x.jsx)(j,{go:e}),i?(0,x.jsx)(a.Muted,{children:w.length?`${w.length} result${1===w.length?'':'s'} for \u201c${i.trim()}\u201d`:`Nothing for \u201c${i.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:[null,...r.HELP_TOPICS].map(e=>(0,x.jsx)(a.Chip,{label:e??'All',selected:h===e,onPress:()=>p(e)},e??'all'))}),w.map((t,s)=>(0,x.jsx)(f,{a:t,go:e,open:m===t.id||!!i&&0===s&&null===m,onToggle:()=>y(m===t.id?'':t.id)},t.id)),(0,x.jsxs)(a.Card,{style:{alignItems:'center'},children:[(0,x.jsx)(a.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:"Chat with CoverCharge support"}),(0,x.jsx)(a.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,x.jsx)(a.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=j;var t=_r(d[0]),s=_r(d[1]),l=e(_r(d[2])),n=e(_r(d[3])),a=_r(d[4]),i=_r(d[5]),o=_r(d[6]),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),p=_r(d[11]),x=_r(d[12]);function m(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>o.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function f({a:e,go:t,open:s,onToggle:i}){return(0,x.jsx)(n.default,{testID:`help-${e.id}`,children:(0,x.jsxs)(a.Card,{children:[(0,x.jsx)(l.default,{accessibilityRole:"button",onPress:i,children:(0,x.jsxs)(a.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,x.jsxs)(n.default,{style:{flex:1},children:[(0,x.jsx)(a.T,{weight:"semibold",children:e.title}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,x.jsx)(a.Muted,{size:12,children:e.topic})]})]}),(0,x.jsx)(a.T,{colour:u.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,x.jsxs)(a.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,x.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,x.jsx)(a.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>m(e,t)})}):null]})})}function j({go:e}){const{rid:t,today:l}=(0,p.useCtx)(6e4),i={rid:t,today:l,go:(t,s)=>e(t,s??null)},[o,c]=(0,s.useState)(''),[f,j]=(0,s.useState)(null),[b,C]=(0,s.useState)(null),k=async()=>{const e=o.trim();if(!e)return;C(null),j(null);const t=(0,h.matchIntent)(e,l);if('action'!==t.kind)'help'!==t.kind?C({text:'Sorry, I didn\u2019t follow that. Try \u201cadd a walk-in for 4 at table 7\u201d, \u201cput Ellie on Friday 5 till 11\u201d, or ask \u201chow do I export hours?\u201d.',kind:'note'}):C({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,h.needsConfirm)(t.action.risk)){const e=await(0,h.runAction)(t.action.id,t.params,i);return void C({text:'done'===e.status?e.message:e.message??'',kind:'done'})}j({action:t.action,params:{...y(t.action,l),...t.params},asked:e})}};return(0,x.jsx)(n.default,{testID:"ask-assistant",children:(0,x.jsxs)(a.Card,{highlight:u.colours.gold,children:[(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(n.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,x.jsxs)(n.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,x.jsx)(a.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:c,placeholder:"Ask in plain words",onSubmitEditing:k,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,x.jsx)(a.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:k,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:['Add a walk-in for 4 at table 7','Put a shift on Friday 5 till 11','How do I export hours for payroll?','Pay out the tips'].map(e=>(0,x.jsx)(a.Chip,{label:e,onPress:()=>c(e)},e))}),f?(0,x.jsx)(w,{p:f,today:l,onChange:e=>j({...f,params:e}),onConfirm:async()=>{if(!f)return;const e=await(0,h.runAction)(f.action.id,f.params,i,!0);j(null),c(''),C('done'===e.status?{text:e.message,kind:'done'}:'demo_only'===e.status?{text:e.message,kind:'demo'}:{text:e.message??'Couldn\u2019t do that.',kind:'error'})},onCancel:()=>{j(null),C({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,b?(0,x.jsxs)(n.default,{style:{gap:6},testID:"assistant-reply",children:[(0,x.jsx)(a.Banner,{kind:'done'===b.kind?'success':'error'===b.kind?'warn':'demo'===b.kind?'demo':'info',title:b.text}),b.help?.map(t=>{const s=(0,r.helpById)(t);return(0,x.jsxs)(a.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,x.jsx)(a.T,{style:{flex:1},children:s.title}),s.showMe?(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>m(s,e)}):null]},t)})]}):null,(0,x.jsx)(a.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})}function y(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function w({p:e,today:t,onChange:s,onConfirm:l,onCancel:o}){const r=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,h.demoOnly)(e.action.risk),p=(t,l)=>s({...e.params,[t]:l}),m=e.action,f=e.params,j=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,x.jsxs)(n.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?u.colours.red:u.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':u.colours.okBg},children:[(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:c?'red':'ok',label:h.RISK_LABEL[m.risk]}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>p('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>p('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{size:12,children:"Who"}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:r.slice(0,14).map(e=>(0,x.jsx)(a.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>p('staffId',e.id)},e.id))}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1.3},children:(0,x.jsx)(a.Field,{label:"Date (YYYY-MM-DD)",value:String(f.date??t),onChangeText:e=>p('date',e)})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>p('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>p('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,x.jsx)(a.T,{children:j?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,x.jsx)(a.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,x.jsx)(a.Muted,{children:"Nothing happens until you tap Confirm."}),(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(a.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!j,onPress:l,style:{flex:1}}),(0,x.jsx)(a.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1438,[796,34,402,102,794,865,1390,1439,1440,1441,840,1100,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1439,[]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1440,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${O[t.risk]}${$(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if($(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(c.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const c=(0,l.searchHelp)(p.HELP,e,3);return c.length?{kind:'help',ids:c.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,O={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},$=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);return e.staffId&&e.date&&a>t?(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`):'That shift isn\u2019t complete.'}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...u.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1441,[1442,1098,829,1443,1444,865,848,1014,1390,1439,1440,1446,1445,1448,1449,1012,1013]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1442,[1398,1397,1038]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1443,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1444,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1445,1443]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1445,[804,1098,829,1120,1205,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1446,1447]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1446,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1447,[808,815,818]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1448,[800,865,989,836,1445,1032]); -__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1449,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceSettingsPage=function(){const{rid:e,r:s,now:t}=(0,f.useCtx)(6e4),o=(0,p.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"Staff hold the gold button, say what they need and let go. It sits at the top right in Managers, Head Chef, the Staff app (the full voice assistant, without team financial or HR information) and on the Display (no money, tips or HR either), never in the customer app. Tap it to type or open the Assistant. Replies and change confirmations are shown in text, never spoken. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts for you."}),(0,x.jsx)(c.VoiceUsageCard,{rid:e,now:t}),(0,x.jsxs)(i.Card,{children:[(0,x.jsxs)(i.T,{weight:"semibold",children:["Who gets the voice button at ",s.name]}),(0,x.jsx)(n.default,{style:{gap:6,marginTop:8},children:p.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:p.VOICE_ROLE_LABEL[s],value:(0,p.voiceOn)(o.enabled,e,s),onChange:t=>o.setEnabled(e,s,t)},s))}),(0,x.jsx)(i.Muted,{children:"Saved on this device for now; set it on each device."})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{testID:"voice-text-only",weight:"semibold",children:"The helper replies in text only. It never speaks."}),(0,x.jsx)(i.Row,{gap:8,wrap:!0,style:{marginTop:8},children:(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Show the microphone explanation again",onPress:()=>o.setMicExplained(!1)})})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{weight:"semibold",children:"Privacy"}),(0,x.jsxs)(i.Muted,{children:["What is said while the button is held (up to 30 seconds) is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. Each device asks once to use the microphone. ",(0,u.canListen)()?'This device can listen.':'This device can\u2019t listen, so the button offers \u201ctype instead\u201d.']})]})]})},_e.DraftsPage=function(){const{rid:e,me:o,role:h}=(0,f.useCtx)(6e4),p=(0,r.useDrafts)(e=>e.drafts),u=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[j,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=p.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),C='owner'===h||'manager'===h,D=e=>e.supplier?d.SUPPLIER_PORTALS.find(s=>s.id===e.supplier):void 0,P=e=>(0,x.jsx)(i.Card,{children:(0,x.jsxs)(n.default,{testID:`draft-${e.id}`,style:{gap:6},children:[(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Badge,{label:r.DRAFT_LABEL[e.kind],kind:"gold"}),'draft'!==e.status?(0,x.jsx)(i.Badge,{label:'approved'===e.status?'Approved':'Dismissed',kind:'approved'===e.status?'ok':'neutral'}):null]}),(0,x.jsx)(i.T,{weight:"semibold",children:e.title}),e.lines.map((s,t)=>(0,x.jsxs)(i.T,{size:15,children:['shopping'===e.kind?'\u2022 ':'',s]},t)),(0,x.jsxs)(i.Muted,{children:["From ",e.by," (",e.app,"), ",b(e.at),e.decidedBy?` \xb7 ${e.status} by ${e.decidedBy}, ${b(e.decidedAt)}`:'']}),'draft'===e.status&&C?(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Button,{small:!0,kind:"success",label:"Approve",testID:`draft-approve-${e.id}`,onPress:()=>y({d:e,status:'approved'})}),(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Dismiss",testID:`draft-dismiss-${e.id}`,onPress:()=>y({d:e,status:'dismissed'})}),D(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${D(e).name} ordering`,onPress:()=>{t.default.openURL(D(e).links.order)}}):null]}):null]})},e.id);return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Nothing here has been sent, ordered or paid",children:"The voice helper and the Assistant save bookings, supplier shopping lists, offers, events, specials, messages and payments here for you to check. Approving marks it approved and takes you to the right screen; you still do the booking, the order or the post yourself."}),C?null:(0,x.jsx)(i.Banner,{kind:"warn",title:"Owners and managers approve drafts",children:"You can see the drafts but not approve them."}),B.length?B.map(P):(0,x.jsx)(i.Muted,{children:"No drafts waiting. Try holding the voice button and saying \u201cadd blue roll to the Booker list\u201d."}),S.length?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:k?'Hide approved and dismissed':`Show approved and dismissed (${S.length})`,onPress:()=>w(!k)}):null,k?S.map(P):null,(0,x.jsx)(i.Sheet,{visible:!!j,onClose:()=>y(null),title:'approved'===j?.status?'Approve this draft?':'Dismiss this draft?',children:j?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:j.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===j.status?`This marks it approved${v[j.d.kind]?` and opens ${v[j.d.kind].label}`:''}. Nothing is sent, ordered or paid automatically.`:'It moves to the dismissed list. Nothing is sent.'}),(0,x.jsx)(i.Button,{kind:'approved'===j.status?'success':'danger',label:'approved'===j.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{u(j.d.id,j.status,o.replace(' (example)',''));const e=v[j.d.kind];y(null),'approved'===j.status&&e&&c&&c(e.tab,e.sub)}}),(0,x.jsx)(i.Button,{kind:"secondary",label:"Back",onPress:()=>y(null)})]}):null})]})},_e.ShiftNotesPage=function(){const{rid:e}=(0,f.useCtx)(6e4),s=(0,h.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,h.useShiftNotes)(e=>e.setDone);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.Muted,{children:"Notes left for the next shift, by voice (\u201ctell the next shift the glass washer is leaking\u201d) or the Assistant. Kept on this device for now."}),s.length?s.slice(0,60).map(e=>(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{style:{textDecorationLine:e.done?'line-through':'none'},colour:e.done?o.colours.muted:o.colours.text,children:e.text}),(0,x.jsxs)(i.Row,{style:{justifyContent:'space-between',marginTop:6},children:[(0,x.jsxs)(i.Muted,{children:[e.by," (",e.app,"), ",b(e.at)]}),(0,x.jsx)(i.Button,{small:!0,kind:e.done?'ghost':'success',label:e.done?'Reopen':'Done',onPress:()=>t(e.id,!e.done)})]})]},e.id)):(0,x.jsx)(i.Muted,{children:"No shift notes yet."})]})};var s=_r(_d[0]),t=e(_r(_d[1])),n=e(_r(_d[2])),i=_r(_d[3]),o=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),l=_r(_d[7]),h=_r(_d[8]),p=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),f=_r(_d[12]),x=_r(_d[13]);const b=e=>new Date(e).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});const v={booking:{tab:'bookings',sub:null,label:'Bookings'},offer:{tab:'more',sub:'offers',label:'Specials & offers'},event:{tab:'more',sub:'events',label:'Events'},special:{tab:'more',sub:'specialsboard',label:'Specials board'},shopping:{tab:'more',sub:'suppliers',label:'Suppliers'}}},1450,[34,379,102,794,840,1386,1446,1400,1447,1117,929,1407,1100,25]); -__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1451,[34,102,794,830,1202,1452,1453,840,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1452,[830]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1453,[985,1452,1205]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:s,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,d.useCashUp)(e=>e.cashUps),k=(0,d.useCashSettings)(e),w=(0,o.useNightlyPrefs)(l=>l.email[e]??!1),T=(0,o.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(l=>l.rid===e&&l.on).map(e=>e.name),[N,P]=(0,l.useState)((0,u.addDaysYmd)(v,-1)),U=(0,u.cashFieldsForRecord)(k.cashFields,s.settings.cashUpRecord),_=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:U,soldOut:C}),D='anchorage'!==e&&w,E=[0,1,2].map(e=>(0,u.addDaysYmd)(v,-e));return(0,j.jsxs)(t.default,{testID:"nightly-report",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,j.jsx)(n.Muted,{center:!0,children:"Spend per head, Covers and the cash-up for one night. Blank means it was not entered."}),(0,j.jsx)(t.default,{style:{width:'100%',gap:8},children:E.map(e=>(0,j.jsx)(n.Button,{kind:e===N?'primary':'secondary',label:e===v?'Today':e===(0,u.addDaysYmd)(v,-1)?'Yesterday':e,accessibilityLabel:`Nightly report for ${e}`,onPress:()=>P(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:_.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(_.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(_.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(_.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:_.takings}),(0,j.jsx)(x,{label:"Tips",value:_.tips}),(0,j.jsx)(x,{label:"Takings last week",value:_.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:_.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:_.soldOut.length?_.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),_.cashUp.length?_.cashUp.map(e=>(0,j.jsx)(x,{label:e.label,value:e.value},e.label)):(0,j.jsx)(n.Muted,{center:!0,children:"No cash-up fields for this venue."})]}),p.RELEASE.nightlyEmail&&'anchorage'!==e?(0,j.jsx)(n.Toggle,{testID:"nightly-email",label:"Also email the nightly report",value:D,onChange:l=>T(e,l)}):null]})};var e,l=_r(_d[0]),s=_r(_d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),d=_r(_d[4]),o=_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=({label:e,value:l})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${l}`,style:{width:'100%',alignItems:'center',gap:2,paddingVertical:8},children:[(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,children:e}),(0,j.jsx)(n.T,{center:!0,children:l})]})},1454,[34,102,794,848,1024,1455,977,13,1456,1035,840,1100,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useNightlyPrefs",{enumerable:!0,get:function(){return s}});var e,t=r(d[0]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);const s=(0,n.create)()((0,o.persist)(e=>({email:{},setEmail:(t,l)=>e(e=>({email:{...e.email,[t]:'anchorage'!==t&&l}}))}),{name:'covercharge-nightly-email-v1',storage:(0,o.createJSONStorage)(()=>l.default),version:1}))},1455,[808,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(o){const{rid:u,date:c,bookings:f,cashUps:p,fields:v,soldOut:h}=o,b=f.filter(t=>t.restaurantId===u&&t.date===c),k=p.find(t=>t.rid===u&&t.date===c&&t.confirmedAt),y=p.find(n=>n.rid===u&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),N=k?(0,t.grossOf)(k.vals)??(0,t.takings)(k.vals):null,O=(0,n.coversOn)(f,u,c),S=null==N||O<=0?null:Math.round(N/O*100)/100,_=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&_.set(n,(_.get(n)??0)+(t.partySize||0))}let w=null;for(const[t,n]of _)(!w||n>w.n)&&(w={hour:t,n:n});return{date:c,spendPerHead:s(S),covers:O,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(N),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(y?(0,t.grossOf)(y.vals)??(0,t.takings)(y.vals):null),busiestHour:w?`${String(w.hour).padStart(2,'0')}:00 \xb7 ${w.n} Covers`:'Not entered',soldOut:h.filter(Boolean),cashUp:v.map(t=>({label:t.label,value:k?l(k.vals[t.key],t.kind):'Not entered'}))}};var t=r(d[0]),n=r(d[1]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t)},1456,[13,1424]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{rid:e,me:o,meId:S}=(0,m.useCtx)(6e4),j=(0,u.useSupportChat)(e=>e.messages).filter(t=>t.rid===e),C=(0,u.useSupportChat)(e=>e.send),y=(0,u.useSupportChat)(e=>e.markSent),[f,I]=(0,s.useState)(''),[M,w]=(0,s.useState)(''),T=S===b,v=async e=>{const t=await(0,p.writeSupportMessage)(e);if(t.ok)return y(e.id),void w('');w(t.message||c.SUPPORT_NOT_SENT)};return(0,x.jsxs)(n.default,{testID:"support-chat",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.Muted,{center:!0,children:"A message to the CoverCharge team. Nobody replies automatically."}),M?(0,x.jsx)(l.Muted,{center:!0,testID:"support-note",children:M}):null,j.length?j.map(e=>(0,x.jsxs)(l.Card,{style:{alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:e.from}),(0,x.jsx)(l.T,{center:!0,children:e.text}),(0,x.jsxs)(l.Muted,{center:!0,children:[e.sent?'Sent':'Not sent'," \xb7 ",new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]}),e.sent?null:(0,x.jsx)(l.Button,{kind:"ghost",label:"Send again",accessibilityLabel:`Send again: ${e.text}`,onPress:()=>{v(e)}})]},e.id)):(0,x.jsx)(l.Muted,{center:!0,children:"No messages yet."}),(0,x.jsx)(t.TextInput,{testID:"support-draft",accessibilityLabel:"Message to CoverCharge support",value:f,onChangeText:I,placeholder:"Write a message",placeholderTextColor:h.colours.muted,multiline:!0,style:{width:'100%',minHeight:88,borderWidth:1,borderColor:h.colours.border,borderRadius:12,padding:12,color:h.colours.text,textAlign:'center'}}),(0,x.jsx)(l.Button,{testID:"support-send",label:"Send",accessibilityLabel:"Send message to CoverCharge support",disabled:!f.trim(),onPress:()=>{const t=C(e,o||'Manager',S||'',f);t&&(I(''),v(t))}}),T?(0,x.jsxs)(n.default,{testID:"support-inbox",style:{width:'100%',alignItems:'center',gap:8},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Support inbox"}),(0,x.jsx)(l.Muted,{center:!0,children:j.length?`${j.length} message${1===j.length?'':'s'} from this venue.`:'No messages in the inbox.'})]}):null]})};var e,t=r(d[0]),s=r(d[1]),o=r(d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),p=r(d[7]),m=r(d[8]),x=r(d[9]);const b='st-gordon'},1457,[796,34,102,794,1458,1036,840,1459,1100,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSupportChat",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);let c=0;const u=(0,n.create)()((0,o.persist)(e=>({messages:[],send:(t,s,n,o)=>{const u=o.trim().slice(0,1e3);if(!u)return null;const l={id:`sm-${Date.now().toString(36)}${(c++).toString(36)}`,rid:t,at:(new Date).toISOString(),from:s.slice(0,80),staffRef:n,text:u,sent:!1};return e(e=>({messages:[...e.messages,l].slice(-200)})),l},markSent:t=>e(e=>({messages:e.messages.map(e=>e.id===t?{...e,sent:!0}:e)}))}),{name:'covercharge-support-chat-v1',storage:(0,o.createJSONStorage)(()=>s.default),version:1}))},1458,[808,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.writeSupportMessage=async function(S){if(!s.RELEASE.supportSync)return{ok:!1,message:t.SUPPORT_NOT_SENT};if(!(0,n.isSupabaseConfigured)())return{ok:!1,message:t.SUPPORT_NOT_SENT};const _=u.useSync.getState().venueId;if(!_)return{ok:!1,message:`${t.SUPPORT_NOT_SENT} Sign in and try again.`};try{const s=(0,o.getSupabase)(),{error:n}=await s.from('support_messages').insert({venue_id:_,body:S.text,from_name:S.from,staff_ref:S.staffRef||null});return n?{ok:!1,message:t.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:t.SUPPORT_NOT_SENT}}};var s=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4])},1459,[1035,1036,974,931,985]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1460,[236]); -__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopShell=function(){const{rid:e,r:c,role:g,today:_,now:$,meId:V,me:Q}=(0,z.useCtx)(3e4);(0,m.useTipsPosted)(e,_);const Y=(0,z.useSignedIn)();(0,x.useSoldOutLink)(!0,(Y?.name??Q).replace(' (example)',''));const[ee,te]=(0,a.useState)({kind:'tab',tab:'home'}),[se,ae]=(0,a.useState)(''),oe=(0,a.useRef)(null);(0,a.useEffect)(()=>{(0,z.ensureAttendance)(_,$),(0,M.ensureChat)($)},[_]),globalThis.__ccNow=$.getTime();const ne=(0,a.useCallback)((e,t=null)=>{if('more'===e&&t){const e=q[t];return void te(e?{kind:'edit',id:e}:{kind:'page',id:t})}te('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,a.useEffect)(()=>(S.useVoiceNav.setState({go:ne}),()=>S.useVoiceNav.setState({go:null})),[ne]),(0,a.useEffect)(()=>{D.PITCH&&(globalThis.__pitchGo=ne,globalThis.__deskGo=e=>te(e))},[ne]),(0,E.useAlertWatcher)(e,{nag:'staff'!==g}),(0,w.useScheduledNotices)({rid:e,staffId:Y?.id??'',name:Q,onOpen:()=>ne('more','orderlists')}),(0,y.useOffRotaAlerts)({enabled:'staff'!==g&&!!Y}),(0,a.useEffect)(()=>((0,T.warmDesktopStt)(),(0,C.installVoiceKeys)()),[]);const re=(0,a.useMemo)(()=>[...G,...U].map(e=>e.s),[]);(0,a.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void oe.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=re[Number(e.key)-1];return void(t&&(e.preventDefault(),te(t)))}if('z'===t&&!Z(e.target)){const t=(0,W.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!Z(e.target)){const t=(0,W.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[re]);const ie=O.PAGES.filter(e=>(!e.can||e.can(g))&&!q[e.id]),le=(0,a.useMemo)(()=>{const e=se.trim().toLowerCase(),t={};return ie.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[ie,se]),de=G.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(g)),ue=p.CAN.forecasts(g)?U:U.filter(e=>'rota'===e.s.id),ce='page'===ee.kind?(0,O.pageFor)(ee.id):void 0,be='tab'===ee.kind?G.find(e=>X(e.s,ee))?.label:'edit'===ee.kind?U.find(e=>X(e.s,ee))?.label:ce?.title,he='tab'===ee.kind?G.find(e=>X(e.s,ee))?.tip:'page'===ee.kind?`${ce?.sub??''}. Press ${(0,N.CMD)()}K to jump to any page, or hold Space and ask.`:'',fe=({label:e,s:t,n:s})=>{const a=X(t,ee);return(0,K.jsxs)(o.default,{accessibilityRole:"button",accessibilityState:{selected:a},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>te(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:a?A.colours.goldTint:e?A.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:a?A.colours.gold:'transparent'}),children:[(0,K.jsx)(f.T,{size:14,weight:a?'semibold':'regular',colour:a?A.colours.gold:A.colours.text,style:{flex:1},numberOfLines:1,children:e}),s?(0,K.jsxs)(f.T,{size:11,colour:A.colours.muted,children:[(0,N.CMD)(),s]}):null]})},ge=({t:e})=>(0,K.jsx)(f.T,{size:11,weight:"semibold",colour:A.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),pe='owner'===g?'OWNER':'manager'===g?'MANAGER':'STAFF';return(0,K.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:A.colours.bg},testID:"desktop-shell",children:[(0,K.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,K.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(f.Row,{gap:10,children:[(0,K.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsx)(u.VenueName,{name:c.name}),(0,K.jsx)(f.Row,{gap:6,children:(0,K.jsx)(l.AppBadge,{label:pe})})]})]}),(0,K.jsx)(u.PoweredBy,{}),(0,K.jsx)(s.TextInput,{ref:oe,testID:"side-filter",value:se,onChangeText:ae,placeholder:`Find a page (${(0,N.CMD)()}K)`,placeholderTextColor:A.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,K.jsxs)(n.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[se?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{t:"Run the day"}),de.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:t+1},e.label)),(0,K.jsx)(ge,{t:"Drag-and-drop editors"}),ue.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:de.length+t+1},e.label))]}),Object.entries(le).map(([e,t])=>(0,K.jsxs)(r.default,{children:[(0,K.jsx)(ge,{t:e}),t.map(e=>(0,K.jsx)(fe,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{flex:1},children:[(0,K.jsx)(r.default,{testID:"desk-title",children:(0,K.jsx)(f.T,{size:24,weight:"bold",children:be??''})}),(0,K.jsxs)(f.Muted,{size:12,children:[Y?`Signed in as ${Y.name} \xb7 ${p.ROLE_LABEL[g]}`:`Preview \xb7 ${p.ROLE_LABEL[g]}`," \xb7 ",c.name]})]}),(0,K.jsxs)(r.default,{style:{alignItems:'flex-end'},children:[(0,K.jsx)(f.T,{size:15,weight:"bold",colour:A.colours.gold,children:"Talk to CoverCharge"}),(0,K.jsxs)(f.Muted,{size:12,children:["Hold Space, or ",(0,N.CMD)(),"\u21e7G"]})]}),(0,K.jsx)(v.VoiceSlot,{size:76})]}),(0,K.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[he?(0,K.jsx)(F.Tip,{children:he}):null,'edit'===ee.kind?(0,K.jsx)(J,{id:ee.id,rid:e,me:Q,role:'owner'===g?'owner':'manager',today:_,venue:c.name}):(0,K.jsxs)(n.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===ee.kind&&'home'===ee.tab?(0,K.jsx)(H.Dashboard,{go:ne}):null,'tab'===ee.kind&&'orders'===ee.tab?(0,K.jsx)(I.Orders,{}):null,'tab'===ee.kind&&'bookings'===ee.tab?(0,K.jsx)(R.Bookings,{}):null,'tab'===ee.kind&&'forecast'===ee.tab?(0,K.jsx)(P.Forecasts,{go:ne}):null,'tab'===ee.kind&&'chat'===ee.tab?(0,K.jsx)(M.Chat,{go:ne}):null,ce?(0,K.jsx)(ce.C,{go:ne}):'page'===ee.kind?(0,K.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,K.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==g?(0,K.jsx)(h.PrintHost,{rid:e}):null,'staff'!==g?(0,K.jsx)(b.AlertHost,{variant:"managers",rid:e,me:Q,onOpen:e=>ne('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,K.jsx)(L.AssistantSheet,{}),(0,K.jsx)(B.OnboardingHost,{go:ne}),(0,K.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),s=_r(d[1]),a=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),i=_r(d[6]),l=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]),f=_r(d[12]),g=_r(d[13]),p=_r(d[14]),x=_r(d[15]),m=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),S=_r(d[22]),v=_r(d[23]),T=_r(d[24]),E=_r(d[25]),D=_r(d[26]),A=_r(d[27]),L=_r(d[28]),R=_r(d[29]),M=_r(d[30]),z=_r(d[31]),H=_r(d[32]),P=_r(d[33]),B=_r(d[34]),I=_r(d[35]),O=_r(d[36]);_r(d[37]);var _=_r(d[38]),N=_r(d[39]),W=_r(d[40]),$=_r(d[41]),V=_r(d[42]),F=_r(d[43]),K=_r(d[44]);const G=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Hold Space and say \u201chow many Covers tonight?\u201d for a quick answer without leaving this screen.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first. Say \u201cshow new orders\u201d to jump back any time.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber. Hold Space and say \u201caccept the 7 o\u2019clock\u201d.'},{label:'Forecasts',s:{kind:'tab',tab:'forecast'},tip:'The forecast learns from your past weeks; the more you trade, the better it gets.'},{label:'Staff chat',s:{kind:'tab',tab:'chat'},tip:'Messages here go to staff in the Staff app only, never by text or WhatsApp.'}],U=[{label:'Table plan',s:{kind:'edit',id:'plan'},tip:''},{label:'Menu',s:{kind:'edit',id:'menu'},tip:''},{label:'Rota',s:{kind:'edit',id:'rota'},tip:''},{label:'Branding & Display',s:{kind:'edit',id:'brand'},tip:''}],q={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},X=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),Z=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function J({id:e,rid:t,me:s,role:o,today:n,venue:i}){const l=(0,g.usePlan)(t),[u,b]=(0,a.useState)(0),[h,p]=(0,a.useState)('');return'menu'===e?(0,K.jsx)($.MenuEditor,{rid:t,me:s,role:o}):'rota'===e?(0,K.jsx)(V.RotaEditor,{today:n}):'brand'===e?(0,K.jsx)(_.BrandEditor,{rid:t}):(0,K.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,K.jsxs)(F.Tip,{children:["Drag tables to move them; they snap to the grid and line up with their neighbours (gold lines). Hold Option (Alt) to move freely. \u201cTidy up\u201d lines up a whole area. ",(0,N.CMD)(),"Z undoes, then Save."]}),h?(0,K.jsx)(f.T,{size:13,colour:A.colours.goldLight,children:h}):null,(0,K.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:A.colours.border,borderRadius:12,overflow:'hidden'},children:(0,K.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{g.useFloor.getState().setPlan(t,e),p('Table plan saved. The Display uses it straight away.'),b(e=>e+1)},onCancel:()=>{p('Changes thrown away.'),b(e=>e+1)}},u)})]})}},1461,[798,796,34,402,295,102,36,1289,847,1292,1174,1310,794,1014,865,977,1048,1390,1087,1086,1085,1462,1400,1116,929,1176,2,840,1410,1340,1135,1100,1355,1392,1384,1394,1378,1395,1463,1460,1465,1467,1469,1466,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1462,[815]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandEditor=function({rid:e}){const w=(0,l.useBrand)(e),k=(0,u.useOwner)(t=>t.branding[e]?.recent)??[],[D,B]=(0,t.useState)(w.accent);(0,t.useEffect)(()=>B(w.accent),[w.accent]);const[S,v]=(0,t.useState)(!1),[O,C]=(0,t.useState)(''),P=(0,j.useHistory)(()=>{const t=u.useOwner.getState().branding[e];return t?{...t}:void 0},t=>{u.useOwner.getState().setBranding(e,null),t&&u.useOwner.getState().setBranding(e,t)},'branding'),R=(0,h.checkAccent)(D,x.colours.bg,x.colours.onGold,x.colours.text),T=async t=>{t.preventDefault(),v(!1);const o=(0,b.filesOf)(t)[0];if(o)try{const t=await(0,b.shrinkImage)(o,512,'image/png'===o.type?'image/png':'image/jpeg');P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:t}),C('Logo updated in all apps.')}catch{C('That picture couldn\u2019t be read.')}else C('Drop a picture file (PNG or JPEG).')};return(0,y.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:30},testID:"desk-brand",children:[(0,y.jsx)(f.Tip,{children:"Drop your logo from Finder onto the box, then pick an accent colour. \u2318Z undoes. Display layout settings are further down."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(n.default,{style:{flex:1}}),O?(0,y.jsx)(c.T,{size:13,colour:x.colours.goldLight,children:O}):null,(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"brand-undo"}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"brand-redo"})]}),(0,y.jsxs)(n.default,{style:{flexDirection:'row',gap:16,flexWrap:'wrap'},children:[(0,y.jsxs)(n.default,{style:{width:320,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Logo"}),(0,y.jsxs)("div",{"data-testid":"brand-logo-drop",onDragOver:e=>{(0,b.hasFiles)(e)&&(e.preventDefault(),v(!0))},onDragLeave:()=>v(!1),onDrop:e=>{T(e)},style:(0,f.box)({height:200,borderRadius:14,border:`2px dashed ${S?x.colours.gold:x.colours.accentBorder}`,background:S?x.colours.accentBg:x.colours.surface,display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',gap:10}),children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:96}),(0,y.jsx)("span",{style:(0,f.box)({fontSize:13,color:x.colours.muted}),children:"Drop a logo here (PNG with a clear background is best)"})]}),w.custom&&u.useOwner.getState().branding[e]?.logoUri?(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Use the standard logo",onPress:()=>{P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:void 0})}}):null,(0,y.jsx)(c.T,{weight:"semibold",children:"Preview"}),(0,y.jsxs)(n.default,{style:{backgroundColor:x.colours.bg,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12,gap:8},children:[(0,y.jsxs)(c.Row,{gap:10,children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:44}),(0,y.jsx)(c.T,{weight:"bold",children:w.name})]}),(0,y.jsx)(n.default,{style:{backgroundColor:D,borderRadius:10,padding:10,alignItems:'center'},children:(0,y.jsx)(c.T,{weight:"semibold",colour:R.onAccent,children:"Book a table"})})]})]}),(0,y.jsxs)(n.default,{style:{width:380,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Accent colour"}),(0,y.jsx)(s.ColourPicker,{value:D,onChange:B,onCommit:t=>{t!==w.accent&&(P.record('accent colour'),u.useOwner.getState().setBranding(e,{accent:t,recent:(0,h.pushRecent)(k,t)}),C(`Accent set to ${t}.`))},quick:l.ACCENTS,recent:k}),R.tips.length?(0,y.jsx)(c.Banner,{kind:"warn",children:R.tips.join(' ')}):(0,y.jsx)(c.Muted,{size:12,children:"Easy to read on the dark background."})]})]}),(0,y.jsxs)(n.default,{style:{maxWidth:760,gap:8},children:[(0,y.jsx)(c.T,{size:18,weight:"bold",children:"Display layout"}),(0,y.jsx)(p.DisplaySettingsPage,{})]})]})};var t=r(d[0]),o=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]),p=r(d[8]),x=r(d[9]),b=r(d[10]),j=r(d[11]),f=r(d[12]),y=r(d[13])},1463,[34,295,102,1419,847,794,865,799,1379,840,1464,1465,1466,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dragData",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"readDrag",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"filesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"hasFiles",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"readDataUrl",{enumerable:!0,get:function(){return i}}),_e.shrinkImage=async function(e,t=1024,r="image/jpeg"){const n=await i(e),o=await new Promise((e,t)=>{const r=new Image;r.onload=()=>e(r),r.onerror=t,r.src=n}),s=Math.min(1,t/Math.max(o.width,o.height)),c=document.createElement('canvas');return c.width=Math.round(o.width*s),c.height=Math.round(o.height*s),c.getContext('2d').drawImage(o,0,0,c.width,c.height),c.toDataURL(r,.82)};const e=(e,t,r)=>{try{e.dataTransfer.setData('text/plain',`${t}:${r}`),e.dataTransfer.effectAllowed='copyMove'}catch{}},t=e=>{const t=e.dataTransfer?.getData('text/plain')??'',r=t.indexOf(':');return r>0?{kind:t.slice(0,r),id:t.slice(r+1)}:null},r=e=>Array.from(e.dataTransfer?.files??[]).filter(e=>/^image\//.test(e.type)),n=e=>Array.from(e.dataTransfer?.types??[]).includes('Files'),i=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error),n.readAsDataURL(e)})},1464,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"activeUndo",{enumerable:!0,get:function(){return u}}),e.useHistory=function(u,c,s="change",l=60){const o=(0,t.useRef)([]),f=(0,t.useRef)([]),[,h]=(0,t.useState)(0),[v,b]=(0,t.useState)(''),w=(0,t.useRef)(u);w.current=u;const R=(0,t.useRef)(c);R.current=c;const p=(0,t.useCallback)((t=s)=>{o.current=[...o.current,{v:w.current(),what:t}].slice(-l),f.current=[],b(t),h(t=>t+1)},[s,l]),_=(0,t.useCallback)(()=>{const t=o.current.pop();t&&(f.current.unshift({v:w.current(),what:t.what}),R.current(t.v),b(`Undid: ${t.what}`),h(t=>t+1))},[]),k=(0,t.useCallback)(()=>{const t=f.current.shift();t&&(o.current.push({v:w.current(),what:t.what}),R.current(t.v),b(`Redid: ${t.what}`),h(t=>t+1))},[]),y={undo:_,redo:k,canUndo:o.current.length>0,canRedo:f.current.length>0,label:s,record:p,last:v};return(0,t.useEffect)(()=>(n=y,()=>{n===y&&(n=null)})),y};var t=r(d[0]);let n=null;const u=()=>n},1465,[34]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Tip=function({children:e}){return(0,c.jsxs)(t.default,{testID:"desk-tip",style:{flexDirection:'row',gap:8,alignItems:'flex-start',borderWidth:1,borderColor:n.colours.accentBorder,backgroundColor:n.colours.accentBg,borderRadius:10,paddingHorizontal:12,paddingVertical:8},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:n.colours.gold,children:"Tip"}),(0,c.jsx)(l.T,{size:13,colour:n.colours.text,style:{flex:1},children:e})]})},Object.defineProperty(_e,"box",{enumerable:!0,get:function(){return s}}),r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},l=r(d[2]),n=r(d[3]),c=r(d[4]);const s=(e={})=>({fontFamily:'Poppins_400Regular',color:n.colours.text,boxSizing:'border-box',...e})},1466,[34,102,794,840,25]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuEditor=function({rid:e,me:o,role:s}){const a=(0,d.useAllMenu)(e),c=(0,l.useStore)(o=>o.restaurants.find(o=>o.id===e)),[u,h]=(0,t.useState)('dishes'),[D,O]=(0,t.useState)(null),[k,w]=(0,t.useState)(null),[C,I]=(0,t.useState)(''),z=(0,t.useMemo)(()=>{const e=[...c?.sections??[]];return a.forEach(o=>{e.includes(o.section)||e.push(o.section)}),e},[c?.sections,a]),M=a.filter(e=>!e.hidden||e.recipeCardId),P=e=>(0,p.hasRecipeCards)()?(0,p.recipeCards)().byMenuItem(e):void 0,T={name:o,role:s},R=(0,b.useHistory)(()=>({sections:[...z],items:Object.fromEntries(l.useStore.getState().menu.filter(o=>o.restaurantId===e).map(e=>{const o=a.find(o=>o.id===e.id)??e;return[e.id,{section:o.section,sort:e.sort,price:o.price,allergens:{...o.allergens},soldOut:e.soldOut,photo:P(e.id)?.photo}]}))}),o=>{const t=l.useStore.getState();c&&o.sections.join('|')!==(c.sections??[]).join('|')&&t.updateRestaurant(e,{sections:o.sections});for(const[e,s]of Object.entries(o.items)){const o=a.find(o=>o.id===e),n=t.menu.find(o=>o.id===e);if(!o||!n)continue;const r={};o.section!==s.section&&(r.section=s.section),n.sort!==s.sort&&(r.sort=s.sort),o.price!==s.price&&(r.price=s.price),JSON.stringify(o.allergens)!==JSON.stringify(s.allergens)&&(r.allergens=s.allergens),n.soldOut!==s.soldOut&&(r.soldOut=s.soldOut),Object.keys(r).length&&t.updateMenuItem(e,r);const d=P(e);d&&d.photo!==s.photo&&(0,p.recipeCards)().update(d.id,{photo:s.photo},T)}},'menu change'),B=(e,o,t)=>{const s=a.find(o=>o.id===e);if(!s)return;R.record(`moved ${s.name}`);const n=l.useStore.getState(),r=a.map(t=>t.id===e?{...t,section:o}:t);s.section!==o&&n.updateMenuItem(e,{section:o}),(0,y.reorder)(r,e,o,t).forEach(e=>n.updateMenuItem(e.id,{sort:e.sort})),I(`${s.name} moved${s.section!==o?` to ${o}`:''}.`)},F=async(o,t)=>{const s=P(o),n=a.find(e=>e.id===o);if(s&&n)try{const o=await(0,f.shrinkImage)(t,1024);R.record(`photo for ${n.name}`);const r=await(0,p.recipeCards)().savePhoto(e,s.id,{dataUrl:o,width:0,height:0,bytes:Math.round(.75*o.length)});await(0,p.recipeCards)().update(s.id,{photo:r},T),I(`Photo added to ${n.name}. The dish needs the Head Chef\u2019s sign-off again.`)}catch{I('That picture couldn\u2019t be read. Try a JPEG or PNG.')}else I('This dish has no recipe card yet, so it can\u2019t hold a photo.')},_=a.find(e=>e.id===D),E=({m:e})=>{const o=P(e.id),t=o?.photo&&(0,p.hasRecipeCards)()?(0,p.recipeCards)().photoSource(o.photo):null,s=t?.uri,n=D===e.id,r=k===`d:${e.id}`;return(0,S.jsxs)("div",{"data-testid":`menu-dish-${e.id}`,draggable:!0,onDragStart:o=>(0,f.dragData)(o,'dish',e.id),onClick:()=>O(e.id),onDragOver:o=>{o.preventDefault(),w(`d:${e.id}`)},onDragLeave:()=>w(null),onDrop:o=>{o.preventDefault(),o.stopPropagation(),w(null);const t=(0,f.filesOf)(o)[0];if(t)return void F(e.id,t);const s=(0,f.readDrag)(o);'dish'===s?.kind&&s.id!==e.id&&B(s.id,e.section,e.id)},style:(0,j.box)({display:'flex',alignItems:'center',gap:10,padding:'8px 10px',borderRadius:10,cursor:'grab',userSelect:'none',marginBottom:6,background:n?x.colours.goldTint:x.colours.tile,border:`1px solid ${r?x.colours.gold:n?x.colours.accentBorder:x.colours.hairline}`,borderTop:r?`3px solid ${x.colours.gold}`:void 0}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted,fontSize:16}),children:"\u283f"}),(0,S.jsx)("div",{style:(0,j.box)({width:40,height:40,borderRadius:8,background:x.colours.surface2,backgroundImage:s?`url(${s})`:void 0,backgroundSize:'cover',backgroundPosition:'center',flexShrink:0,display:'flex',alignItems:'center',justifyContent:'center',fontSize:10,color:x.colours.muted}),children:s?'':'photo'}),(0,S.jsxs)("div",{style:(0,j.box)({flex:1,minWidth:0}),children:[(0,S.jsx)("div",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',fontSize:14,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',textDecoration:e.soldOut?'line-through':void 0}),children:e.name}),(0,S.jsxs)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[Object.keys(e.allergens).length?Object.keys(e.allergens).length+' allergens':'No allergens',e.hidden?' \xb7 hidden':'']})]}),e.soldOut?(0,S.jsx)("span",{style:(0,j.box)({fontSize:11,color:x.colours.amber,border:`1px solid ${x.colours.amber}`,borderRadius:6,padding:'1px 6px'}),children:"Sold out"}):null,(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',color:x.colours.gold,fontSize:14}),children:v(e.price)})]})};return(0,S.jsxs)(n.default,{style:{flex:1,gap:10},testID:"desk-menu",children:[(0,S.jsx)(j.Tip,{children:"Drag a dish (\u283f) to put it in order or onto another section. Drag a section name to move the whole section. Drop a photo from Finder onto a dish. \u2318Z undoes."}),(0,S.jsxs)(r.Row,{gap:8,children:[(0,S.jsx)(r.Chip,{label:"Dishes",selected:'dishes'===u,onPress:()=>h('dishes'),testID:"menu-tab-dishes"}),(0,S.jsx)(r.Chip,{label:"Sold out & counts",selected:'soldout'===u,onPress:()=>h('soldout'),testID:"menu-tab-soldout"}),(0,S.jsx)(n.default,{style:{flex:1}}),C?(0,S.jsx)(r.T,{size:13,colour:x.colours.goldLight,children:C}):null,(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!R.canUndo,onPress:R.undo,testID:"menu-undo"}),(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!R.canRedo,onPress:R.redo,testID:"menu-redo"})]}),'soldout'===u?(0,S.jsx)(n.default,{style:{maxWidth:760},children:(0,S.jsx)(m.SoldOutList,{rid:e,by:o})}):(0,S.jsxs)(n.default,{style:{flex:1,flexDirection:'row',gap:14,minHeight:0},children:[(0,S.jsx)("div",{style:(0,j.box)({flex:1,overflowY:'auto',paddingRight:6}),"data-testid":"menu-sections",children:z.map(o=>{const t=M.filter(e=>e.section===o),s=k===`s:${o}`;return(0,S.jsxs)("div",{style:(0,j.box)({marginBottom:14}),onDragOver:e=>{e.preventDefault(),w(`s:${o}`)},onDragLeave:()=>w(null),onDrop:t=>{t.preventDefault(),w(null);const s=(0,f.readDrag)(t);var n,r;'dish'===s?.kind&&B(s.id,o,null),'section'===s?.kind&&s.id!==o&&(n=s.id,r=o,c&&(R.record(`moved section ${n}`),l.useStore.getState().updateRestaurant(e,{sections:(0,y.moveSection)(z,n,r)}),I(`${n} moved.`)))},children:[(0,S.jsxs)("div",{draggable:!0,onDragStart:e=>(0,f.dragData)(e,'section',o),"data-testid":`menu-section-${o}`,style:(0,j.box)({display:'flex',alignItems:'center',gap:8,padding:'6px 4px',cursor:'grab',borderBottom:`${s?2:1}px solid ${s?x.colours.gold:x.colours.border}`,marginBottom:8}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted}),children:"\u283f"}),(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_700Bold',fontSize:16,color:x.colours.goldMuted,letterSpacing:.5,textTransform:'uppercase'}),children:o}),(0,S.jsxs)("span",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[t.length," dishes"]})]}),t.map(e=>(0,S.jsx)(E,{m:e},e.id)),t.length?null:(0,S.jsx)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted,padding:8,border:`1px dashed ${x.colours.border}`,borderRadius:8}),children:"Drop a dish here"})]},o)})}),(0,S.jsx)(n.default,{style:{width:340,gap:10},testID:"menu-inspector",children:_?(0,S.jsx)($,{rid:e,m:_,me:o,record:R.record,onPhoto:e=>{F(_.id,e)}},_.id):(0,S.jsx)(r.Muted,{children:"Click a dish to change its price, allergens and sold-out state."})})]})]})};var e,o=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),n=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),m=_r(_d[11]),x=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),S=_r(_d[17]);const v=e=>null==e?'Board':`\xa3${(e/100).toFixed(2)}`,D={none:'contains',contains:'may',may:void 0};function $({rid:e,m:s,me:d,record:p,onPhoto:m}){const[b,y]=(0,t.useState)(null==s.price?'':(s.price/100).toFixed(2)),v=(e,o)=>{p(o),l.useStore.getState().updateMenuItem(s.id,e)},$=(0,c.dishUsesFor)(e).find(e=>e.id===s.id),O=(0,c.itemsFor)(e),k=()=>{const e=b.trim(),o=''===e?null:Number(e.replace('\xa3',''));if(null!==o&&(!isFinite(o)||o<0))return void y(null==s.price?'':(s.price/100).toFixed(2));const t=null==o?null:Math.round(100*o);t!==s.price&&v({price:t},`price of ${s.name}`)},w=e=>{const o=s.allergens[e]??'none',t=D[o],n={...s.allergens};t?n[e]=t:delete n[e],v({allergens:n},`allergens on ${s.name}`)};return(0,S.jsxs)(n.default,{style:{gap:10,backgroundColor:x.colours.surface,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12},children:[(0,S.jsx)(r.T,{size:17,weight:"bold",children:s.name}),(0,S.jsxs)(r.Muted,{size:12,children:[s.section,s.signOff?` \xb7 signed off by ${s.signOff.by}`:' \xb7 awaiting Head Chef sign-off']}),(0,S.jsx)("div",{onDragOver:e=>{(0,f.hasFiles)(e)&&e.preventDefault()},onDrop:e=>{e.preventDefault();const o=(0,f.filesOf)(e)[0];o&&m(o)},"data-testid":"menu-photo-drop",style:(0,j.box)({border:`1px dashed ${x.colours.accentBorder}`,borderRadius:10,padding:12,textAlign:'center',fontSize:12,color:x.colours.muted}),children:"Drop a photo from Finder here"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Price (\xa3)"}),(0,S.jsx)(o.TextInput,{testID:"menu-price",value:b,onChangeText:y,onBlur:k,onSubmitEditing:k,placeholder:"Blank = on the specials board",placeholderTextColor:x.colours.muted,style:[r.styles.input,{width:160}]})]}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Allergens"}),(0,S.jsx)(r.Muted,{size:12,children:"Click to cycle: contains \u2192 may contain \u2192 none. Changes go to the recipe card and need the Head Chef\u2019s sign-off."}),(0,S.jsx)(r.Row,{gap:6,wrap:!0,children:h.ALLERGENS.map(e=>{const o=s.allergens[e.id];return(0,S.jsx)(r.Chip,{testID:`menu-al-${e.id}`,label:'may'===o?`${e.short} (may)`:e.short,selected:!!o,onPress:()=>w(e.id)},e.id)})})]}),(0,S.jsx)(r.Toggle,{label:"Sold out now",value:s.soldOut,onChange:e=>{p(`sold out ${s.name}`),(0,a.setSoldOut)(s.id,e,d)},testID:"menu-soldout"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Sold-out link"}),$&&$.uses.length?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r.Muted,{size:12,children:(0,u.usesText)($.uses,O)}),(0,S.jsx)(r.Badge,{kind:"gold",label:"Sells out on its own when the count runs out"})]}):(0,S.jsx)(r.Muted,{size:12,children:"Not linked to a count. Link it in \u201cSold out & counts\u201d."})]})]})}},1467,[796,34,102,794,850,800,977,979,980,830,856,1130,840,1464,1465,1466,1468,25]); -__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1468,[865]); -__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const y=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[$,j]=(0,t.useState)((0,i.mondayOfDate)(e)),[v,k]=(0,t.useState)(null),[w,D]=(0,t.useState)(''),B=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),O=b.map((e,t)=>(0,i.addDays)($,t)),P=(e,t,o)=>{e.preventDefault(),k(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=y.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=$&&e.date<=O[6]),I=T.filter(e=>!e.published||e.changed).length;return(0,p.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,p.jsx)(h.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,p.jsxs)(s.Row,{gap:8,children:[(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>j((0,i.addDays)($,-7))}),(0,p.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date($+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>j((0,i.addDays)($,7))}),(0,p.jsx)(d.default,{style:{flex:1}}),w?(0,p.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:w}):null,(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!B.canUndo,onPress:B.undo,testID:"rota-undo"}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!B.canRedo,onPress:B.redo,testID:"rota-redo"}),(0,p.jsx)(s.Button,{small:!0,label:I?`Publish (${I})`:'Published',disabled:!I,onPress:()=>{B.record('published the week');const e=i.useOwner.getState().publishWeek($);D(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,p.jsx)("div",{style:(0,h.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,p.jsxs)("div",{style:(0,h.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,p.jsx)("div",{style:(0,h.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),O.map((t,o)=>(0,p.jsxs)("div",{style:(0,h.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[b[o]," ",Number(t.slice(8))]},t)),y.map(e=>(0,p.jsxs)(o.default.Fragment,{children:[(0,p.jsxs)("div",{style:(0,h.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,p.jsx)("div",{style:(0,h.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,p.jsx)("div",{style:(0,h.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),O.map(t=>{const o=`${e.id}|${t}`,d=T.filter(o=>o.staffId===e.id&&o.date===t);return(0,p.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',k(o)},onDragLeave:()=>k(null),onDrop:o=>P(o,e.id,t),style:(0,h.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,p.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,h.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,p.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]),f=r(_d[9]),p=r(_d[10]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1469,[34,102,794,865,1103,840,1464,1465,1466,1468,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=W,_e.CarApp=function(){const{width:e,height:d}=(0,l.default)(),{role:h,today:b,now:x}=(0,f.useCtx)(3e4),[w,B]=(0,t.useState)(d),H=(0,D.railSizes)(e,w),z=Math.max(320,e-H.railW),[M,P]=(0,t.useState)(null),[A,_]=(0,t.useState)(null),[N,E]=(0,t.useState)(!1),[U,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,f.ensureAttendance)(b,x),(0,u.ensureChat)(x)},[b]),(0,t.useEffect)(()=>{W().then(_)},[]),(0,t.useEffect)(()=>{if(I.PITCH)return;const e=setInterval(()=>{(0,C.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==h&&j.useOwner.getState().setPreviewRole('owner')},[h]);const F=(0,t.useCallback)(()=>P(null),[]);(0,p.useBackLayer)(!!M,F);const Y=e=>P({btn:e,page:e.pages[0].id}),G=(0,t.useCallback)((e,t)=>{const n=e=>D.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return P(null);if('bookings'===e)return P({btn:n('@bookings'),page:'@bookings'});if('chat'===e)return P({btn:n('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return P(t=>({btn:t?.btn??D.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=n(t);return P(n=>({btn:e??n?.btn??D.CAR_BUTTONS[0],page:t}))}P(null)},[]),q=z<1400?z:Math.round(Math.min(z,Math.max(960,.72*z))),J=M?M.btn.pages.find(e=>e.id===M.page)?.label??(0,c.pageFor)(M.page)?.title??M.btn.label:'';return(0,v.jsxs)(s.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-w)>1&&B(t)},style:{flex:1,flexDirection:'row',backgroundColor:T.colours.bg,minHeight:0},children:[(0,v.jsxs)(s.default,{testID:"car-board",style:{width:z,minWidth:0,minHeight:0},children:[(0,v.jsx)(a.DisplayBoard,{embedded:!0,noVoice:!0,boardW:z,headerExtra:(0,v.jsx)(S.ParkedOnly,{small:e<1400}),subHeader:(0,v.jsx)($,{onRota:()=>Y(D.CAR_BUTTONS[0]),onAccount:()=>E(!0)})}),M?(0,v.jsxs)(s.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:q,zIndex:40,backgroundColor:T.colours.bg,borderLeftWidth:1,borderColor:T.colours.gold,boxShadow:'-18px 0 40px rgba(0,0,0,0.55)'},children:[(0,v.jsxs)(s.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,v.jsx)(n.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${J}, back to the board`,onPress:()=>{(0,p.runBackLayer)()||F()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:T.colours.border,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(y.T,{weight:"semibold",center:!0,children:"Close"})}),(0,v.jsx)(s.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,v.jsx)(y.T,{size:20,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:M.btn.label})}),(0,v.jsx)(s.default,{style:{minWidth:96}})]}),M.btn.pages.length>1?(0,v.jsx)(s.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:M.btn.pages.map(e=>{const t=e.id===M.page;return(0,v.jsx)(n.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>P({btn:M.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?T.colours.gold:T.colours.border,backgroundColor:t?R:'transparent',alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(y.T,{weight:"semibold",colour:t?T.colours.goldLight:T.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,v.jsx)(o.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:'assistant'===M.page&&!1===A?(0,v.jsx)(L,{}):(0,v.jsx)(O,{id:M.page,go:G},M.page)})]}):null]}),(0,v.jsxs)(s.default,{testID:"car-rail",accessibilityRole:"toolbar",accessibilityLabel:"Owner tools",style:{width:H.railW,borderLeftWidth:1,borderColor:T.colours.border,backgroundColor:'#0A0A0A',paddingTop:6,paddingBottom:6,alignItems:'stretch',minHeight:0},children:[(0,v.jsx)(s.default,{style:{height:32,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(y.T,{size:11,weight:"semibold",colour:T.colours.goldMuted,center:!0,style:{letterSpacing:1},children:"OWNER"})}),(0,v.jsx)(s.default,{style:{flex:1,justifyContent:'space-between',minHeight:0},children:D.CAR_BUTTONS.map(e=>{const t=M?.btn.id===e.id;return(0,v.jsxs)(n.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>t?F():Y(e),style:{height:H.per,alignItems:'center',justifyContent:'center',gap:2},children:[(0,v.jsx)(s.default,{style:{width:H.circle,height:H.circle,borderRadius:H.circle/2,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:t?T.colours.gold:R,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(k.CarGlyph,{name:e.icon,size:H.icon,colour:t?'#0B0B0B':T.colours.goldLight})}),(0,v.jsx)(y.T,{size:H.label,weight:t?'semibold':'medium',colour:t?T.colours.goldLight:T.colours.text,center:!0,numberOfLines:1,children:H.railW<150?e.short:e.label})]},e.id)})})]}),N?(0,v.jsxs)(y.Sheet,{visible:!0,onClose:()=>E(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,v.jsx)(y.T,{center:!0,children:"This car is signed in to The Anchorage as you, with your own rights. Use it only when the car is in Park."}),(0,v.jsx)(y.Muted,{center:!0,children:"To sign it out from your phone: Managers, More, Car screen."}),(0,v.jsx)(y.Button,{testID:"car-sign-out",kind:"secondary",label:"Sign this car out",onPress:()=>{E(!1),V(!0)},style:{minHeight:56}}),(0,v.jsx)(y.Button,{kind:"ghost",label:"Close",onPress:()=>E(!1),style:{minHeight:56}})]}):null,U?(0,v.jsxs)(y.Sheet,{visible:!0,onClose:()=>V(!1),title:"Sign this car out?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,v.jsx)(y.T,{center:!0,children:"You\u2019ll need a new code, approved on your phone, to use it again."}),(0,v.jsx)(y.Button,{testID:"car-sign-out-yes",label:"Yes, sign this car out",onPress:()=>{V(!1),(0,C.carSignOut)()},style:{minHeight:56}}),(0,v.jsx)(y.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]);r(_d[1]);var n=e(r(_d[2])),o=e(r(_d[3])),s=e(r(_d[4])),l=e(r(_d[5])),a=r(_d[6]),c=r(_d[7]);r(_d[8]);var d=r(_d[9]),u=r(_d[10]),h=r(_d[11]),b=r(_d[12]),f=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),w=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),S=r(_d[24]),B=r(_d[25]),v=r(_d[26]);const R='rgba(201,162,74,0.14)';async function W(){try{const e='undefined'!=typeof navigator?navigator.mediaDevices:null;if(!e?.getUserMedia||!e?.enumerateDevices)return!1;return(await e.enumerateDevices()).some(e=>'audioinput'===e.kind)}catch{return!1}}function $({onRota:e,onAccount:o}){const l=(0,f.useSignedIn)(),a=(0,j.useOwner)(e=>e.attendance),c=(0,j.useOwner)(e=>e.staff),[d,u]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>u(Date.now()),3e4);return()=>clearInterval(e)},[]);const h=a.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(c.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),b=[...new Set(h)],p=b.length?`On now: ${b.join(' \xb7 ')}`:'Nobody clocked in';return(0,v.jsxs)(s.default,{testID:"car-strip",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,v.jsx)(n.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${p}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,v.jsx)(y.T,{size:14,weight:"semibold",colour:T.colours.goldLight,numberOfLines:1,center:!0,children:p})}),l?(0,v.jsx)(n.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:`Signed in as ${l.name}. Car sign-in options.`,onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:T.colours.gold,flexShrink:0},children:(0,v.jsxs)(y.T,{size:13,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,children:[l.name.replace(' (example)','')," \u25be"]})}):null,(0,v.jsx)(B.CarGameButton,{})]})}function H({go:e}){const{rid:t,now:n}=(0,f.useCtx)(3e4),o=(0,x.useBookings)(t),l=(0,w.ymd)(n),a=(0,w.ymd)(new Date(n.getTime()-24192e5)),c=o.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=l).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),d=o.filter(e=>e.date===l&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,v.jsxs)(s.default,{testID:"car-noshows",style:{gap:10},children:[(0,v.jsx)(y.T,{center:!0,size:18,weight:"semibold",colour:T.colours.goldLight,children:c.length?`${c.length} no-show${1===c.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),d.length?(0,v.jsxs)(s.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:T.colours.amber,borderRadius:12,padding:12},children:[(0,v.jsx)(y.T,{center:!0,weight:"semibold",colour:T.colours.amber,children:"Running more than 15 minutes late"}),d.map(e=>(0,v.jsx)(y.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,v.jsx)(y.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,c.map(e=>(0,v.jsxs)(s.default,{style:{borderWidth:1,borderColor:T.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,v.jsx)(y.T,{center:!0,weight:"semibold",children:`${e.date===l?'Today':(0,w.niceDate)((0,w.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,v.jsx)(y.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,v.jsx)(y.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function L(){return(0,v.jsxs)(s.default,{testID:"car-no-mic",accessibilityLiveRegion:"polite",style:{gap:10,alignItems:'center',paddingVertical:24},children:[(0,v.jsx)(y.T,{center:!0,size:20,weight:"semibold",colour:T.colours.goldLight,children:"The Assistant needs the car\u2019s microphone"}),(0,v.jsx)(y.Muted,{center:!0,style:{maxWidth:520},children:"Sorry, this car\u2019s browser isn\u2019t letting the page use a microphone. For now, please use the Assistant in Managers on your phone."})]})}function O({id:e,go:t}){if('@bookings'===e)return(0,v.jsx)(d.Bookings,{go:t});if('@chat'===e)return(0,v.jsx)(u.Chat,{go:t});if('@noshows'===e)return(0,v.jsx)(H,{go:t});if('@orders'===e)return(0,v.jsx)(h.Orders,{});if('@forecast'===e)return(0,v.jsx)(b.Forecasts,{go:t});const n=(0,c.pageFor)(e);if(!n)return(0,v.jsx)(y.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const o=n.C;return(0,v.jsx)(o,{go:t})}},1470,[34,236,402,295,102,426,1278,1378,1395,1340,1135,1394,1392,1100,1041,794,848,865,827,985,2,840,1471,1472,1473,1474,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),e.railSizes=function(s,o){const l=s>=1600?168:s>=1200?136:120,t=Math.floor((o-44)/12),n=Math.max(44,Math.min(72,t-18));return{railW:l,per:t,circle:n,label:t>=80?13:t>=66?11:10,icon:Math.round(.46*n)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return o}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}];const o=s=>s.split('').join(' ')},1471,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGlyph=function({name:e,size:x,colour:n}){const c={stroke:n,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'},l={rota:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h3M14 14h3M7 17h3",...c})]}),signoff:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...c}),(0,h.jsx)(s.Path,{d:"M12 7v5l3 2",...c}),(0,h.jsx)(s.Path,{d:"M15.5 18.5l1.8 1.8 3.4-3.6",...c})]}),menu:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M6 3v8a2 2 0 0 0 2 2v8M10 3v8a2 2 0 0 1-2 2M8 3v6",...c}),(0,h.jsx)(s.Path,{d:"M16 21V3c2.5 1.5 3 5 3 8h-3",...c})]}),bookings:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...c})]}),noshow:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...c}),(0,h.jsx)(s.Path,{d:"M3 21c0-4 3-6 7-6s7 2 7 6M17 9l4 4M21 9l-4 4",...c})]}),chat:(0,h.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...c}),stock:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M3 7l9-4 9 4-9 4z",...c}),(0,h.jsx)(s.Path,{d:"M3 7v10l9 4 9-4V7M12 11v10",...c})]}),loyalty:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"2",...c}),(0,h.jsx)(s.Circle,{cx:"8",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"16",cy:"12",r:"1.5",...c})]}),takings:(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...c})}),safety:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M10 14V5a2 2 0 0 1 4 0v9a4 4 0 1 1-4 0z",...c}),(0,h.jsx)(s.Path,{d:"M12 9v7",...c})]}),reviews:(0,h.jsx)(s.Path,{d:"M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z",...c}),assistant:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",...c}),(0,h.jsx)(s.Path,{d:"M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6",...c})]})};return(0,h.jsx)(t.default,{width:x,height:x,viewBox:"0 0 24 24",children:l[e]})},_e.GameGlyph=function({size:e,colour:x}){const n={stroke:x,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,h.jsxs)(t.default,{width:e,height:e,viewBox:"0 0 24 24",children:[(0,h.jsx)(s.Path,{d:"M7 8h10a4 4 0 0 1 4 4v3a3 3 0 0 1-5.4 1.8L14.5 15h-5l-1.1 1.8A3 3 0 0 1 3 15v-3a4 4 0 0 1 4-4z",...n}),(0,h.jsx)(s.Path,{d:"M7 11v3M5.5 12.5h3",...n}),(0,h.jsx)(s.Circle,{cx:"16",cy:"11.5",r:"0.9",...n}),(0,h.jsx)(s.Circle,{cx:"18",cy:"13.5",r:"0.9",...n})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},h=r(d[2])},1472,[34,900,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1473,[34,102,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGameButton=function(){const e=(0,c.useStore)(e=>!1!==e.restaurants.find(e=>e.id===y.VENUE_RID)?.settings?.games),C=(0,f.useSession)(e=>e.meId),_=(0,b.useSignedIn)(),[p,G]=(0,n.useState)(!1),[I]=(0,n.useState)(()=>new Date),S=(0,l.useGameClock)(C,p?new Date:I);return e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(t.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>G(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:j.colours.gold,flexShrink:0},children:(0,x.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6},children:[(0,x.jsx)(o.GameGlyph,{size:18,colour:j.colours.gold}),(0,x.jsx)(h.T,{size:13,weight:"semibold",colour:j.colours.gold,center:!0,numberOfLines:1,children:"Game"})]})}),p?(0,x.jsx)(l.BreakRoom,{car:!0,staffId:C??null,name:_?.name??'Owner',playable:(0,u.gamePlayable)(S),clock:S,onClose:()=>G(!1)}):null]}):null};var n=r(d[0]),t=e(r(d[1])),s=e(r(d[2])),o=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),f=r(d[7]),b=r(d[8]),y=r(d[9]),h=r(d[10]),j=r(d[11]),x=r(d[12])},1474,[34,402,102,1472,1137,1138,800,997,1100,5,794,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1475,[30,34,846,1476,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1476,[1379,1477,798,991,1073,1427,1160,1040,1041,1428,1451,1430,1130,977,1042,2,1047,1048,1404,993,34,1132,1185,1189,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1340,1070,1085,1086,1082,1043,1025,1100,1422,1417,1436,1478,1348,997,236,1191,1145,1151,1377,1155,1154,1391,1148,15,1161,1162,899,793,985,25]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1477,[34,102,794,1100,985,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1478,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); -__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]})}},1479,[30,34,846,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1480,[1373,985,795,1334,1481,1011,30,1508,496,34,385,336,236,41,102,5,847,846,1510,36,848,1014,865,840,1348,997,1010,1511,1512,1513,1514,1099,2,1024,1516,1303,25,1517,1518,1519,1520]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1481,[1482,1505,1507]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1482,[215,1483,1486,1500,1501,1502,1503,1504]); -__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1483,[215,1484]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1484,[1485]); -__d(function(g,r,i,a,m,e,d){},1485,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1486,[1487,215,1483,1500,1501]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1487,[1488,1489,1499]); -__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1488,[1489,1493,1498]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1489,[215,372,1490,1494,1495,1496,1497,1493,1498]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1490,[215,1491,339,280,1492,1493]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1491,[504]); -__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1492,[215,339]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1493,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1494,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1495,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1496,[1494]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1497,[]); -__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1498,[372,1492]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1499,[34,1489]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1500,[1487,215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1501,[1487,1500]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1502,[1483]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1503,[215,1483,1486,1484]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1504,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1505,[215,54,1506]); -__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1506,[215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1507,[34,1482]); -__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]}})})},1508,[1509]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1509,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1510,[34,41,102,426,794,847,997,985,2,5,840,1471,1473,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1511,[986,857,856,985]); -__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1512,[798,796,34,1380,1015,402,102,846,985,1007,1014,5,840,794,1286,974,2,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1513,[796,34,236,402,102,840,985,1045,2,25]); -__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1514,[5,796,34,385,283,364,380,236,402,295,426,102,1410,1116,2,900,1100,15,865,794,840,1441,930,1515,1439,1440,1400,1117,1408,929,1462,1449,25,277]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1515,[865,800,1014]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=f(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),A=[],k=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);i.includes(c)||(A.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0}),d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:u(d,23.5)}:void 0}):d===y&&e<=m&&k.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:u(d,e-.05),inSite:!0}))}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!A.some(e=>e.staffId===t.staffId&&e.date===t.date)),...A],attendance:[...S.attendance,...k]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:u(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:u((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',f=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,u=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1516,[848,800,865,1024,15,997,846]); -__d(function(e,o,s,p,t,a,n){"use strict";t.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1517,[]); -__d(function(o,s,e,p,c,t,d){"use strict";c.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1518,[]); -__d(function(o,s,e,p,t,d,f){"use strict";t.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1519,[]); -__d(function(o,s,p,d,e,t,n){"use strict";e.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1520,[]); -__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]})}},1521,[30,34,846,25]); -__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1522,[1523]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1523,[25,1524,591]); -__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1524,[34,172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1525,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1526,[25,499,34,270,651]); +__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]})}},1337,[30,34,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1338,[30,34,1339,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1339,[34,846,1340,1473,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnerApp=function(){return(0,ie.isDesktop)()?(0,de.jsx)(le.DesktopShell,{}):(0,de.jsx)(he,{})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),n=_r(d[3]),r=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),x=_r(d[13]),j=e(_r(d[14])),w=e(_r(d[15])),y=e(_r(d[16])),S=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),I=_r(d[24]),L=_r(d[25]),E=_r(d[26]),B=_r(d[27]),O=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var M=_r(d[33]),H=_r(d[34]),V=_r(d[35]),D=_r(d[36]),W=_r(d[37]),$=_r(d[38]),z=_r(d[39]),U=_r(d[40]),F=_r(d[41]),G=_r(d[42]),K=_r(d[43]),Y=_r(d[44]);_r(d[45]);var q=_r(d[46]),J=_r(d[47]),Q=_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]),ne=_r(d[55]),re=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]),de=_r(d[60]);const ce=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ue=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:I.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],fe={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function he(){const{rid:e,r:ie,role:le,today:he,now:ge,meId:me,me:pe}=(0,O.useCtx)(3e4);(0,h.useTipsPosted)(e,he,'staff'!==le);const be=(0,O.useSignedIn)();(0,l.useSoldOutLink)(!0,(be?.name??pe).replace(' (example)',''));const xe=(0,T.useOrders)(e),[je,we]=(0,x.useState)('home'),[ye,Se]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Te=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,O.ensureAttendance)(he,ge),(0,J.ensureChat)(ge)},[he]),globalThis.__ccNow=ge.getTime();const Ie=(0,J.useChatUnread)().total,Le=(0,x.useRef)({t:'home',s:null});Le.current={t:je,s:ye};const Ee=(0,x.useRef)([]),Be=(0,a.useScrollMemory)(Te),Oe=(0,x.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.s===s||(Ee.current=[...Ee.current,{...t,y:Be.leave()}].slice(-30),Be.restore(0)),we(e),Se(s)},[]),Pe=(0,x.useCallback)(()=>{if((0,c.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Be.leave(),we(t.t),Se(t.s),Be.restore(t.y??0),!0},[]);(0,c.useWebBack)(Pe);const Ne=(0,c.useInnerBackShown)();(0,x.useEffect)(()=>(oe.useVoiceNav.setState({go:Oe}),()=>oe.useVoiceNav.setState({go:null})),[Oe]),(0,x.useEffect)(()=>{u.PITCH&&(globalThis.__pitchGo=Oe)},[Oe]),(0,x.useEffect)(()=>{const e=j.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ue.find(e=>e.id===je);e?.can&&!e.can(le)&&Oe('home');const s=(0,K.pageFor)(ye);s?.can&&!s.can(le)&&Se(null)},[le]);const Me='more'===je?(0,K.pageFor)(ye):void 0,He=xe.filter(e=>(0,B.LIVE)(e)&&'new'===e.status).length,{unread:Ve,list:De,read:We}=(0,q.useNotifications)();(0,se.useAlertWatcher)(e,{nag:'staff'!==le}),(0,te.useReviewAlerts)(e),(0,ne.useScheduledNotices)({rid:e,staffId:be?.id??'',name:pe,onOpen:()=>Oe('more','orderlists')}),(0,re.useOffRotaAlerts)({enabled:'staff'!==le&&!!be});const $e=be?.role??le,ze='owner'===$e?'OWNER':'manager'===$e?'MANAGER':'STAFF',Ue=(0,se.useAlerts)(s=>s.history.filter(t=>t.rid===e&&(0,se.isUnread)(s,t)&&!(0,se.isCleared)(s,t)&&t.at>(s.seenAt[e]??0)).length),Fe=(0,se.useAlerts)(s=>s.todoSeen[e]),Ge=Math.max(0,Ve-De.filter(e=>!We[e.id]&&(Fe??[]).includes(e.id)).length)+Ue;(0,se.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:Ge})},[Ge]);const Ke=(0,T.useBookings)(e).filter(e=>'pending'===e.status).length,Ye=s.IS_ISOLATED_VENUE?[{id:e,name:ie.name,place:ie.location||ie.address||''}]:ce,qe=Ye.find(s=>s.id===e)??Ye[0],Je=be?.ownerAccess&&'owner'!==be.role?'owner privileges':be?.managerAccess&&'staff'===be.role?'manager privileges':'',Qe=(0,H.ownerHomeLayout)(le,be);(0,A.default)().width;return(0,de.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:L.colours.bg},edges:['top','left','right','bottom'],children:[(0,de.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:L.colours.border,gap:6},children:[(0,de.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Oe('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(U.Icon,{name:"search",colour:L.colours.text})}),(0,de.jsx)(y.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:Ge?`Notifications, ${Ge} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Oe('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsxs)(k.default,{children:[(0,de.jsx)(U.Icon,{name:"bell",colour:L.colours.text}),Ge?(0,de.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:L.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(C.T,{size:10,weight:"bold",children:Ge})}):null]})}),(0,de.jsx)(X.VoiceSlot,{size:44})]}),(0,de.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,de.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,de.jsx)(y.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${pe}. Account and role${Je?`, ${Je}`:''}`,disabled:'owner'!==V.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,de.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,de.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,de.jsxs)(k.default,{style:{flexShrink:1},children:[(0,de.jsxs)(C.T,{size:13,weight:"semibold",colour:L.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[be?`${pe} \xb7 ${be.level??I.ROLE_LABEL[be.role]}`:`${pe} \xb7 ${I.ROLE_LABEL[le]}`,'owner'===V.APP_VARIANT?' \u25be':'']}),Je?(0,de.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:Je}):null]})]})})})}),(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,de.jsx)(v.VenueHeaderBlock,{rid:e,name:ie.name,badge:ze,place:`${'staff'===le?'Staff preview \xb7 ':'Managers \xb7 '}${qe.place}`})}),le!==(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner')&&'owner'===V.APP_VARIANT?(0,de.jsx)(y.default,{onPress:()=>I.useOwner.getState().setPreviewRole(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,de.jsx)(C.T,{size:12,colour:L.colours.gold,children:'staff'===le?`Staff app preview: what staff see in the Staff app. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`:`Previewing the ${I.ROLE_LABEL[le].toLowerCase()} view. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`})}):null]}),(0,de.jsxs)(S.default,{ref:Te,...Be.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,de.jsx)(c.BackTitleRow,{back:!('home'===je&&!ye||Ne),onBack:Pe,title:Me?Me.title:'staff'===le&&'home'===je?'Staff app preview':fe[je]}),'home'===je&&be&&'staff'===be.role&&'owner'===V.APP_VARIANT?(0,de.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",colour:L.colours.gold,children:"Your manager access is off"}),(0,de.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,de.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Oe('more','clock')})]}):null,'home'!==je||Qe?null:(0,de.jsx)(r.WhoBar,{}),'home'===je&&!Qe&&be?(0,de.jsx)(ae.MyShiftCard,{go:Oe}):null,'home'===je&&!Qe&&be?(0,de.jsx)(f.MyTasksToday,{rid:e,staffId:be.id,name:be.name,onShift:(0,p.shiftNow)(be.id,Date.now()).on}):null,'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TodaysTipsCard,{rid:e,today:he}),'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TipsPotCard,{rid:e,today:he}),'home'===je?'staff'===le?(0,de.jsx)($.StaffHome,{go:Oe}):(0,de.jsx)(M.Dashboard,{go:Oe,ownerHome:Qe}):null,'orders'===je?(0,de.jsx)(Y.Orders,{}):null,'bookings'===je?(0,de.jsx)(E.Bookings,{go:Oe}):null,'forecast'===je?(0,de.jsx)(z.Forecasts,{go:Oe}):null,'chat'===je?(0,de.jsx)(J.Chat,{go:Oe}):null,'more'===je?Me?(0,de.jsx)(Me.C,{go:Oe}):(0,de.jsx)(K.MoreMenu,{go:Oe}):null]}),(0,de.jsx)(b.SeatAllergenReminder,{rid:e}),'staff'!==le?(0,de.jsx)(ee.PrintHost,{rid:e}):null,'staff'!==le?(0,de.jsx)(Z.AlertHost,{variant:"managers",rid:e,me:pe,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,de.jsx)(Q.AssistantSheet,{}),(0,de.jsx)(F.BottomTabs,{background:(0,t.soutersSurface)('#0d0d0d'),active:je,onPress:e=>Oe(e),tabs:ue.filter(e=>!e.can||e.can(le)).map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ie?{text:String(Ie),bg:L.colours.red}:'bookings'===e.id&&Ke?{text:String(Ke),bg:L.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&He?{text:String(He),bg:L.colours.red}:null}))}),(0,de.jsx)(w.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ye.filter(e=>!Re||'saltmarsh'!==e.id).map(s=>(0,de.jsx)(y.default,{accessibilityRole:"button",onPress:()=>{I.useOwner.getState().setSite(s.id),ke(!1),Oe('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:s.id===e?L.colours.gold:L.colours.border},children:(0,de.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,de.jsxs)(k.default,{children:[(0,de.jsx)(C.T,{weight:"medium",children:s.name}),(0,de.jsx)(C.Muted,{children:s.place})]}),s.id===e?(0,de.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},s.id)),(0,de.jsx)(C.Muted,{children:s.IS_ISOLATED_VENUE?`This app belongs only to ${ie.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,de.jsx)(w.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[be?(0,de.jsxs)(C.Row,{gap:10,children:[(0,de.jsx)(_.StaffAvatar,{id:be.id,size:44}),(0,de.jsxs)(k.default,{style:{flex:1},children:[(0,de.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",be.name]}),(0,de.jsx)(C.Muted,{children:(0,N.levelJob)(be.level??I.ROLE_LABEL[be.role],be.job)})]})]}):(0,de.jsxs)(k.default,{style:{gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,de.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,de.jsx)(P.SignInWithLink,{})]}),s.IS_QUEUED_VENUE||s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_GREENSIDE||!be?null:(0,de.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=s.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():s.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,de.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!be||(0,O.clampRole)(e,be.ownerAccess?'owner':be.managerAccess?'manager':be.role)===e).map(e=>(0,de.jsx)(C.Button,{kind:e===le?'primary':'secondary',label:'staff'===e?'Staff app preview':`${I.ROLE_LABEL[e]} view`,onPress:()=>{I.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,de.jsx)(D.OnboardingHost,{go:Oe}),(0,de.jsx)(W.CoachHost,{})]})}},1340,[5,798,985,1173,1161,1040,977,1041,2,1047,1048,1070,1087,34,373,395,402,295,426,102,36,794,847,848,865,840,1341,1147,1100,899,1349,997,236,1356,13,846,1385,1391,1392,1393,1153,1192,1394,1379,1395,1396,1377,1135,1413,1116,1175,1311,1177,1190,1401,1085,1086,1160,1463,1464,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1341,[5,1342,11,1343,796,806,1112,1113,1091,1115,1114,1328,1329,1100,1282,1012,1089,14,1344,1186,1345,1316,1081,1075,1090,34,102,794,1291,848,830,836,827,1267,840,1147,1096,1014,1346,1347,1136,1348,1177,985,1149,1324,852,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1342,[34,794,25]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1343,[6,34,102,794,985,1215,25]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1344,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1345,[34,402,1143,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1346,[34,102,848,1014,794,840,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1347,[34,402,102,794,840,25]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1348,[34,102,853,848,833,840,794,25]); +__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1349,[5,1350,1351,1352,1353,1354,34,236,41,102,846,997,840,1355,794,985,2,1072,996,865,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1350,[34,102,847,794,5,6,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1351,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1352,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1353,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1354,[34,102,847,794,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1355,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:a=!1}){const{rid:n,r:b,now:O,role:te,me:le,today:oe}=(0,S.useCtx)(5e3),ae=(0,p.useOrders)(n),ne=(0,p.useBookings)(n),ie=(0,p.useWaitlist)(n),de=(0,p.useEvents)(n),ue=(0,p.useRatings)(n),he=(0,k.useOwner)(e=>e.staff),ge=(0,k.useOwner)(e=>e.attendance),xe=(0,k.useOwner)(e=>e.shifts),ye=(0,P.useRealHistory)(n,O),be=(0,o.useMemo)(()=>(0,t.forecastToday)(b,ne,ae,de,O,ye??void 0),[b,ne,ae,de,ye,O.getTime()/6e4|0]),fe=(0,N.useExamples)(),me=(0,M.useCashUp)(e=>e.cashUps),je=ne.filter(e=>e.date===oe),pe=ae.filter(A.LIVE),ke=ie.filter(e=>'waiting'===e.status||'notified'===e.status),we=je.filter(e=>['seated','finished'].includes((0,T.shownStatus)(e))).reduce((e,s)=>e+s.partySize,0),$e=(0,ee.coversSplit)(je,oe),ve=$e.walkIns,Ce=$e.bookings,Ie=pe.filter(e=>(0,G.chainNeedsAction)(e,ne)),Te=je.filter(e=>['confirmed','seated'].includes(e.status)&&(0,G.bookingNeedsAction)(e,pe)),Be=pe.flatMap(e=>(0,C.readinessFor)(e,b,O).map(s=>({...s,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),De=be.nextHour,Ae=(0,A.busyLevel)(De?.coversHigh??0,be.busy.busy),Se=(0,A.restOfDayLevel)(be,b),Le=ae.filter(e=>e.paid>0).reduce((e,s)=>e+s.paid,0)+(fe?186e3:0),Pe=(0,I.ymd)(new Date(O.getTime()-6048e5)),Ne=me.find(e=>e.rid===n&&e.date===Pe),Me=Ne?(0,F.takings)(Ne.vals):null,Fe=fe?(0,L.revenueHistory)(b,O,7).filter(e=>e.date.getDay()===O.getDay()).pop():null!=Me?{date:(0,I.parseYmd)(Pe),total:Math.round(100*Me)}:void 0,Oe=(0,o.useMemo)(()=>(0,L.insights)(b,ne,ae,de,ue,O,we),[b.id,ne.length,ue.length,we]),Re=((0,S.weekday)(O),ge.filter(e=>e.date===oe&&e.in&&!e.out)),He=(0,X.useFrontDoor)(oe),We=(0,h.useBookingWrite)(),Ee=(0,w.useOutstanding)(),ze=(0,r.useTravelDay)('owner',oe),Ge=(0,S.useSignedIn)(),Ue=(0,S.useInStaffApp)(),qe=(0,F.canSeeMonthTakings)(te,Ge,{inStaffApp:Ue,live:(0,H.isLive)()}),Ye=(0,R.homeSetupNagsHidden)(n),Ke=(0,k.useOwner)(e=>e.socialPosts.reduce((e,s)=>e+('awaiting approval'===s.status?1:0),0)),[Qe,Ve]=(0,o.useState)(!1),Xe=le.replace(' (example)',''),Ze=k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return ze?(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(r.DayView,{rid:n,day:ze,today:oe,app:"owner"})]}):a?(0,se.jsxs)(m.default,{style:{gap:12},testID:"owner-home",children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),k.CAN.takings(te)?(0,se.jsx)(j.Row,{wrap:!0,gap:10,children:(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})})}):null,(0,se.jsx)(Q.TodaysTipsCard,{rid:n,today:oe}),(0,se.jsx)(Q.TipsPotCard,{rid:n,today:oe}),k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(Y.WhoBar,{}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ge&&'owner'!==Ge.role?(0,se.jsx)(_.MyShiftCard,{go:e}):null,Ge?(0,se.jsx)(K.MyTasksToday,{rid:n,staffId:Ge.id,name:Ge.name,onShift:(0,V.shiftNow)(Ge.id,Date.now()).on}):null,k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]}):(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,k.CAN.takings(te)?(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ie,_e.MonthTakingsCard=re,_e.WalkInSplitCard=ce;var s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),o=_r(_d[3]),a=_r(_d[4]),n=e(a),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),x=_r(_d[11]),y=_r(_d[12]),b=e(_r(_d[13])),f=e(_r(_d[14])),m=e(_r(_d[15])),j=_r(_d[16]),p=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),T=_r(_d[24]),B=_r(_d[25]),D=_r(_d[26]),A=_r(_d[27]),S=_r(_d[28]),L=_r(_d[29]),P=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),F=_r(_d[33]),O=_r(_d[34]),R=_r(_d[35]),H=_r(_d[36]),W=_r(_d[37]),E=_r(_d[38]),z=_r(_d[39]),G=_r(_d[40]),U=_r(_d[41]),q=_r(_d[42]),Y=_r(_d[43]),_=_r(_d[44]),K=_r(_d[45]),Q=_r(_d[46]),V=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]);const te=18,le=18,oe=150,ae=34;function ne(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const s=e.length,t=[],l=[];for(let l=0;l9){const n=3/Math.sqrt(a);l[e]=n*s*t[e],l[e+1]=n*o*t[e]}}let o=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let t=0;tte+(s-1)/Math.max(1,e-1)*t,o=[1,5,10,15,20,25].filter(s=>s=36)&&a.push(e);for(;a.length&&l(e)-l(a[a.length-1])<36;)a.pop();return[...a,e]}function re({rid:e,today:s}){const t=(0,M.useCashUp)(e=>e.cashUps),[l,i]=(0,o.useState)(s.slice(0,7)),[r,d]=(0,o.useState)(0),[c,u]=(0,o.useState)(null),h=(0,o.useMemo)(()=>(0,F.monthTakings)(t,e,l,s),[t,e,l,s]),x=(0,o.useMemo)(()=>(0,F.firstTakingsMonth)(t,e),[t,e]),y=!!x&&xte+(e-1)/Math.max(1,k-1)*w,I=e=>$-e/v*128,T=[];h.days.forEach((e,s)=>{if('recorded'!==e.state)return;const t={x:C(e.day),y:I(e.value)};s&&'recorded'===h.days[s-1].state?T[T.length-1].push(t):T.push([t])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),S=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===s):void 0)??A??B[B.length-1],L=e=>{const s=B.findIndex(e=>e.date===S?.date),t=B[Math.max(0,Math.min(B.length-1,s+e))];t&&(u(t.date),b.default.announceForAccessibility?.(P(t)))},P=e=>`${(0,F.longDay)(e.date)}, ${'recorded'===e.state?(0,F.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,N=h.current?`so far in ${h.month}`:`in ${h.month} ${l.slice(0,4)}`,R=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,F.monthName)((0,F.addMonths)(l,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,H=h.recorded?`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. ${(0,F.poundsWhole)(h.total)} ${N}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,F.longDay)(h.best.date)}, ${(0,F.poundsWhole)(h.best.value)}.${R?` ${R.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,W=r?ie(k,r):[],E=(e,s,t,o,a)=>(0,se.jsx)(f.default,{testID:a,accessibilityRole:"button",accessibilityLabel:s,accessibilityState:{disabled:!t},disabled:!t,onPress:()=>{i((0,F.addMonths)(l,o)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:t?e?.6:1:.25}),children:(0,se.jsx)(j.T,{size:24,colour:D.colours.gold,center:!0,children:e})});return(0,se.jsx)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center',gap:6},children:(0,se.jsxs)(m.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),y||p?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[E('\u2039',`Previous month, ${(0,F.monthName)((0,F.addMonths)(l,-1))}`,y,-1,'mt-prev'),(0,se.jsxs)(j.T,{center:!0,colour:D.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",l.slice(0,4)]}),E('\u203a',`Next month, ${(0,F.monthName)((0,F.addMonths)(l,1))}`,p,1,'mt-next')]}):null,(0,se.jsx)(m.default,{accessible:!0,accessibilityLabel:H,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(j.T,{size:38,weight:"bold",colour:D.colours.gold,center:!0,testID:"mt-total",children:(0,F.poundsWhole)(h.total)}),(0,se.jsx)(j.T,{center:!0,colour:D.colours.goldLight,children:N}),(0,se.jsxs)(j.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,F.shortDay)(h.best.date)," \xb7 ",(0,F.poundsWhole)(h.best.value)]}),R?(0,se.jsx)(j.Muted,{center:!0,testID:"mt-vs",children:R}):null]}):(0,se.jsx)(j.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,se.jsxs)(m.default,{style:{width:'100%',minWidth:0},children:[(0,se.jsxs)(m.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:oe,width:'100%',overflow:'visible'},children:[r?(0,se.jsxs)(n.default,{width:r,height:oe,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,se.jsx)(a.Defs,{children:(0,se.jsxs)(a.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,se.jsx)(a.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,se.jsx)(a.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,se.jsx)(a.Line,{x1:te,y1:$,x2:r-le,y2:$,stroke:D.colours.hairline,strokeWidth:1}),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:`${ne(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${s}`)),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:ne(e),stroke:D.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${s}`)),T.filter(e=>1===e.length).map((e,s)=>(0,se.jsx)(a.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:D.colours.gold},`s${s}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,se.jsx)(a.Circle,{cx:C(e.day),cy:$,r:2,fill:"none",stroke:D.colours.muted,strokeWidth:1},e.date)),S&&'recorded'===S.state?(0,se.jsx)(a.Line,{x1:C(S.day),y1:10,x2:C(S.day),y2:$,stroke:D.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===s);return(0,se.jsx)(a.Circle,{cx:C(e.day),cy:'recorded'===e.state?I(e.value):$,r:4.5,fill:D.colours.gold,stroke:D.colours.surface,strokeWidth:1.5})})():null,S&&'recorded'===S.state&&S.date!==s?(0,se.jsx)(a.Circle,{cx:C(S.day),cy:I(S.value),r:5,fill:D.colours.surface,stroke:D.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,se.jsx)(f.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:P(e),accessibilityState:{selected:S?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:oe,left:C(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,se.jsx)(m.default,{testID:"mt-axis",style:{height:O.AXIS_BAND+6,minHeight:O.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:W.map(e=>(0,se.jsx)(j.T,{size:O.AXIS_FONT,colour:D.colours.muted,style:{position:'absolute',left:C(e)-17,width:ae,top:0,textAlign:'center'},children:String(e)},e))})]}),S&&B.length?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,se.jsx)(f.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===S.date,onPress:()=>L(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u2039"})}),(0,se.jsxs)(m.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:P(S),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,se.jsx)(j.Muted,{center:!0,children:S.date===s?`Today \xb7 ${(0,F.shortDay)(S.date)}`:(0,F.shortDay)(S.date)}),(0,se.jsx)(j.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===S.state?D.colours.goldLight:D.colours.muted,children:'recorded'===S.state?(0,F.poundsWhole)(S.value):'pending'===S.state?'Not cashed up yet':'No cash-up'})]}),(0,se.jsx)(f.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===S.date,onPress:()=>L(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,se.jsx)(j.Muted,{center:!0,size:13,children:"From confirmed cash ups: gross takings, or card + cash. \u25cb = no cash up that day."})]})})}const de='#3A2F1E';function ce({split:e}){return(0,se.jsx)(j.Card,{style:{alignItems:'center',gap:8},children:(0,se.jsxs)(m.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,se.jsx)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,se.jsx)(j.Muted,{center:!0,children:"No Covers yet"}):(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",colour:D.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,se.jsxs)(m.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:de,borderWidth:1,borderColor:D.colours.gold},children:[(0,se.jsx)(m.default,{style:{width:`${e.walkInPct}%`,backgroundColor:D.colours.gold}}),(0,se.jsx)(m.default,{style:{flex:1,backgroundColor:de}})]})]})]})})}},1356,[829,1120,1357,34,900,1073,1148,1077,1078,1345,1282,851,1081,281,402,102,794,848,865,1157,830,836,1134,827,1075,855,840,1147,1100,1119,1125,1126,1024,13,1325,925,985,1366,1367,1136,838,1370,1151,1161,1160,1047,1048,1070,1096,1316,1130,1281,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:m,rid:L,today:P,me:O}=(0,R.useCtx)(6e4),Y=O.replace(" (example)",""),Z=m.settings,J=e=>k.useStore.getState().updateSettings(L,e),[X,se]=(0,b.useState)(()=>(0,d.takeAdvancedPrefill)()),[te,oe]=(0,b.useState)(null),ae=e=>{if(e.onReset)return e.onReset(),void oe(`${e.title}: back to the defaults.`);J(Object.fromEntries(e.reset.map(e=>[e,void 0]))),oe(`${e.title}: back to the defaults.`)},ne=(0,D.useBookings)(L),le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,N.jsx)(y.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,N.jsx)(y.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,N.jsx)(y.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,S.dogQuestionOn)(m),onChange:e=>J({dogQuestion:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,N.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:Z.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>J({maxDogsPerSlot:e||void 0})})]}),(0,N.jsx)(y.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,S.accessQuestionOn)(m),onChange:e=>J({accessQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,S.dietQuestionOn)(m),onChange:e=>J({dietQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==Z.tableRequests,onChange:e=>J({tableRequests:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),re=(0,S.dwellBands)(m),ie=(e,s)=>J({dwellBands:re.map((t,o)=>o===e?{...t,mins:s}:t)}),de=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),re.map((e,s)=>{const t=(0,S.dwellFor)(m,9999===e.upTo?20:e.upTo,ne);return(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:(0,S.bandLabel)(re,s)}),(0,N.jsx)(K,{label:`table time for ${(0,S.bandLabel)(re,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>ie(s,e)})]}),t.learned&&t.mins!==e.mins?(0,N.jsxs)(y.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,N.jsx)(y.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==Z.dwellLearn,onChange:e=>J({dwellLearn:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),he=Z.reservables??(0,C.reservablesOf)(m),ue=Z.reservables??('anchorage'===L?he:[]),ce=(e,s)=>J({reservables:ue.map(t=>t.id===e?{...t,...s}:t)}),pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[ue.length?ue.map(e=>(0,N.jsxs)(f.default,{style:{gap:4},children:[(0,N.jsx)(y.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>ce(e.id,{active:s})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.Muted,{children:"Price"}),(0,N.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>ce(e.id,{price:100*s})})]}),(0,N.jsxs)(y.Muted,{size:12,children:["Uses: ",e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')," from the counted stock. Held from the Display count and shown as \u201cReserved\u201d."]})]},e.id)):(0,N.jsx)(y.Muted,{children:"No reservable dishes yet."}),(0,N.jsx)(y.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==Z.reserveStock,onChange:e=>J({reserveStock:e})}),(0,N.jsx)(y.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),ge=(0,S.regularEventsOf)(m),[be,me]=(0,b.useState)(null),xe=e=>J({regularEvents:e}),fe=be?be.name.trim()?be.time&&!W.test(be.time)?'Start time looks wrong (use 20:00).':be.lastFood&&!W.test(be.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==be.rule.kind||U.test(be.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',ye=(0,N.jsxs)(f.default,{style:{gap:8},children:[ge.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,N.jsx)(y.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,N.jsx)(y.Badge,{kind:"neutral",label:"OFF"})]}),(0,N.jsxs)(y.Muted,{children:[(0,S.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,N.jsxs)(y.Muted,{size:12,children:["Next: ",(0,S.nextOccurrence)(e,P)??'\u2014']}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>me({...e})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>xe(ge.filter(s=>s.id!==e.id))})]})]},e.id)),be?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Name"}),(0,N.jsx)(q,{label:"Event name",width:220,value:be.name,onChange:e=>me({...be,name:e}),placeholder:"Open Mic Night"})]}),(0,N.jsx)(y.Muted,{children:"Repeats"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(y.Chip,{label:"Last \u2026 of the month",selected:'last'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'last',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"Every week",selected:'weekly'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'weekly',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"One-off date",selected:'once'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'once',date:P}})})]}),'weekday'in be.rule?(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:_.map(e=>(0,N.jsx)(y.Chip,{label:G[e],selected:be.rule.weekday===e,onPress:()=>me({...be,rule:{...be.rule,weekday:e}})},e))}):(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Event date",width:130,value:be.rule.date,onChange:e=>me({...be,rule:{kind:'once',date:e}}),placeholder:"2026-12-31"})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts (optional)"}),(0,N.jsx)(q,{label:"Start time",value:be.time??'',onChange:e=>me({...be,time:e||void 0}),placeholder:"20:00",bad:!!be.time&&!W.test(be.time)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Last food orders (optional)"}),(0,N.jsx)(q,{label:"Last food orders",value:be.lastFood??'',onChange:e=>me({...be,lastFood:e||void 0}),placeholder:"19:00",bad:!!be.lastFood&&!W.test(be.lastFood)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Notes"}),(0,N.jsx)(q,{label:"Notes",width:240,value:be.notes??'',onChange:e=>me({...be,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,N.jsx)(y.Toggle,{label:"Expect busier (raises the forecast)",value:be.busier,onChange:e=>me({...be,busier:e})}),(0,N.jsx)(y.Toggle,{label:"On",value:be.active,onChange:e=>me({...be,active:e})}),fe?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:fe}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save event",disabled:!!fe,testID:"event-save",onPress:()=>{const e={...be,name:be.name.trim()};xe(ge.some(s=>s.id===e.id)?ge.map(s=>s.id===e.id?e:s):[...ge,e]),me(null),oe(`Saved ${e.name}.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>me(null)})]})]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>me({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,N.jsx)(y.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),je=(0,v.hourSetsOf)(m),we=(0,v.seasonOn)(m,new Date),[ke,ve]=(0,b.useState)(null),[Ce,Se]=(0,b.useState)(null),Te=Z.hourOverrides??[],Re=ke?ke.start&&!H.test(ke.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ke.hours&&Object.values(ke.hours).some(e=>e&&(!W.test(e[0])||!W.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',De=Object.values(Z.lastFoodByDay??{}).some(e=>e&&!W.test(e)),Me=[];je.some(e=>!e.hours)&&Me.push(`${je.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);je.filter(e=>e.hours).length>=1&&je.length>1&&je.some(e=>!e.start)&&Me.push('the date each season starts');const Le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Me.length?(0,N.jsxs)(y.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Me.join(' and '),". Until then the app uses ",we?.name??'your weekly'," hours all year."]}):null,we?(0,N.jsxs)(y.T,{colour:T.colours.goldLight,children:["In use today: ",we.name]}):null,je.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",children:e.name}),we?.id===e.id?(0,N.jsx)(y.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,N.jsx)(y.Badge,{kind:"amber",label:"NOT SET"})]}),(0,N.jsx)(y.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,N.jsx)(y.Muted,{size:13,children:_.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,N.jsx)(y.Muted,{size:13,children:"No hours yet."}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>ve({...e,hours:e.hours?{...e.hours}:{...je.find(e=>e.hours)?.hours??m.kitchenHours}})})]},e.id)),ke?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.T,{weight:"semibold",children:[ke.name," hours"]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts every year on (MM-DD)"}),(0,N.jsx)(q,{label:"Season start date",value:ke.start??'',onChange:e=>ve({...ke,start:e||void 0}),placeholder:"04-01",bad:!!ke.start&&!H.test(ke.start)})]}),_.map(e=>{const s=ke.hours?.[e]??null,t=s=>ve({...ke,hours:{...ke.hours,[e]:s}});return(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.T,{style:{width:44},children:G[e]}),(0,N.jsx)(y.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:`${S.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!W.test(s[0])}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!W.test(s[1])||s[0]>=s[1]})]}):null]},e)}),Re?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:Re}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save hours",disabled:!!Re,testID:"season-save",onPress:()=>{var e;e=je.map(e=>e.id===ke.id?ke:e),J({hourSets:e}),ve(null),oe(`Saved ${ke.name} hours.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ve(null)})]})]}):null,(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,N.jsx)(y.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Te.map(e=>(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(y.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>J({hourOverrides:Te.filter(s=>s.date!==e.date)})})]},e.date)),Ce?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Special day date",width:130,value:Ce.date,onChange:e=>Se({...Ce,date:e}),placeholder:"2026-12-31",bad:!U.test(Ce.date)})]}),(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Chip,{label:Ce.hours?'Open':'Closed',selected:!!Ce.hours,onPress:()=>Se({...Ce,hours:Ce.hours?null:['12:00','19:00']})}),Ce.hours?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:"Opens",width:74,value:Ce.hours[0],onChange:e=>Se({...Ce,hours:[e,Ce.hours[1]]})}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:"Last food orders",width:74,value:Ce.hours[1],onChange:e=>Se({...Ce,hours:[Ce.hours[0],e]})})]}):null]}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Note"}),(0,N.jsx)(q,{label:"Note",width:220,value:Ce.note??'',onChange:e=>Se({...Ce,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=U.test(Ce.date)?Ce.hours&&(!W.test(Ce.hours[0])||!W.test(Ce.hours[1])||Ce.hours[0]>=Ce.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,N.jsxs)(N.Fragment,{children:[e?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:e}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{J({hourOverrides:[...Te.filter(e=>e.date!==Ce.date),Ce].sort((e,s)=>e.date.localeCompare(s.date))}),Se(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Se(null)})]})]})})()]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Se({date:P,hours:null})}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,N.jsx)(y.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:_.map(e=>(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.Muted,{size:12,children:G[e]}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,width:74,value:Z.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!Z.lastFoodByDay?.[e]&&!W.test(Z.lastFoodByDay[e]),onChange:s=>J({lastFoodByDay:{...Z.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),De?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,N.jsx)(y.Muted,{children:"After last food orders, booking times are\u2026"}),(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'drinks'})}),(0,N.jsx)(y.Chip,{label:"Not offered",selected:'block'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'block'})})]})]}),Pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,S.coversCounterOn)(m),onChange:e=>J({coversCounter:e})}),(0,N.jsx)(y.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,S.nextTableOn)(m),onChange:e=>J({nextTableFree:e})}),(0,N.jsx)(y.Toggle,{label:"Show takeaway on home screens",value:(0,S.showTakeaway)(m),onChange:e=>J({showTakeaway:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,N.jsx)(y.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),Oe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!Z.holidayFullNames,onChange:e=>J({holidayFullNames:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[ze,Ie]=(0,b.useState)(null),$e=ze??Z.whatsapp??'',Be=!$e.trim()||!!(0,M.waNumber)($e),Ae=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.T,{children:"The venue\u2019s WhatsApp number"}),(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:$e,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{Ie(e),e.trim()?(0,M.waNumber)(e)&&J({whatsapp:e.trim()}):J({whatsapp:void 0})}}),$e.trim()&&Be?(0,N.jsx)(y.Badge,{kind:"gold",label:`wa.me/${(0,M.waNumber)($e)}`}):null]}),Be?null:(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,N.jsx)(y.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Fe=(0,E.soldOutSettingsOf)(Z.soldOut),Ee=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Fe.auto,onChange:e=>J({soldOut:{...Fe,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,N.jsx)(y.Muted,{size:13,children:Fe.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,N.jsx)(y.T,{children:"Clear sold out dishes by themselves"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-soldout-${e}`,label:E.SOLD_OUT_CLEAR_LABEL[e],selected:Fe.clear===e,onPress:()=>J({soldOut:{...Fe,clear:e}})},e))}),'manual'!==Fe.clear?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(y.T,{children:"Next morning means"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,N.jsx)(y.Chip,{label:e,selected:Fe.morningAt===e,onPress:()=>J({soldOut:{...Fe,morningAt:e}})},e))})]}):null,(0,N.jsx)(y.Muted,{size:13,children:'close'===Fe.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Fe.clear?`Dishes go back on at ${Fe.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),Ne=(0,s.venueBusy)(m,ne,new Date),We=(0,F.clampWeeks)(Z.forecastMinWeeks),He=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(f.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:Ne.words,children:[(0,N.jsx)(y.T,{center:!0,size:20,weight:"semibold",children:Ne.words}),(0,N.jsx)(y.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:Z.busyCoversPerHour??30,min:1,max:200,onChange:e=>J({busyCoversPerHour:e,busyLearning:!1})}),(0,N.jsx)(y.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,N.jsx)(y.Toggle,{label:"Learn the busy level from our real history",value:!1!==Z.busyLearning,onChange:e=>J({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),Ne.enough?null:(0,N.jsx)(y.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,N.jsx)(y.T,{children:"History needed before forecasts show"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:We===e,onPress:()=>J({forecastMinWeeks:e})},e))}),(0,N.jsx)(y.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===We?'1 week':`${We} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,N.jsx)(n.ForecastDaySettings,{r:m,set:J})]}),Ue=(0,j.depositOf)(Z),Ge=e=>J({deposit:{...Ue,...e}}),qe=t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ue.on,onChange:e=>Ge({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Amount per person"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-amount",value:Ue.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"From a party of"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-party",value:Ue.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from party size"})]}),(0,N.jsx)(y.T,{children:"Refundable?"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:8,children:[(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ue.refundable,onPress:()=>Ge({refundable:!0})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ue.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ue.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ue.refundable?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Refunded if cancelled this many hours before"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-cutoff",value:Ue.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,N.jsx)(y.T,{children:"Words guests see (optional)"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ue.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:T.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,padding:10,fontSize:15}}),(0,N.jsx)(y.Muted,{size:13,children:Ue.on&&Ue.perPersonPence>0?`Guests booking for ${Ue.fromParty} or more see: \u201c${(0,j.depositWords)(Ue,Ue.fromParty,m.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,N.jsx)(y.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ue.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ue.wixLinksOn?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Link works for"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-linkhours",value:Ue.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,N.jsx)(y.Muted,{size:13,children:Ue.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,N.jsx)(w.LoyaltySettingsPanel,{}),Qe=(0,N.jsx)(ee,{rid:L}),Ye=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:le,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:de,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:pe,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:ye,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Le,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Pe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsx)(l.TableOrderSettings,{rid:L,me:Y}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Ae,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>V(L)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,N.jsx)(B.NotificationsSettings,{rid:L}),help:'adv-notifications',onReset:()=>A.useNotifs.getState().resetSeeds(L)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,N.jsx)(B.OrderListsSettings,{rid:L}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(L)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,N.jsx)(u.TaskLibrarySettings,{rid:L}),help:'adv-tasks',onReset:()=>g.useDailyTasks.getState().resetLibrary(L)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,N.jsx)(c.CashUpSettings,{rid:L}),help:'adv-cashup',onReset:()=>p.useCashUp.getState().resetFields(L)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,N.jsx)(c.TipsSettings,{rid:L}),help:'adv-tips',onReset:()=>p.useCashUp.getState().setShow(L,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,N.jsx)(B.ClockAreaSettings,{rid:L,me:Y}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(L,Y)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,N.jsx)(h.HrSettingsCard,{rid:L}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:He,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ee,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,N.jsx)(z.GridSettings,{rid:L,me:Y}),help:'adv-tablegrid',onReset:()=>{const e=$.useFloor.getState().settings[L];$.useFloor.getState().setSettings(L,{...$.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,N.jsx)(I.PrintersSettings,{rid:L,go:e}),help:'adv-printers',onReset:()=>{const e=$.useFloor.getState().settings[L];e&&$.useFloor.getState().setSettings(L,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,N.jsx)(i.BlockSettings,{rid:L}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,N.jsx)(r.GiftQrSettings,{rid:L}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:Oe,help:'adv-holidays'}],Ve=X.trim().toLowerCase(),Ze=(0,b.useMemo)(()=>Ye.filter(e=>!Ve||`${e.title} ${e.words}`.toLowerCase().includes(Ve)),[Ve,Ye]);return(0,N.jsxs)(f.default,{style:{gap:12},testID:"advanced-settings",children:[(0,N.jsx)(y.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:X,onChangeText:se,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:T.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:T.colours.accentBorder,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:12,fontSize:16}}),te?(0,N.jsx)(y.Banner,{kind:"success",title:te}):null,Ze.length?null:(0,N.jsxs)(y.Muted,{children:["No settings match \u201c",X,"\u201d."]}),Ze.map(s=>(0,N.jsx)(y.Card,{children:(0,N.jsxs)(f.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{size:17,weight:"semibold",colour:T.colours.gold,children:s.title}),e?(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,N.jsx)(y.T,{colour:T.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,N.jsx)(y.Row,{style:{justifyContent:'flex-end'},children:(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ae(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return Y}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,R.useCtx)(6e4),t=(0,v.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,N.jsx)(y.Card,{onPress:()=>e('more','advanced'),highlight:T.colours.gold,children:(0,N.jsxs)(f.default,{testID:"seasons-todo",style:{gap:4},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",colour:T.colours.gold,children:"Setup checklist: kitchen hours"}),(0,N.jsx)(y.T,{colour:T.colours.muted,children:"\u203a"})]}),(0,N.jsxs)(y.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=e(b),x=e(_r(_d[15])),f=e(_r(_d[16])),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),z=_r(_d[31]),I=_r(_d[32]),$=_r(_d[33]),B=_r(_d[34]),A=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]);const W=/^([01]\d|2[0-3]):[0-5]\d$/,H=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,U=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:n=90,bad:l,testID:r}){return(0,N.jsx)(a.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:T.colours.muted,style:{width:n,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?T.colours.red:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:T.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,N.jsx)(y.T,{size:20,colour:T.colours.gold,children:a})});return(0,N.jsxs)(y.Row,{gap:8,children:[r('\u2212',-l),(0,N.jsx)(y.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const Y={DEFAULT_DWELL:S.DEFAULT_DWELL,ANCHORAGE_SEASONS:v.ANCHORAGE_SEASONS};function V(e){const s=L.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,L.chairsId)(e))}const Z=[1,2,3,4,5,6,0],J=e=>`${7===e.days.length?'Every day':Z.filter(s=>e.days.includes(s)).map(e=>P.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${P.AUDIENCE_LABEL[e.audience]}`;function X({init:e,onSave:s,onCancel:t}){const[o,n]=(0,b.useState)(e.text),[l,r]=(0,b.useState)(e.days),[i,d]=(0,b.useState)(e.time),[h,u]=(0,b.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,P.validTime)(i);return(0,N.jsxs)(f.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:T.colours.accentBorder,borderRadius:12,padding:10},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"What it says"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:n,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:T.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}}),(0,N.jsx)(y.T,{weight:"semibold",children:"Days"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,N.jsx)(y.Chip,{label:P.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Time (UK)"}),(0,N.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,P.validTime)(i)})]}),(0,N.jsx)(y.T,{weight:"semibold",children:"Who sees it"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,N.jsx)(y.Chip,{label:P.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,N.jsx)(y.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,N.jsxs)(y.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,N.jsx)(y.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function ee({rid:e}){m.default.useEffect(()=>{L.useReminders.getState().ensure(e)},[e]);const s=(0,L.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,L.useReminders)(s=>s.rules[e]),a=(0,P.clampRules)(o??P.DEFAULT_BREAK_RULES),n=(0,L.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,O.useOwner)(e=>e.staff),r=L.useReminders.getState(),[i,d]=(0,b.useState)(null),[h,u]=(0,b.useState)(null),c=s=>r.setRules(e,s);return(0,N.jsxs)(f.default,{style:{gap:10},testID:"reminders-settings",children:[(0,N.jsx)(y.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,N.jsx)(y.T,{weight:"semibold",children:"Break reminders"}),(0,N.jsx)(y.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,N.jsx)(K,{label:"first break reminder",step:15,min:30,max:P.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Remind once more after"}),(0,N.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,N.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,N.jsxs)(y.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,N.jsx)(f.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:T.colours.hairline,paddingBottom:8},children:i===e.id?(0,N.jsx)(X,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,N.jsx)(y.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,N.jsx)(y.Muted,{size:13,children:J(e)}),h===e.id?(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,N.jsx)(y.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,N.jsx)(y.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,N.jsx)(X,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,N.jsxs)(y.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,N.jsxs)(y.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (Fri and Sun, 21:00); your own reminders stay."]}),(0,N.jsx)(y.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1357,[1121,5,1342,796,1358,1359,1361,1362,1363,1156,1047,1048,1024,1029,34,402,102,794,14,1364,800,852,1075,851,840,1100,848,1150,1001,1002,865,1365,1311,1014,1043,1021,1123,978,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1358,[796,34,102,794,1120,851,840,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1359,[829,34,236,102,794,848,1014,1131,1206,985,1277,1360,25]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1360,[829,1230]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrSettings=function({rid:e}){const s=(0,n.useFloor)(t=>t.settings[e]),h={...n.DEFAULT_SETTINGS,...s??{}},[p,y]=(0,t.useState)(h.giftQrUrl??''),[Q,b]=(0,t.useState)(''),S=t=>n.useFloor.getState().setSettings(e,{...h,...t}),x=(0,u.giftQrUrlOk)(p);return(0,c.jsxs)(l.default,{style:{gap:8},testID:"adv-giftqr-panel",children:[(0,c.jsx)(o.Toggle,{testID:"giftqr-on",label:"Show \u201cBuy a gift card\u201d on the Display",value:!!h.giftQrOn,disabled:!h.giftQrOn&&!(0,u.giftQrUrlOk)(h.giftQrUrl),onChange:e=>{S({giftQrOn:e}),b(e?'On: the Display shows Buy a gift card.':'Off: the Display hides Buy a gift card.')}}),(0,c.jsx)(o.Field,{testID:"giftqr-url",label:"Your gift card page (https://\u2026)",value:p,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>{y(e.slice(0,u.GIFT_QR_MAX)),b('')},placeholder:"https://www.example.com/gift-card"}),p&&!x?(0,c.jsx)(o.T,{size:13,colour:f.colours.amber,children:"Use the full address starting https://"}):null,(0,c.jsx)(o.Button,{small:!0,label:"Save the page address",testID:"giftqr-save",disabled:!x||p.trim()===(h.giftQrUrl??''),onPress:()=>{S({giftQrUrl:p.trim()}),b('Saved. The Display QR opens this page.')}}),Q?(0,c.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(o.Muted,{children:Q})}):null,(0,c.jsx)(o.Muted,{size:13,children:"Gift cards are sold through your website. The Display shows only a QR code and \u201cScan to buy a gift card on your phone\u201d: no prices or balances."})]})};var e,t=r(d[0]),s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),u=r(d[4]),f=r(d[5]),c=r(d[6])},1361,[34,102,794,1014,1286,840,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"websiteBlocksSynced",{enumerable:!0,get:function(){return m}}),_e.BlockSettings=function({rid:e}){const n=(0,s.useFloor)(n=>n.settings[e]),h={...s.DEFAULT_SETTINGS,...n??{}},b=h.serviceWindows??{},w=b.lunch??['12:00','17:00'],f=b.dinner??['17:00','21:00'],k=(n,t)=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:{...b,[n]:t}}),y=(e,n,t,s)=>(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{style:{flex:1},children:e}),(0,u.jsx)(o.Stepper,{testID:s,label:e,value:(0,l.toMins)(n),min:360,max:1425,step:15,format:e=>(0,c.fmt12)((0,l.fromMins)(e)),onChange:t})]});return(0,u.jsxs)(t.default,{style:{gap:8},testID:"adv-blocks-panel",children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Lunch and dinner"}),(0,u.jsx)(o.Muted,{children:"Used by Block now (the Lunch and Dinner buttons) and Spend per head. Always kept inside the kitchen hours for the day."}),b.lunch||b.dinner?null:(0,u.jsx)(o.Muted,{testID:"sw-usual",children:"Usual times now: lunch from opening to 5:00pm, dinner from 5:00pm to close. Change a time below to set your own."}),y('Lunch starts',w[0],e=>k('lunch',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(w[1])-15)),w[1]]),'sw-lunch-from'),y('Lunch ends',w[1],e=>k('lunch',[w[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(w[0])+15))]),'sw-lunch-to'),y('Dinner starts',f[0],e=>k('dinner',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(f[1])-15)),f[1]]),'sw-dinner-from'),y('Dinner ends',f[1],e=>k('dinner',[f[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(f[0])+15))]),'sw-dinner-to'),b.lunch||b.dinner?(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Use the usual times",onPress:()=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:void 0})}):null,(0,u.jsx)(o.T,{weight:"semibold",style:{marginTop:8},children:"Block on website bookings too"}),m(e)?(0,u.jsx)(o.Muted,{testID:"wix-block-sync-on",children:"On. A whole-day or time block made in CoverCharge also closes those times for online booking on your website, editing or removing it updates the website, and blocks made on the website show here too. Website bookings can only close the whole venue, not one area or some tables."}):(0,u.jsx)(o.Muted,{testID:"wix-block-sync-off",children:"Website bookings aren\u2019t connected for this venue yet. Once they are, a whole-day or time block made in CoverCharge also closes those times for online booking on your website. Until then, the website can still take bookings in a blocked time, so check those."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);const m=e=>!h.IS_ISOLATED_VENUE&&'anchorage'===e},1362,[34,102,794,1014,827,1319,5,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"advancedPrefill",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"takeAdvancedPrefill",{enumerable:!0,get:function(){return n}});const t={q:''},n=()=>{const n=t.q;return t.q='',n}},1363,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,u.staffServer)(),[s,h]=(0,t.useState)(null),[x,y]=(0,t.useState)([]),[p,j]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),v=(0,t.useCallback)(async()=>{try{const[e,t]=await Promise.all([(0,u.readSettings)(),(0,u.readOffers)()]);h(e),y(t)}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,u.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,c.jsx)(l.Banner,{kind:"info",title:"Not connected",children:"Loyalty settings are saved on the server. Not set up yet: sign in to the venue on this device to change them."});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const O=e=>{h({...s,...e}),j(null)},S=(0,o.checkSettings)(s),C=async()=>{if(!S){b(!0);try{await(0,u.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}b(!1)}},T=e=>e?`${e} days`:'Never';return(0,c.jsxs)(n.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Stamp card"}),(0,c.jsx)(l.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps for a reward"}),(0,c.jsx)(l.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,c.jsx)(l.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps run out after"}),(0,c.jsx)(l.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Rewards run out after"}),(0,c.jsx)(l.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Minutes between stamps (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most stamps a day (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,c.jsx)(l.T,{weight:"semibold",children:"Bring a friend"}),(0,c.jsx)(l.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,c.jsx)(l.Field,{label:"Reward for the guest who brings a friend",value:s.referralGiver,onChangeText:e=>O({referralGiver:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsx)(l.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most friend rewards a month (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:S}):null,p?(0,c.jsx)(l.Banner,{kind:p.kind,title:p.text}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{C()}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>h({...o.DEFAULT_LOYALTY})})]}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: a friend reward is given when the friend gets their first stamp, and a guest can\u2019t use their own code. Stamps only come from staff, or from a code or QR staff make."}),(0,c.jsx)(l.T,{weight:"semibold",children:"Offers"}),x.length?x.map(e=>(0,c.jsx)(f,{o:e,onSaved:v},e.id)):(0,c.jsx)(l.Muted,{children:"No offers yet."}),(0,c.jsx)(f,{onSaved:v}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: guests see an offer only while it\u2019s on and between its dates. Leave the dates blank to run it until you turn it off."})]})},_e.LoyaltySummaryCard=function({kind:e="card"}){const[s,a]=(0,t.useState)(null),[h,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,u.loyaltySummary)().then(a,e=>f((0,o.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,u.staffServer)())return x(),(0,u.watchLoyalty)(x)},[x]),!(0,u.staffServer)())return null;if(h)return(0,c.jsx)(l.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:h});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const y='card'===e?[['Guests with a card',s.members],['Joined this month',s.joinedMonth],['Stamps this week',s.stampsWeek],['Stamps this month',s.stampsMonth],['Rewards ready to use',s.rewardsReady],['Rewards used this month',s.rewardsUsedMonth],['Offers live now',s.offersLive]]:[['Friends waiting for their first stamp',s.referralsWaiting],['Friend rewards given',s.referralsRewarded]];return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,c.jsx)(l.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{children:e}),(0,c.jsx)(l.T,{weight:"semibold",children:t})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: these are your real numbers from the server. Change the card in Settings \u203a Advanced \u203a Loyalty."})]})})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=r(d[2]),l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]);const h=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function f({o:e,onSaved:s}){const[f,x]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[y,p]=(0,t.useState)(!!e),[j,w]=(0,t.useState)(null);if(!e&&!y)return(0,c.jsx)(l.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>p(!0)});const b=(!f.startsOn||h.test(f.startsOn))&&(!f.endsOn||h.test(f.endsOn))?(0,o.checkOffer)({title:f.title,details:f.details,startsOn:f.startsOn||null,endsOn:f.endsOn||null}):'Dates look like 2026-12-01.',v=async()=>{if(!b)try{await(0,u.saveOffer)({id:e?.id,title:f.title.trim(),details:f.details.trim(),startsOn:f.startsOn||null,endsOn:f.endsOn||null,isOn:f.isOn}),w('Saved.'),e||(x({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),p(!1)),s()}catch(e){w((0,o.plainError)(e))}};return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[e?(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{weight:"semibold",children:e.title}),(0,c.jsx)(l.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,c.jsx)(l.T,{weight:"semibold",children:"New offer"}),(0,c.jsx)(l.Field,{label:"Title",value:f.title,onChangeText:e=>x({...f,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,c.jsx)(l.Field,{label:"Details",value:f.details,onChangeText:e=>x({...f,details:e.slice(0,500)}),multiline:!0}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Field,{label:"Starts (optional)",value:f.startsOn,onChangeText:e=>x({...f,startsOn:e.trim()}),placeholder:"2026-12-01"}),(0,c.jsx)(l.Field,{label:"Ends (optional)",value:f.endsOn,onChangeText:e=>x({...f,endsOn:e.trim()}),placeholder:"2026-12-24"})]}),(0,c.jsx)(l.Toggle,{label:"Offer on",value:f.isOn,onChange:e=>x({...f,isOn:e})}),b&&(f.title||e)?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:b}):null,j?(0,c.jsx)(l.Muted,{size:13,children:j}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{small:!0,label:"Save offer",disabled:!!b,onPress:()=>{v()}}),e?null:(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>p(!1)})]})]})})}},1364,[34,102,840,794,1203,1206,25]); +__d(function(_g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.tidyWholePlan=u,_e.restoreTidy=h,_e.GridSettings=function({rid:e,me:s}){const p=(0,r.useFloor)(t=>t.settings[e]),c={...r.DEFAULT_SETTINGS,...p??{}},y=t=>r.useFloor.getState().setSettings(e,{...c,...t}),[b,S]=(0,t.useState)(''),f=(0,o.gridOf)(c.gridSize),v=c.tidyBackup,T=v?new Date(v.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'';return(0,g.jsxs)(n.default,{style:{gap:8},children:[(0,g.jsx)(a.Toggle,{testID:"adv-grid-snap",label:"Snap tables to the grid when dragging",value:!1!==c.gridSnap,onChange:e=>y({gridSnap:e}),a11y:"Snap tables to the grid when dragging"}),(0,g.jsx)(a.Muted,{size:13,children:!1!==c.gridSnap?'On: tables jump to the nearest grid line and line up with other tables (gold guides show when edges or centres match). Hold Alt (Option on a Mac) while dragging to move freely.':'Off: tables go exactly where you let go. Gold guides still help you line them up.'}),(0,g.jsx)(a.T,{children:"Grid size"}),(0,g.jsx)(a.Row,{wrap:!0,gap:8,children:o.GRID_SIZES.map(e=>(0,g.jsx)(a.Chip,{testID:`adv-grid-${e}`,label:10===e?'Fine (10)':25===e?'Normal (25)':'Coarse (50)',selected:f===e,onPress:()=>y({gridSize:e})},e))}),(0,g.jsx)(a.Button,{testID:"adv-grid-tidy",label:"Tidy up the whole plan",onPress:()=>{const t=u(e,s,(new Date).toISOString());S(t.moved?`Tidied: ${t.moved} tables lined up on the grid. The old positions are kept below.`:'Already tidy. Nothing moved.')}}),(0,g.jsx)(a.Muted,{size:13,children:"Tidy up snaps every table to the grid and evens out the rows, area by area. Only positions change: table numbers, areas, Covers, sizes and best tables stay as they are."}),v?(0,g.jsxs)(n.default,{testID:"adv-grid-backup",style:{borderWidth:1,borderColor:l.colours.gold,borderRadius:10,padding:10,gap:6},children:[(0,g.jsxs)(a.T,{size:14,children:["Positions from before the tidy on ",T,v.by?` (${v.by})`:''," are kept."]}),(0,g.jsx)(a.Button,{testID:"adv-grid-restore",kind:"secondary",label:"Put the tables back where they were",onPress:()=>{h(e)&&S('Done: every table is back where it was before the tidy.')}})]}):null,b?(0,g.jsx)(a.Banner,{kind:"success",title:b}):null,(0,g.jsx)(a.Muted,{size:13,children:"Tip: in the table plan editor, Tidy up does one area at a time and you can undo it with \u2318Z (Ctrl+Z)."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),g=_r(d[6]);function u(e,t,s){const n=r.useFloor.getState(),a=n.plans[e]??(0,r.planOf)(e),l={...r.DEFAULT_SETTINGS,...n.settings[e]??{}};let g=a;for(const e of a.areas)g=(0,o.tidyArea)(g,e.id,(0,o.gridOf)(l.gridSize));const u=(0,o.movedCount)(a,g);return u?(n.setSettings(e,{...l,tidyBackup:(0,o.backupOf)(a,s,t,'Before Tidy up')}),n.setPlan(e,g),{moved:u}):{moved:u}}function h(e){const t=r.useFloor.getState(),s={...r.DEFAULT_SETTINGS,...t.settings[e]??{}},n=s.tidyBackup;return!!n&&(t.setPlan(e,(0,o.restoreFrom)(t.plans[e]??(0,r.planOf)(e),n)),t.setSettings(e,{...s,tidyBackup:void 0}),!0)}},1365,[34,102,794,1014,1295,840,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1366,[798,34,283,364,236,102,426,900,794,796,840,1325,25]); +__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1367,[925,800,798,806,852,1061,1368,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1167,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1368,[499,1369]); +__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 t}});var t={}},1369,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProgressBar=B,_e.useSetupDone=O,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,C.useCtx)(6e4),n=O(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=f.SETUP_STEPS.findIndex(e=>e.id===a),s=f.SETUP_STEPS[e+1]?.id??null;return(0,E.jsx)(D,{id:a,wizard:!0,onBack:()=>l(e>0?f.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=f.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,E.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{gap:12,children:[(0,E.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsxs)(x.T,{size:20,weight:"bold",colour:S.colours.gold,children:["Set up ",t.name]}),(0,E.jsx)(x.Muted,{children:n.loading?'Checking what is already set up\u2026':i?'Everything is set up. Open any step to check or change it.':'Nine short steps. Do them in order or jump to any one; you can come back to each from Settings.'})]})]}),(0,E.jsx)(B,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,E.jsx)(x.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,E.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:S.colours.border,backgroundColor:S.colours.surface,overflow:'hidden'},children:f.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,E.jsxs)(h.default,{testID:`setup-step-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Step ${s+1}: ${e.title}${t?', done':o.length?`, still needed: ${o.join(', ')}`:''}`,onPress:()=>l(e.id),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',gap:12,padding:12,minHeight:60,borderTopWidth:s?1:0,borderColor:S.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,E.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?S.colours.gold:'transparent',borderWidth:1.5,borderColor:t?S.colours.gold:S.colours.border},children:(0,E.jsx)(x.T,{weight:"bold",colour:t?S.colours.onGold:S.colours.muted,children:t?'\u2713':s+1})}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"medium",children:e.title}),(0,E.jsx)(x.Muted,{children:e.sub}),o.length?(0,E.jsxs)(x.T,{size:13,colour:S.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,E.jsx)(x.Badge,{kind:"ok",label:"Done"}):null,(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=D,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return _}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,C.useCtx)(6e4),t=O(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,E.jsxs)(x.Card,{onPress:()=>e('more','setup'),highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:"Finish setting up"}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]}),(0,E.jsx)(B,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,E.jsxs)(x.Muted,{size:13,children:["Next: ",f.SETUP_STEPS.find(e=>!t.isDone(e.id))?.title]})]})};var s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),o=_r(_d[3]),a=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(_r(_d[4])),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=e(_r(_d[11])),g=e(_r(_d[12])),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),j=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),k=_r(_d[20]),w=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),T=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),E=_r(_d[27]);const M=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],R=[1,2,3,4,5,6,0],z=/^([01]\d|2[0-3]):[0-5]\d$/,$=e=>{const s=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(s)&&s>0?Math.round(100*s):null},I=e=>f.SETUP_STEPS.findIndex(s=>s.id===e)+1;function B({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,E.jsxs)(g.default,{testID:t,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:s,now:e},accessibilityLabel:`${e} of ${s} steps done`,style:{gap:4},children:[(0,E.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:S.colours.gold,borderRadius:5}})}),(0,E.jsxs)(x.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function O(e){const s=(0,f.useSiteSetup)(e),t=(0,p.useBrand)(e),{status:n,live:o}=(0,r.useSetupStatus)(),a=(0,c.useMemo)(()=>n?(0,l.evalSetup)(n,{logo:!!t.logo,email:s.email,bookingUrl:s.bookingUrl}):null,[n,t.logo,s.email,s.bookingUrl]),d=(0,i.useSetupMarksLoaded)(),u=e=>a?(0,i.applyMark)(!!a[e]?.done,d[e]):!!s.done[e],h=f.SETUP_STEPS.filter(e=>u(e.id)).length;return{isDone:u,markOf:e=>d[e],missing:e=>a?a[e]?.missing??[]:[],prog:{done:h,total:f.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function D({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,C.useCtx)(6e4),l=O(a),r=l.prog,d=(0,i.useLiveVenue)(),u=f.SETUP_STEPS.find(s=>s.id===e),[p,b]=(0,c.useState)(null),m=U[e];return(0,E.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsxs)(x.T,{size:12,weight:"semibold",colour:S.colours.gold,children:["STEP ",I(e)," OF ",f.SETUP_STEPS.length]}),s&&o?(0,E.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,E.jsx)(x.T,{size:13,colour:S.colours.muted,children:"All steps"})}):null]}),(0,E.jsx)(x.T,{size:22,weight:"bold",children:u.title}),(0,E.jsx)(B,{done:r.done,total:r.total})]}),(0,E.jsx)(m,{rid:a,done:(t="Saved.")=>{f.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():b(t)},wizard:!!s}),p?(0,E.jsx)(x.Banner,{kind:"success",title:p}):null,(0,E.jsx)(W,{rid:a,id:e,title:u.title,onDone:b}),s?(0,E.jsxs)(x.Row,{gap:10,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,E.jsx)(x.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const L=({wizard:e,onPress:s,disabled:t,label:n})=>(0,E.jsx)(x.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const A=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function F({rid:e,done:n,wizard:o,payList:a=!1}){const l=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,j.useOwner)(e=>e.hourly),i=(0,C.useHourly)(),d=(0,f.useSiteSetup)(e),u=(0,f.useSetup)(e=>e.looks),[p,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),v=e=>{const s=d.grades.find(s=>s.id===d.staffGrade[e.id]);return e.salaried&&null==r[e.id]?'Salaried, no hourly wage':s&&!a?`${s.name} grade`:null==r[e.id]?'Pay not set':null!=i[e.id]?`${(0,w.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];m({id:e.id,name:e.name,job:e.job,access:(0,f.accessOf)(e.level,e.role),pay:e.salaried&&null==r[e.id]?'salaried':s?'grade':'own',gradeId:s??d.grades[0]?.id??'',wage:null!=i[e.id]?(i[e.id]/100).toFixed(2):'',noTax:!!e.noTax,look:u[e.id]??null}),T(null)},M=!!p?.id&&(R=p.id,k.ROSTER.some(e=>e.id===R));var R;const z=p?$(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=z||M&&!p.wage);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Muted,{children:[l.length," people. Tap someone to change their pay, tax or avatar. People from your roster keep their name, access and personal link."]}),(0,E.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,E.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>P(e),style:({pressed:s})=>({flexDirection:'row',alignItems:'center',gap:10,padding:10,borderRadius:14,borderWidth:1,borderColor:p?.id===e.id?S.colours.gold:S.colours.border,backgroundColor:s?'#1d1a14':S.colours.surface}),children:[(0,E.jsx)(b.StaffAvatar,{id:e.id,size:42}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"semibold",children:e.name}),(0,E.jsxs)(x.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,f.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,E.jsx)(x.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,f.accessOf)(e.level,e.role)})]},e.id))}),y?(0,E.jsx)(x.Banner,{kind:"success",title:y}):null,p?(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsx)(x.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:S.colours.gold},children:(0,E.jsx)(b.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsx)(x.Muted,{children:"Choose an original icon or keep a crew look. A personal avatar takes priority. They can change their own in My avatar."}),(0,E.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>m({...p,look:e.look})}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>m({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>m({...p,look:null})}):null]})]})]}),M?(0,E.jsxs)(x.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,E.jsx)(x.Field,{label:"Name",value:p.name,onChangeText:e=>m({...p,name:e}),placeholder:"First and last name"}),(0,E.jsx)(x.Field,{label:"Job title",value:p.job,onChangeText:e=>m({...p,job:e}),placeholder:"e.g. Kitchen porter"}),M?null:(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Access level"}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,selected:p.access===e,onPress:()=>m({...p,access:e})},e))}),(0,E.jsxs)(x.Muted,{size:13,children:["Uses the ",f.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Pay"}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[a?null:(0,E.jsx)(x.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>m({...p,pay:'grade'})}),(0,E.jsx)(x.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>m({...p,pay:'own'})}),(0,E.jsx)(x.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>m({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,E.jsx)(x.Chip,{label:`${e.name} \xb7 ${(0,w.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>m({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,E.jsx)(x.Field,{label:"\xa3 per hour",value:p.wage,onChangeText:e=>m({...p,wage:e}),keyboardType:"decimal-pad",placeholder:M?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=z&&z<1271?(0,E.jsx)(x.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,E.jsx)(x.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>m({...p,noTax:e})}),(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>m(null),style:{flex:1}}),(0,E.jsx)(x.Button,{label:p.id?'Save':'Add to team',testID:"staff-save",disabled:!I,onPress:()=>{if(!p||!I)return;const s=j.useOwner.getState();let t=p.id;if(!t){const e=new Set(s.staff.map(e=>e.id));if(s.addStaff(p.name.trim(),f.ACCESS_ROLE[p.access],p.job.trim()||'Team member'),t=j.useOwner.getState().staff.find(s=>!e.has(s.id))?.id,!t)return}const n={job:p.job.trim()||'Team member',salaried:'salaried'===p.pay,noTax:p.noTax};M||Object.assign(n,{name:p.name.trim(),level:p.access,role:f.ACCESS_ROLE[p.access],dept:'Head Chef'===p.access?'Kitchen':void 0}),s.updateStaff(t,n);const o={...d.staffGrade};if('grade'===p.pay){const e=d.grades.find(e=>e.id===p.gradeId);e&&(a&&d.staffGrade[t]===p.gradeId||s.setRate(t,e.pence),o[t]=e.id)}else delete o[t],'own'===p.pay&&null!=z&&s.setRate(t,z);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),f.useSetup.getState().patch(e,{staffGrade:o}),f.useSetup.getState().setLook(t,p.look),T(`${p.name.trim()} ${p.id?'updated':'added'}.`),m(null)},style:{flex:1}})]}),p.id?null:(0,E.jsx)(x.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,E.jsx)(x.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{m(A(d.grades[0]?.id??'')),T(null)}}),(0,E.jsx)(L,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const U={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,f.useSiteSetup)(e),[i,d]=(0,c.useState)({name:o.name,address:o.address??o.location,phone:o.phone??'',email:r.email,tagline:o.tagline}),[u,h]=(0,c.useState)('');return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,E.jsx)(x.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,E.jsx)(x.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,E.jsx)(x.Field,{label:"Email",accessibilityLabel:"Venue email address",keyboardType:"email-address",inputMode:"email",autoCapitalize:"none",autoCorrect:!1,value:i.email,onChangeText:e=>d({...i,email:e})}),(0,E.jsx)(x.Field,{multiline:!0,numberOfLines:3,label:"Tagline",value:i.tagline,onChangeText:e=>d({...i,tagline:e}),placeholder:"e.g. Seafood and real ale by the harbour"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Logo"}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsxs)(x.Muted,{children:[l.custom?'Your uploaded logo.':'anchorage'===e?'The Anchorage logo in black and gold.':'greenside'===e?'The Greenside Restaurant logo.':'abbotsford'===e?'The Abbotsford Hotel logo.':'kirkton'===e?'The Kirkton Inn logo.':'wildings'===e?'The Wildings Hotel & Restaurant logo.':'kirkmichael'===e?'The Kirkmichael Arms logo.':'souters'===e?'The Souter\u2019s Inn logo.':'Placeholder initials.'," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,E.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,label:"Upload a logo",onPress:async()=>{const s=await a.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(s.canceled||!s.assets?.[0])return;const t=s.assets[0];j.useOwner.getState().setBranding(e,{logoUri:t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri})}}),l.custom?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,E.jsx)(P.OrderAtTableCard,{rid:e,compact:!0}),u?(0,E.jsx)(x.Banner,{kind:"warn",title:u}):null,(0,E.jsx)(L,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(m.useStore.getState().updateRestaurant(o.id,{name:i.name.trim(),address:i.address.trim(),phone:i.phone.trim(),contactEmail:i.email.trim(),tagline:i.tagline.trim()}),h(''),s('Venue details saved.')):h('Check the email address.')}})]})},hours:function({done:e,wizard:s}){const{r:t}=(0,C.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=R.filter(e=>{const s=n[e];return s&&(!z.test(s[0])||!z.test(s[1]))});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),M.map((e,s)=>{const t=R[s],l=n[t];return(0,E.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:S.colours.border,paddingTop:s?6:0},children:[(0,E.jsx)(x.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,E.jsxs)(x.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"to"}),(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,E.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,E.jsx)(x.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries(R.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,E.jsx)(x.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,E.jsx)(L,{wizard:s,disabled:!!l.length,onPress:()=>{m.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,y.usePlan)(e),o=(0,y.planCounts)(n);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v.TablePlan,{startStep:"areas"}),(0,E.jsx)(L,{wizard:t,disabled:!o.tables,label:t?`Looks right (${o.tables} tables, ${o.seats} seats), continue`:'Mark as done',onPress:()=>s('Table plan step marked as done.')})]})},paygrades:function(e){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{center:!0,children:"Your team's hourly rates. Tap a person to edit. Existing grades are retained in the background; opening this list never changes pay."}),(0,E.jsx)(F,{...e,payList:!0})]})},staff:F,permissions:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)('Manager'),l=e=>f.PERMS.filter(s=>n.perms[e]?.[s.id]).length;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Tick what each access level can do. We\u2019ve started you with sensible defaults; change any of them."}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,sub:`${l(e)} of ${f.PERMS.length}`,selected:o===e,onPress:()=>a(e)},e))}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:o}),'Owner'===o?(0,E.jsx)(x.Muted,{children:"The owner can always do everything."}):null,f.PERMS.map((s,t)=>{const a=!!n.perms[o]?.[s.id],l='Owner'===o;return(0,E.jsxs)(h.default,{testID:`perm-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:a,disabled:l},accessibilityLabel:`${o}: ${s.label}`,disabled:l,onPress:()=>f.useSetup.getState().setPerm(e,o,s.id,!a),style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:50,borderTopWidth:t?1:0,borderTopColor:S.colours.border,opacity:l?.75:1},children:[(0,E.jsx)(g.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:a?S.colours.gold:S.colours.muted,backgroundColor:a?S.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:a?(0,E.jsx)(x.T,{weight:"bold",colour:S.colours.onGold,children:"\u2713"}):null}),(0,E.jsx)(x.T,{style:{flex:1},children:s.label})]},s.id)})]}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Back to the suggested defaults",onPress:()=>f.useSetup.getState().resetPerms(e)}),(0,E.jsx)(x.Banner,{kind:"info",title:"Saved on this device",children:"For now the apps still follow the built-in Owner, Manager and Staff rules. These ticks will control access once staff accounts go live."}),(0,E.jsx)(L,{wizard:t,onPress:()=>s('Permissions saved.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Work email address",value:o,onChangeText:a,placeholder:"e.g. hello@yourvenue.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),l?null:(0,E.jsx)(x.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,E.jsx)(x.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Link your inbox"}),(0,E.jsx)(x.Badge,{kind:"amber",label:"Coming soon"})]}),(0,E.jsx)(x.Muted,{children:"Later you\u2019ll be able to link your inbox so booking emails appear in CoverCharge. Nothing is linked yet: CoverCharge doesn\u2019t read or send email from here."}),(0,E.jsx)(x.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,E.jsx)(L,{wizard:t,disabled:!l,onPress:()=>{m.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),a=(0,f.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,T.appUrl)('/customer-app/index.html'),[]),[d,u]=(0,c.useState)(!1),h=l.trim()&&!/^https?:\/\//i.test(l.trim())?`https://${l.trim()}`:l.trim(),p=!h||/^https?:\/\/[^\s.]+\.[^\s]+$/i.test(h);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,E.jsx)(x.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Your booking link"}),(0,E.jsx)(x.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:S.colours.border,padding:10},children:(0,E.jsx)(x.T,{size:14,colour:S.colours.goldLight,children:i})}),(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,T.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,E.jsx)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,E.jsx)(x.Badge,{kind:"gold",label:"Coming soon"})}),(0,E.jsx)(x.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,E.jsx)(L,{wizard:t,disabled:!p,onPress:()=>{m.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),f.useSetup.getState().patch(e,{website:h,bookingUrl:i}),s('Website saved.')}})]})},invites:function({rid:e,done:s,wizard:t}){const n=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),{role:o}=(0,C.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Every person has an Android app download and an iPhone app link. Both sign in automatically. Share privately; nothing is sent from here."}),n.map(e=>(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,E.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,E.jsx)(L,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},_=e=>function(){return(0,E.jsx)(D,{id:e})};function W({rid:e,id:s,title:t,onDone:n}){const o=O(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,E.jsxs)(g.default,{style:{gap:4},children:[(0,E.jsx)(x.Button,{kind:"secondary",label:r?'Saving\u2026':'Mark as not done',disabled:r,testID:`setup-notdone-${s}`,accessibilityLabel:`${t}, mark as not done`,style:{minHeight:44},onPress:async()=>{d(!0),f.useSetup.getState().markDone(e,s,!1);const o=!a||await i.useSetupMarks.getState().set(a,s,!1);d(!1),n(o?`${t} marked as not done.`:'Could not save. Check the connection and try again.')}}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: use this if a step needs another look. It goes back on your to-do list until you mark it done again."})]}):l&&!1===l.done&&l.by?(0,E.jsxs)(x.Muted,{size:13,testID:`setup-notdone-by-${s}`,children:["Marked as not done by ",l.by,l.at?` on ${new Date(l.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})}`:'',"."]}):null}},1370,[927,926,798,796,1061,1371,1372,1373,1374,1376,34,402,102,847,899,794,848,865,1014,925,15,836,840,1100,1377,1380,1384,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1371,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1372,[34,985]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1373,[34,815,985]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1374,[2,796,34,236,383,102,794,1375,985,840,1151,997,865,988,25]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1375,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1376,[34,402,794,985,840,1374,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1377,[796,1120,985,900,1175,1177,34,281,379,236,402,102,426,853,794,848,1186,865,836,827,840,1147,1100,838,1367,1135,1378,1379,1119,1126,1125,1024,13,1123,1366,1167,25]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1378,[796,34,1173,1041,839,379,402,102,794,865,836,827,840,1147,1100,1167,25]); +__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1379,[1042,34,402,102,794,865,840,1100,985,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1380,[796,34,1033,395,102,1107,1108,1293,1316,794,1011,1014,827,840,1100,1015,1381,1382,1035,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1381,[796,34,402,102,794,840,1014,5,1015,846,985,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1382,[34,102,794,1014,1383,828,840,1060,931,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1383,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderAtTableCard=c,_e.OrderAtTableSettings=function(){const e=(0,h.useOwner)(e=>e.site);return(0,u.jsxs)(n.default,{style:{gap:10},children:[(0,u.jsx)(c,{rid:e}),(0,u.jsx)(o.Banner,{kind:"info",title:"Takeaway is separate",children:"Takeaway ordering, slots and the live takeaway queue work the same whichever way this is set. Each venue sets this for itself."})]})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var r,s=_r(d[3]),n=(r=s)&&r.__esModule?r:{default:r},o=_r(d[4]),l=_r(d[5]),h=_r(d[6]),u=_r(d[7]);function c({rid:r,compact:s}){const h=(0,l.useOrderAtTable)(r),c=(0,l.useStore)(e=>e.restaurants.find(e=>e.id===r)?.name??'this venue');return e.IS_GREENSIDE?(0,u.jsx)(t.GreensideCashOnly,{}):(0,u.jsx)(n.default,{testID:"order-at-table-card",children:(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Order at table"}),(0,u.jsx)(o.Muted,{children:"Guests scan a QR code on the table and order from their phone, then pay at the bar or till. Tables, hours and QR codes: Settings \u203a Advanced \u203a Order at the table."})]}),(0,u.jsx)(o.Toggle,{label:"Order at table",value:h,onChange:e=>l.useStore.getState().updateSettings(r,{orderAtTable:e})})]}),(0,u.jsx)(o.T,{size:13,colour:h?'#E2C489':'#D8CFBF',children:h?`On for ${c}: table QR codes, table orders and table tickets are shown.`:`Off for ${c}: in-house orders go through your till. Takeaway ordering stays on.`}),s?null:(0,u.jsx)(o.Muted,{children:"When it is off: no Order at table or table QR screen in the customer app, no Tables & QR codes page or Table option in Take an order here, no table orders in Live orders, and no table tickets in the Head Chef app."})]})})}},1384,[5,1342,34,102,794,848,865,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=M,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=M(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',O[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:O[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withWildingsQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function M(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const O={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from Bidfood or Booker? Add them here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1385,[801,1153,34,281,283,364,395,236,295,102,36,794,847,850,865,1014,1051,1052,5,828,1049,1059,840,846,1100,1386,1389,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=k,_e.importQuestionnaireAccounts=T,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Listing them lets the Assistant help with them later. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:i}=(0,x.useCtx)(6e4),j='owner'===n,B=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],A=(0,p.useQuestionnaire)(e),{mark:M}=(0,p.useProvenance)(e),[P,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(A?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!B.some(n=>n.provider===e.provider)),[A,B]),W=(A?.accounts??[]).some((e,n)=>M('accounts',n,'provider'));return(0,y.jsxs)(l.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:i})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>A&&T(e,A,i)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${B.length}`})]}),B.length?B.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(A?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(l.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:I[e.status].kind,label:I[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(k,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=B.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:P,owner:j,by:i,onClose:()=>z(null)}),$?(0,y.jsx)(C,{rid:e,c:$,by:i,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),i=e(r(d[4])),l=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(l.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function k({rid:e,compact:n}){const{role:o,me:i}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,k]=(0,t.useState)({}),[T,B]=(0,t.useState)(null),I=u.useAccounts.getState();return(0,y.jsxs)(l.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(l.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(l.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(l.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(l.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>k({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(l.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>I.update(e,o.id,{accountNo:u},i,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>B(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>I.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:i})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),T?(0,y.jsx)(C,{rid:e,c:T,by:i,onClose:()=>B(null)}):null]})}function C({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(l.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["The Assistant will stop using ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function T(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const i of n.accounts??[])o.some(e=>e.provider===i.provider)||s.add(e,{provider:i.provider,handle:i.handle,status:'listed',from:'questionnaire',addedBy:t})}function B({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,k]=(0,t.useState)(p?.handle??''),[C,T]=(0,t.useState)(p?.customName??''),[B,I]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const A=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${A?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(i.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:A?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),A?(0,y.jsx)(a.Field,{label:"Service name",value:C,onChangeText:T,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>I(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),B?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below so the Assistant knows you use it, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:k,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:A?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:A&&C.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:A?C.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:A&&!C.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(l.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const I={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(B,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1386,[796,34,379,402,295,102,794,1387,1388,840,1385,1100,865,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1387,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.looksSecret=l,Object.defineProperty(_e,"useAccounts",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),s=r(d[2]);const c=/^\s*(password|passwd|pwd|passcode|pin|otp|secret|token|api[ _-]?key)\s*[:=]/i,u=/\b(sk|pk|rk)_(live|test)_|\bghp_|\bxox[abp]-|\bAKIA[0-9A-Z]{12}|\beyJ[A-Za-z0-9_-]{10,}\./;function l(e){return!(!c.test(e)&&!u.test(e))||e.split(/\s+/).some(e=>e.length>=24&&/[A-Za-z]/.test(e)&&/\d/.test(e)&&!/^[\w.+-]+@[\w-]+\.[\w.]+$/.test(e)&&!/^(https?:\/\/|www\.)/i.test(e))}const b=e=>e&&!l(e)&&e.trim().slice(0,120)||void 0,p=e=>{const t=e?.trim();return t&&/^[A-Za-z0-9 -]{1,20}$/.test(t)?t:void 0},y=(0,n.create)()((0,s.persist)(e=>({byVenue:{},log:{},add:(t,o)=>e(e=>{const n={...o,handle:b(o.handle),customName:b(o.customName),accountNo:p(o.accountNo),id:`c-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,addedAt:(new Date).toISOString()};return{byVenue:{...e.byVenue,[t]:[...e.byVenue[t]??[],n]},log:{...e.log,[t]:[{at:n.addedAt,by:o.addedBy,what:`Added ${o.customName??o.provider}`},...e.log[t]??[]].slice(0,200)}}}),update:(t,o,n,s,c)=>e(e=>({byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).map(e=>e.id===o?{...e,...n,handle:void 0!==n.handle?b(n.handle):e.handle,accountNo:void 0!==n.accountNo?p(n.accountNo):e.accountNo}:e)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:s,what:c},...e.log[t]??[]].slice(0,200)}})),remove:(t,o,n)=>e(e=>{const s=(e.byVenue[t]??[]).find(e=>e.id===o);return{byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).filter(e=>e.id!==o)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:n,what:`Removed ${s?.customName??s?.provider??'an account'}`},...e.log[t]??[]].slice(0,200)}}})}),{name:'covercharge-accounts-v1',version:1,storage:(0,s.createJSONStorage)(()=>o.default)}))},1388,[808,815,818]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1389,[34,402,102,794,850,1388,1014,828,1390,1059,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1390,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1391,[798,34,283,364,236,402,102,815,794,840,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const L=(0,m.useInStaffApp)(),{now:N,meId:A,me:O,r:R,today:z}=(0,m.useCtx)(3e4),H=(0,s.useTravelDay)('staff',z),P=(0,h.useOwner)(e=>e.shifts),F=(0,h.useOwner)(e=>e.attendance),_=(0,h.useOwner)(e=>e.staffCanViewSuppliers),E=(0,h.useOwner)(e=>e.quickLinks),W=(0,h.useOwner)(e=>e.chat),q=(0,h.useOwner)(e=>e.swaps),V=(0,h.useOwner)(e=>e.leave),G=P.filter(e=>e.staffId===A&&e.published&&e.date>=z).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),U=G.find(e=>e.date===z),Y=F.filter(e=>e.staffId===A&&e.in&&!e.out&&N.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Q=(0,x.usePay)(A,0),K=(0,b.useOrders)(R.id),J=(0,b.useBookings)(R.id),X=K.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,J))),Z=J.filter(e=>e.date===z&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,K.filter(T.LIVE))),ee=J.filter(e=>(0,S.undoKind)(e,z)||e.walkIn&&'cancelled'===e.status&&e.date===z).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),se=W.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],te=q.filter(e=>e.fromId===A&&'open'===e.status).length+V.filter(e=>e.staffId===A&&'pending'===e.status).length,ie=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],..._?[['Suppliers',()=>e('more','suppliers')]]:[]];return!L&&H?(0,v.jsxs)(o.default,{style:{gap:10},children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(s.DayView,{rid:R.id,day:H,today:z,app:"staff"})]}):(0,v.jsxs)(o.default,{style:{gap:10},children:[L?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(t.CoversToday,{rid:R.id})]}),(0,v.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,v.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,v.jsx)(C.StaffAvatar,{id:A,size:52})}),(0,v.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",O.replace(' (example)','').split(' ')[0]]})]}),(0,v.jsx)(r.Badge,{kind:"gold",label:L?R.name:'Staff app preview'})]}),(0,v.jsx)(r.Muted,{children:L?`${N.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,v.jsx)(M.StaffTipsTile,{rid:R.id,today:z,onPress:()=>e('more','mytips')}),(0,v.jsxs)(r.Card,{highlight:Y?u.colours.ok:void 0,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{weight:"semibold",children:Y?`On shift since ${(0,c.hm)(new Date(Y.in))}`:'Not clocked in'}),Y?(0,v.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((N.getTime()-new Date(Y.in).getTime())/6e4)))}):null]}),U?(0,v.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(U.start),"\u2013",(0,m.fmtH)(U.end)]}):G[0]?(0,v.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[G[0].day]," ",Number(G[0].date.slice(8))," ",(0,m.fmtH)(G[0].start),"\u2013",(0,m.fmtH)(G[0].end)]}):(0,v.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,v.jsx)(r.Button,{small:!0,kind:Y?'secondary':'success',label:Y?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),A?(0,v.jsx)($.RequestTimeOff,{meId:A,me:O,testID:"staff-home-time-off"}):null,(0,v.jsx)(p.ShellfishTile,{rid:R.id,by:O.replace(' (example)',''),app:"staff"}),ee.length?(0,v.jsx)(r.Card,{children:(0,v.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ee.length,")"]}),(0,v.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),ee.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,v.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,v.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,v.jsxs)(r.Muted,{children:[e.table?(0,I.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,v.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(R.id,e)}):null,e.walkIn?(0,v.jsx)(a.CancelWalkInButton,{rid:R.id,b:e,small:!0}):null,e.walkIn?(0,v.jsx)(a.ReinstateWalkInButton,{rid:R.id,b:e,today:z,small:!0}):null,(0,v.jsx)(S.BookingUndo,{b:e,rid:R.id,today:z,who:s})]})]},e.id)})]})}):null,X.length+Z.length?(0,v.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",X.length+Z.length,")"]}),(0,v.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),X.map(e=>(0,v.jsx)(j.AllergyChain,{o:e,me:O},e.id)),Z.map(e=>(0,v.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,D.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,v.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,I.tablesLabel)(e.table)}`:'']}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsx)(j.BookingAllergyChain,{b:e,me:O}),(0,v.jsx)(o.default,{style:{flexDirection:'row'},children:(0,v.jsx)(w.WhatsAppGuest,{b:e,rid:R.id,kind:"auto"})})]},e.id))]}):null,se?(0,v.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,v.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,v.jsx)(r.T,{size:14,children:se.text})]}):null,(0,v.jsxs)(r.Card,{children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,v.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Q.paid)," paid hours"]})]}),te?(0,v.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,v.jsxs)(r.T,{size:14,children:["You have ",te," request",te>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(E,'staff').length?(0,v.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,v.jsx)(y.QuickLinksRow,{compact:!0})]}):null,L?null:(0,v.jsx)(o.default,{style:{gap:6},children:ie.map(([e,s])=>(0,v.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27]),v=_r(d[28])},1392,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1367,1136,850,1149,838,1147,899,1346,1014,829,1096,1154,1159,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:C,now:$,today:S}=(0,x.useCtx)(3e4),{width:T}=(0,r.default)(),B=(0,n.useBookings)(v),M=(0,n.useOrders)(v),D=(0,n.useEvents)(v),[H,R]=(0,t.useState)(7),A=(0,b.useRealHistory)(v,$),P=(0,t.useMemo)(()=>(0,s.forecastToday)(C,B,M,D,$,A??void 0),[C,B,M,D,A,$.getTime()/6e4|0]),E=(0,t.useMemo)(()=>Array.from({length:H},(e,t)=>{const o=(0,c.addMins)((0,c.parseYmd)(S),1440*t);return{d:o,f:(0,s.forecastToday)(C,B,M,D,o,A??void 0)}}),[C,B,M,D,S,H,A]),F=P.hours.reduce((e,s)=>e+s.booked,0),L=Math.max(C.settings.capacityPerHour,...P.hours.map(e=>e.coversHigh)),I=(0,i.showTakeaway)(C),[N,O]=(0,t.useState)(I),_=D.filter(e=>e.date>=S).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),z=Math.min(T,900)-60,Y=e=>E.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,p.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,p.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:H===e,onPress:()=>R(e),testID:`forecast-range-${e}`},e))});return P.enough?(0,p.jsxs)(a.default,{style:{gap:12},children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsxs)(d.Muted,{children:["Hourly labels use the upper end of the Covers range. Steady starts at ",P.busy.steady,"; Busy starts at ",P.busy.busy,"."]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(d.T,{weight:"semibold",colour:u.colours.gold,children:["Today by hour \xb7 ",(0,c.niceDate)($)]}),P.example?(0,p.jsx)(b.ExampleBadge,{}):(0,p.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),P.open?(0,p.jsx)(y.Bars,{data:P.hours.map(e=>({key:String(e.hour),label:String(e.hour),a:e.booked,b:e.walkIns})),max:L,highlight:P.nextHour?String(P.nextHour.hour):void 0}):(0,p.jsx)(d.Muted,{children:"Closed today."}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#9C7C45'}}),(0,p.jsx)(d.Muted,{children:"Booked"})]}),(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#6B5A3A'}}),(0,p.jsx)(d.Muted,{children:"Expected walk-ins and later bookings"})]})]}),P.hours.map(e=>{const t=(0,y.busyLevel)(e.coversHigh,P.busy.busy);return(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{size:14,children:(0,x.fmtH)(e.hour)}),(0,p.jsxs)(d.T,{size:14,colour:u.colours.muted,children:[(0,s.coversRange)(e.coversLow,e.coversHigh),I?` \xb7 about ${e.takeaway} takeaway`:'']}),(0,p.jsx)(d.T,{size:14,weight:"semibold",colour:t.colour,children:t.label})]},e.hour)})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),P.suggestions.map((e,s)=>(0,p.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,p.jsx)(d.Muted,{children:P.example?`${l.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Next ",H," days (covers)"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Covers for the next ${H} days`}),E.filter(e=>e.f.flags.length).map(e=>(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",colour:I?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,p.jsx)(d.Button,{small:!0,kind:"ghost",label:N?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>O(!N)})]}),N?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,p.jsx)(j.LineChart,{width:z,series:[P.hours.map(e=>e.takeaway),P.hours.map(e=>e.takeawayPlaced)],labels:P.hours.map(e=>String(e.hour))}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsx)(d.Muted,{children:"Gold: forecast"}),(0,p.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.map(s=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(s.title)}),(0,p.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,p.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${k(s.date,S)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${k(s.date,S)}`,body:`${s.title} at ${C.name} ${k(s.date,S)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${f(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:f(s.title),body:`${f(s.title)} at ${C.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,p.jsxs)(a.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsx)(b.NotEnoughHistory,{weeks:P.minWeeks,booked:F}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",H," days"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${H} days`}),(0,p.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.slice(0,6).map(e=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(e.title)}),(0,p.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=e(_r(_d[3])),r=e(_r(_d[4])),d=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),j=_r(_d[14]),b=_r(_d[15]),p=_r(_d[16]);const k=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},f=e=>`${(0,o.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1393,[1120,34,1075,102,426,794,848,1122,851,827,840,865,1147,1100,1366,1125,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1394,[815]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=P,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,x]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)).slice(0,8),R=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),A=R.filter(e=>'due'===e.state||'overdue'===e.state),M=R.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,B.jsxs)(o.default,{style:{gap:12},children:[(0,B.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),b?(0,B.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,B.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,B.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,B.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,B.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,B.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===A.length?(0,B.jsx)(i.Muted,{children:"Nothing due right now."}):null,A.map(e=>(0,B.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,y.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,B.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,B.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),M.map(e=>(0,B.jsxs)(i.Muted,{children:[(0,y.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,y.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,B.jsx)(k.SectionHead,{title:"Live orders",right:(0,B.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,B.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,B.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,B.jsx)(P,{o:e},e.id)),v.length?(0,B.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,B.jsx)(i.Card,{style:{opacity:.7},children:(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,B.jsx)(O,{onClose:e=>{h(!1),e&&x(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),x=_r(d[13]),y=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]);const R={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function O({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),y=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,R]=(0,r.useState)(''),[O,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[N,$]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,F]=(0,r.useState)(''),[_,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,x.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries(N).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(y.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.ukPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(_),J=K.length>0&&Y&&(Q?O.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(y.map(e=>e.section)));return(0,B.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,B.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,B.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,B.jsx)(i.Field,{label:"Table number",value:O,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,B.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:R,placeholder:"e.g. Mrs Reid"}),Q?null:(0,B.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:F,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,B.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,B.jsx)(i.Field,{label:"Email (optional)",value:_,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too"}),'phone'===T?(0,B.jsxs)(o.default,{style:{gap:4},children:[(0,B.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,B.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,B.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,B.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),y.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,B.jsxs)(o.default,{style:{flex:1},children:[(0,B.jsx)(i.T,{size:15,children:e.name}),(0,B.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,B.jsx)(i.Stepper,{value:N[e.id]??0,min:0,max:20,label:e.name,onChange:t=>$({...N,[e.id]:t})})]},e.id)),(0,B.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,B.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,B.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,B.jsx)(l.GreensideCashOnly,{}):(0,B.jsx)(i.Banner,{kind:"demo",title:"Card payments: not set up yet",children:"Pay on collection or at the table. Nothing is charged in the app."}),(0,B.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?O.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:_.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${O.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function P({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),x=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,B.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,y.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",R[e.channel??(e.type,'app')]," \xb7 ",(0,y.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,B.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,B.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,B.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,B.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,B.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,B.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,y.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,B.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,B.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,B.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,B.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:x,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,B.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,B.jsx)(i.Button,{small:!0,kind:"ghost",label:"Reject",onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1395,[5,1342,829,1311,34,102,794,848,850,855,830,836,1134,1104,827,840,1147,1100,1135,1136,838,1348,833,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return le}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),p=_r(d[8]),b=_r(d[9]),h=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),v=_r(d[16]),w=_r(d[17]),E=_r(d[18]),N=_r(d[19]),P=_r(d[20]),W=_r(d[21]),A=_r(d[22]),T=_r(d[23]),R=_r(d[24]),M=(e=R)&&e.__esModule?e:{default:e},B=_r(d[25]),O=_r(d[26]),G=_r(d[27]),x=_r(d[28]),D=_r(d[29]),I=_r(d[30]),L=_r(d[31]),H=_r(d[32]),F=_r(d[33]),_=_r(d[34]),Q=_r(d[35]),V=_r(d[36]),q=_r(d[37]),U=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),$=_r(d[42]),J=_r(d[43]),K=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),ae=_r(d[49]),se=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),de=_r(d[55]);const le=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},ue=e=>n.CAN.manage(e);(0,y.register)([{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>ue(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:ue,C:o.ServiceBoard},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:ue,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:ue,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',badge:'NEW',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:ue,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:ue,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:ue,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:ue,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:b.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:ue,badge:'NEW',C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:h.PLAN_SUB,group:'Account',can:n.CAN.billing,C:h.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',badge:'NEW',C:W.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',badge:'NEW',C:N.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:N.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',badge:'NEW',can:ue,C:P.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:N.Timesheets}]),(0,y.register)([{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:A.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:A.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',badge:'NEW',can:ue,C:w.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',badge:'NEW',can:ue,C:E.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'Photo of the cash up sheet, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',badge:'NEW',can:ue,C:v.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:A.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:A.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:A.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:ue,C:A.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:ue,C:A.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:ue,C:A.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:ue,C:A.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:ue,C:A.ReviewEmailSettings},{id:'compliance',title:'Daily checks & allergen log',sub:'Fridge temps, opening checks, audit log',group:'Compliance',C:A.Compliance},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:A.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:ue,badge:'NEW',C:A.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:A.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:T.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>le(),C:T.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:ue,C:T.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:ue,C:T.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:T.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:ue,C:T.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:ue,C:T.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:ue,C:T.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:ue,C:T.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:T.TabletPreview}]);const ge=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',badge:'NEW',C:()=>M.default.createElement(O.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:B.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',badge:'NEW',can:ge,C:B.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',badge:'NEW',can:ge,C:O.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',badge:'NEW',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:G.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',badge:'NEW',C:x.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:ue,C:x.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:ue,badge:'NEW',C:x.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:ue,badge:'NEW',C:D.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:ue,badge:'NEW',C:D.DisplaySettingsPage}]);const ce=e=>'owner'===e||'manager'===e;I.ASSISTANT_AVAILABLE&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ce,badge:'NEW',C:I.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off, voice, connected services',group:'Account',can:ce,C:I.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',badge:'NEW',can:e=>'owner'===e&&!r.IS_CAR,C:H.CarScreen}]);const pe=e=>'owner'===e||'manager'===e,be=()=>{const e=l.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,u.costsAllowedFor)(t)},he=e=>pe(e)&&be();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:pe,badge:'NEW',C:L.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Creator},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Prices},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning, allergen checks; filters; CSV and print for the EHO',group:'Compliance',can:pe,badge:'NEW',C:L.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:pe,badge:'NEW',C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',badge:'NEW',C:L.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:ue,badge:'NEW',C:F.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:ue,badge:'NEW',C:F.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:ue,badge:'NEW',C:F.Outbox}]);const fe=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:fe,badge:'NEW',C:Q.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:fe,badge:'NEW',C:_.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:fe,badge:'NEW',C:V.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:fe,badge:'NEW',C:q.OrderSheetSettings},...U.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:fe,C:(0,_.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:fe,badge:'NEW',C:Y.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:fe,badge:'NEW',C:j.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:ue,badge:'NEW',C:j.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:fe,badge:'NEW',C:j.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:fe,badge:'NEW',C:z.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:ue,badge:'NEW',C:$.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:ue,badge:'NEW',C:$.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:ue,badge:'NEW',C:$.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:ue,badge:'NEW',C:J.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos, Show me where, or ask the Assistant',group:'Start here',can:ue,badge:'NEW',C:K.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:ue,badge:'NEW',C:Z.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, Booker and Bidfood lists, offers, events and specials the voice helper prepared; nothing is sent',group:'Run the day',can:ue,badge:'NEW',C:ee.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift, left by voice or typing',group:'Run the day',badge:'NEW',C:ee.ShiftNotesPage},{id:'voice',title:'Voice helper',sub:'Hold-to-talk input, text-only replies, who gets it and microphone privacy',group:'Settings',can:ue,badge:'NEW',C:ee.VoiceSettingsPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(te.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update',group:'Compliance',can:pe,badge:'NEW',C:function(){return M.default.createElement(ae.FoodSafetyCard,null)}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(ie.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:pe,badge:'NEW',C:function(){const{rid:e,today:t}=(0,se.useCtx)(6e4);return M.default.createElement(ie.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',badge:'NEW',C:function(){const{rid:e,me:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(re.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:ue,badge:'NEW',C:X.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',badge:'NEW',C:function(){const{me:e,role:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(oe.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:ue,C:ne.NightlyReportPage},{id:'support',title:'Chat with CoverCharge support',sub:'A message to the CoverCharge team',group:'Start here',can:ue,C:de.SupportChatPage}])},1396,[806,1397,846,1400,865,997,988,800,855,1402,1409,1419,1379,1420,1421,1423,1424,1425,1426,1155,1157,1428,1377,1429,34,1154,1145,1378,1367,1380,1413,1434,1435,1436,1370,1357,1384,1437,925,1438,1439,1440,1151,1385,1441,1311,1386,1453,1082,1043,1100,1156,1130,1454,1457,1460]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LookBackResult=k,_e.monthCells=v,_e.calendarDayLabel=C,_e.LookBackCalendar=T,_e.LookBack=function(){const{rid:e,today:s}=(0,d.useCtx)(3e4),[o,l]=(0,t.useState)((0,c.addDays)(s,-1)),[x,j]=(0,t.useState)((0,b.ukHistoryDate)(o)),[p,f]=(0,t.useState)(0),[m,D]=(0,t.useState)(!1),v=(0,u.useHistoricalBookingDay)(e,o,s,p),C=(0,b.parseHistoryInput)(x),w=!!C&&(0,b.validPastDate)(C,s);if(!v.allowed)return(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"Sign in to the Managers app with manager or owner access to Look back."})});const $=e=>{l(e),j((0,b.ukHistoryDate)(e))};return(0,h.jsxs)(i.default,{style:{gap:14},testID:"look-back",children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Look back"}),(0,h.jsx)(n.T,{size:18,center:!0,children:"Find bookings for one exact past date. Read-only; nothing is sent or changed."}),(0,h.jsx)(n.Field,{label:"Past booking date (DD MM YYYY)",value:x,onChangeText:j,placeholder:"05 11 2025",accessibilityLabel:"Exact past booking date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"look-back-date",style:{textAlign:'center'}}),w?null:(0,h.jsx)(n.T,{size:18,center:!0,children:"Enter a past date as DD MM YYYY, for example 09 11 2026, including the four-digit year."}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"look-back-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,c.longDay)(o)}`,onPress:()=>D(!0)}),(0,h.jsx)(n.Button,{label:"Show bookings",accessibilityLabel:`Look back at bookings for ${w&&C?(0,b.historyDateLabel)(C):'a valid past date'}`,disabled:!w,onPress:()=>{C&&$(C),f(p+1)}})]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Previous day",accessibilityLabel:`Previous day, ${(0,c.longDay)((0,c.addDays)(o,-1))}`,onPress:()=>$((0,c.addDays)(o,-1))}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Next day",accessibilityLabel:`Next day, ${(0,c.longDay)((0,c.addDays)(o,1))}`,disabled:!(0,b.validPastDate)((0,c.addDays)(o,1),s),onPress:()=>$((0,c.addDays)(o,1))})]})]})}),(0,h.jsx)(T,{visible:m,today:s,selected:o,onClose:()=>D(!1),onPick:e=>{$(e),D(!1)}}),v.data?(0,h.jsx)(k,{day:v.data}):(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:v.error||'Loading booking history\u2026'})})]})};var t=r(_d[0]),s=e(t),o=e(r(_d[1])),l=e(r(_d[2])),i=e(r(_d[3])),n=r(_d[4]),c=r(_d[5]),d=r(_d[6]),u=r(_d[7]),b=r(_d[8]),y=r(_d[9]),h=r(_d[10]);function k({day:e}){return(0,h.jsxs)(i.default,{testID:"look-back-result",style:{gap:14},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.T,{size:24,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:(0,b.historyDateLabel)(e.date)}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`Booked Covers: ${null===e.booked_covers?'not recorded':e.booked_covers}`,children:[(0,h.jsx)(n.T,{size:20,children:"Booked Covers"}),(0,h.jsx)(n.T,{size:36,weight:"bold",colour:y.colours.gold,children:null===e.booked_covers?'Not recorded':e.booked_covers})]}),e.historical_records?(0,h.jsx)(n.T,{size:20,colour:y.colours.gold,weight:"semibold",children:b.HISTORY_LABEL}):null,(0,h.jsx)(n.T,{size:18,children:b.HISTORY_NOTE}),e.missing_covers?(0,h.jsxs)(n.T,{size:18,children:[e.missing_covers," booking records have no party size; not filled in."]}):null]})}),e.bookings.length?null:(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"No booking records found for this date. The history is incomplete; this does not prove there were no bookings."})}),e.bookings.map((e,t)=>(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{testID:"look-back-booking",style:{gap:8},accessible:!0,accessibilityLabel:`${e.time??'Time not recorded'}, party size ${null===e.covers?'not recorded':`${e.covers} Covers`}, ${e.table?`table ${e.table}`:'table not recorded'}, ${e.status??'status not recorded'}${e.counted?'':', excluded from Booked Covers'}`,children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:20,children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,children:e.time??'Time not recorded'}),(0,h.jsxs)(n.T,{size:22,children:["Party size: ",null===e.covers?'Not recorded':`${e.covers} Covers`]})]}),(0,h.jsxs)(n.T,{size:20,children:["Table: ",e.table??'Not recorded']}),(0,h.jsxs)(n.T,{size:18,children:[e.status??'Status not recorded',e.counted?'':' \xb7 excluded from Booked Covers']}),(0,h.jsxs)(n.T,{size:18,colour:y.colours.muted,children:['favourite_table'===e.source?'previous booking system':'CoverCharge'," \xb7 ",e.ref]})]})},`${e.source}:${e.ref}:${t}`))]})}const x=['January','February','March','April','May','June','July','August','September','October','November','December'],j=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],p=e=>String(e).padStart(2,'0'),f=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=(e,t)=>{const[s,o]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1+t,1,12));return`${l.getUTCFullYear()}-${p(l.getUTCMonth()+1)}`},D=e=>{const[t,s]=e.split('-').map(Number);return`${x[s-1]} ${t}`};function v(e){const[t,s]=e.split('-').map(Number),o=new Date(Date.UTC(t,s,0)).getUTCDate();return[...Array(f(`${e}-01`)).fill(null),...Array.from({length:o},(t,s)=>`${e}-${p(s+1)}`)]}function C(e,t,s){const o=(0,b.validPastDate)(e,t);return`${(0,c.longDay)(e)}${e===t?', today':''}${e===s?', selected':''}${o?'':', not available. Look back is for past days only'}`}function T({visible:e,today:d,selected:u,onPick:k,onClose:x}){const[p,f]=(0,t.useState)(u.slice(0,7)),[T,w]=(0,t.useState)(0);s.default.useEffect(()=>{e&&f(u.slice(0,7))},[e,u]);const $=v(p),L=m(p,-1),z=m(p,1),P=`${z}-01`I>=46?e.slice(0,3):e.slice(0,2);return(0,h.jsx)(n.Sheet,{visible:e,onClose:x,title:"Pick a day",maxWidth:420,testID:"look-back-calendar",footer:(0,h.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,h.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:"look-back-cal-close",onPress:x})}),children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'stretch'},children:[(0,h.jsx)(n.T,{size:20,weight:"bold",colour:y.colours.goldLight,center:!0,accessibilityRole:"header",testID:"look-back-cal-month",children:D(p)}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:`Previous month, ${D(L)}`,testID:"look-back-cal-prev",onPress:()=>f(L)}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:P?`Next month, ${D(z)}`:`Next month, ${D(z)}, not available. Look back is for past days only`,disabled:!P,testID:"look-back-cal-next",onPress:()=>f(z)})]}),(0,h.jsxs)(i.default,{onLayout:e=>w(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,h.jsx)(i.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:j.map(e=>(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,h.jsx)(n.T,{size:13,colour:y.colours.muted,center:!0,children:S(e)})},e))}),(0,h.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:"look-back-cal-grid",children:$.map((e,t)=>{if(!e)return(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`blank-${t}`);const s=(0,b.validPastDate)(e,d),x=e===u;return(0,h.jsx)(l.default,{testID:`look-back-cal-${e}`,accessibilityRole:"button",accessibilityLabel:C(e,d,u),accessibilityState:{selected:x,disabled:!s},disabled:!s,onPress:()=>{k(e),o.default.announceForAccessibility?.(`Looking back at ${(0,c.longDay)(e)}`)},style:{width:"14.285714285714286%",height:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:x||e===d?1.5:0,borderColor:y.colours.gold,backgroundColor:x?y.colours.goldTint:'transparent',opacity:s?1:.35},children:(0,h.jsx)(n.T,{size:17,weight:x?'bold':'regular',colour:x?y.colours.goldLight:y.colours.text,center:!0,children:Number(e.slice(8))})},e)})})]})]})})}},1397,[34,281,402,102,794,1347,1100,1398,1399,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1398,[34,846,1399,827,985,931]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1399,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return k}}),_e.DashCorners=I,_e.ServiceBoard=function(){const{role:e}=(0,j.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,D.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,D.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,D.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,D.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,D.jsx)(I,{onLeave:y}),(0,D.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,D.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,D.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,D.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,D.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,D.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?w((0,D.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]),D=r(d[16]);const k=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function C({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,D.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,D.jsxs)(s.default,{children:[(0,D.jsx)(p.Icon,{name:t,colour:h.colours.gold}),u?(0,D.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,D.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function I({onLeave:e}){const t=(0,x.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>y.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,D.jsx)(C,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,D.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,D.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:k.filter(e=>'left'===e.side).map(n)}),(0,D.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[k.filter(e=>'right'===e.side).map(n),(0,D.jsx)(C,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')}),(0,D.jsx)(f.VoiceSlot,{size:44,layer:1})]})]})}function w(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[17]);return t(e,document.body)}},1400,[34,395,236,402,102,36,794,1041,1279,865,840,1116,1401,1153,1394,1100,25,277]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1401,[815]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, take a picture of the taking sheet and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1402,[796,1376,34,836,102,794,865,840,1100,899,924,1403,985,994,1047,1374,1404,1405,1407,1012,1408,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1403,[]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffDisplayControls=function({m:e}){const s=(0,p.usePinStatus)(t=>t[e.id]),[c,m]=(0,l.useState)(''),[h,y]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),b='owner'===e.role||'manager'===e.role?6:4,j=async()=>{S(!0);const t=await(0,p.setStaffPin)(e.id,c,b);S(!1),m(''),y(t.ok?`PIN ${s?.hasPin?'reset':'set'}. Tell ${e.name} in person; it isn\u2019t shown again.`:t.error??'Could not set the PIN.'),t.ok&&(0,p.refreshPinStatus)()};return(0,f.jsxs)(n.default,{testID:`display-controls-${e.id}`,style:{gap:6,paddingTop:4},children:[(0,f.jsx)(o.Toggle,{testID:`display-clock-${e.id}`,label:"Can clock in at the Display",value:!!e.displayClock,onChange:t=>u.useOwner.getState().updateStaff(e.id,{displayClock:t})}),e.displayClock?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Muted,{size:12,children:s?.locked?'PIN locked (5 wrong tries)':s?.hasPin?e.temp?'Code set':'PIN set':'No PIN yet'}),(0,f.jsx)(t.TextInput,{testID:`pin-input-${e.id}`,accessibilityLabel:`New PIN for ${e.name}`,value:c,onChangeText:e=>m(e.replace(/\D/g,'').slice(0,8)),placeholder:`${b}\u20138 digits`,placeholderTextColor:r.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",maxLength:8,style:{width:110,minHeight:34,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:`set-pin-${e.id}`,label:s?.hasPin?'Reset PIN':'Set PIN',disabled:x||c.length{j()}})]}):null,h?(0,f.jsx)(o.Muted,{children:h}):null,e.temp?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Badge,{kind:"gold",label:"Temp"}),(0,f.jsxs)(o.Muted,{size:12,children:[e.tempUntil?`Until ${e.tempUntil}`:'No end date'," \xb7 Display only, no phone app"]}),(0,f.jsx)(o.Button,{small:!0,kind:"ghost",testID:`make-full-${e.id}`,label:"Make full staff",onPress:()=>u.useOwner.getState().updateStaff(e.id,{temp:!1,tempUntil:void 0,job:'Temp'===e.job?'':e.job})})]}):null]})},_e.AddTempStaffButton=function({initialOpen:e}){const[t,s]=(0,l.useState)(!!e),[n,r]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),[y,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{(0,p.refreshPinStatus)()},[]);const S=()=>{s(!1),x(null),h(null)},b=async e=>{r(!0);const t=await(0,p.addTempStaff)(e);r(!1),t.ok&&t.ref&&t.code?(u.useOwner.setState(l=>({staff:[...l.staff.filter(e=>e.id!==t.ref),{id:t.ref,name:t.name??e.name,role:'staff',job:'Temp',active:!0,level:'Staff',dept:e.dept??'',displayClock:!0,temp:!0,tempUntil:e.until??void 0}],hourly:null!=e.rate?{...l.hourly,[t.ref]:Math.round(100*e.rate)}:l.hourly})),x({name:t.name??e.name,code:t.code})):h(t.error??'Could not add them.')};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Button,{testID:"add-temp-btn",kind:"secondary",label:"Add temp staff",onPress:()=>s(!0)}),t?(0,f.jsx)(o.Sheet,{visible:!0,onClose:S,title:y?'Temp added':'Add temp staff',maxWidth:560,testID:"add-temp",children:y?(0,f.jsx)(c.TempCode,{name:y.name,code:y.code,onClose:S}):(0,f.jsx)(c.AddTempForm,{busy:n,error:m,onSubmit:e=>{b(e)}})}):null]})};var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),n=(e=s)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),u=_r(d[5]),p=_r(d[6]),c=_r(d[7]),f=_r(d[8])},1404,[796,34,102,794,840,865,1321,1332,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AutoClockToggle=function({m:e}){const o=(0,s.useAutoClock)(t=>!!t.on[e.id]),[r,h]=(0,t.useState)(null);(0,t.useEffect)(()=>{(0,s.refreshAutoClock)()},[]);const f=e.name.replace(' (example)','');return(0,c.jsxs)(l.default,{testID:`auto-clock-${e.id}`,style:{gap:2,paddingTop:4},children:[(0,c.jsx)(n.Toggle,{testID:`auto-clock-toggle-${e.id}`,label:"Auto clock from rota",a11y:`Auto clock ${f} in and out at their rota times`,value:o,onChange:t=>{h(null),(0,s.setAutoClock)(e.id,t).then(e=>{e.ok||h(e.error??'Couldn\u2019t save.')})}}),(0,c.jsx)(n.Muted,{size:12,children:o?`${f} is clocked in at the start and out at the end of each rota shift, so they show in On now. Marked \u201cAuto from rota\u201d in Hours: you can still change the times and sign them off.`:`For someone who can\u2019t use the app: clocks ${f} in and out at their rota times.`}),r?(0,c.jsx)(n.T,{size:12,colour:u.colours.amber,children:r}):null]})};var e,t=_r(d[0]),o=_r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},n=_r(d[2]),s=_r(d[3]),u=_r(d[4]),c=_r(d[5])},1405,[34,102,794,1406,840,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAutoClock",{enumerable:!0,get:function(){return r}}),_e.refreshAutoClock=async function(){if(o.PITCH)return;const e=c();if(!e)return;try{const{data:n,error:o}=await(0,t.getSupabase)().from('staff_auto_clock').select('staff_ref, enabled').eq('venue_id',e);if(o||!n)return;const c={};for(const e of n)c[e.staff_ref]=!!e.enabled;r.setState({on:c,loaded:!0})}catch{}},_e.setAutoClock=async function(e,n){const s=r.getState().on[e]??!1;if(r.setState(t=>({on:{...t.on,[e]:n}})),o.PITCH)return{ok:!0};const u=c();if(!u)return r.setState(t=>({on:{...t.on,[e]:s}})),{ok:!1,error:'Not connected to the venue, so this can\u2019t be changed right now.'};try{const{error:o}=await(0,t.getSupabase)().rpc('set_staff_auto_clock',{p_venue:u,p_staff_ref:e,p_on:n});if(o)throw o;return{ok:!0}}catch(t){r.setState(t=>({on:{...t.on,[e]:s}}));const n=String(t?.message??'');return{ok:!1,error:/managers and owners/i.test(n)?'Only managers and owners can change auto clock.':'Couldn\u2019t save. Check the signal and try again.'}}};var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),o=_r(d[3]);const r=(0,e.create)(()=>({on:o.PITCH?{'st-jack':!0}:{},loaded:o.PITCH})),c=()=>n.useSync.getState().venueId},1406,[815,931,985,2]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1407,[34,102,794,840,993,1037,985,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setCanChangeBookings=async function(o,s){const c=n.useSync.getState().venueId;if(!c||'staff'!==n.useSync.getState().kind)return{ok:!1,error:'Saved on this device. Connect to the shared team to store it for everyone.'};const h=(0,t.getSupabase)();try{const{error:t}=await h.rpc('set_can_change_bookings',{p_venue:c,p_staff_ref:o,p_on:s});return t?{ok:!1,error:/owner or manager/i.test(t.message)?'Only an owner or manager can change this.':'Saved on this device. The server did not take the change.'}:{ok:!0}}catch{return{ok:!1,error:'Saved on this device. The server did not take the change.'}}};var t=r(d[0]),n=r(d[1])},1408,[931,985]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PRICING_AVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_VOICE_LINE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_SUPPLIER_LINE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DONE_FOR_YOU",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"doneForYouLine",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return v}}),_e.PlanBilling=function(){const{now:e,role:n,rid:b}=(0,p.useCtx)(6e4),j=(0,c.trialStatus)((0,l.defaultSimStart)(),e),[x,w]=(0,s.useState)(!1);return u.CAN.billing(n)?x?(0,y.jsx)(M,{onBack:()=>w(!1)}):(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(o.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,y.jsx)(t.VoiceUsageCard,{rid:b,now:e}),(0,y.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,y.jsxs)(i.default,{testID:"plan-founding",children:[(0,y.jsx)(o.T,{size:12,weight:"semibold",colour:h.colours.goldMuted,children:"FOUNDING OFFER \xb7 FIRST 50 VENUES"}),(0,y.jsxs)(o.T,{size:30,weight:"bold",children:["\xa349",(0,y.jsx)(o.T,{size:14,colour:h.colours.muted,children:" a month + VAT if applicable, per venue"})]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(o.Badge,{kind:"gold",label:"Every Full Restaurant Pro feature"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"One month free"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"\xa349 net locked in"})]}),(0,y.jsx)(o.Muted,{children:"Early adopter price for the first 50 venues: every Full Restaurant Pro App feature, including the owner's dashboard and admin and the voice Assistant. \xa349 net stays locked in while your subscription stays active."}),(0,y.jsxs)(o.T,{size:13,testID:"plan-early-done-for-you",children:["\u2713 ",T(P.early)]}),(0,y.jsx)(o.Muted,{children:"From venue 51, usual prices:"}),(0,y.jsxs)(i.default,{testID:"plan-usual-lite",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[k," \xb7 ",C," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:S}),O.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e)),(0,y.jsx)(o.T,{size:13,testID:"plan-lite-not-included",children:"Not included: the owner's dashboard and admin, or the voice Assistant."})]}),(0,y.jsxs)(i.default,{testID:"plan-usual-pro",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[_," \xb7 ",L," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:v}),R.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e))]}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>w(!0),style:{marginTop:6}})]}),(0,y.jsx)(o.Card,{children:(0,y.jsxs)(i.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,y.jsx)(o.T,{weight:"bold",colour:h.colours.gold,children:"free"}),"."]}),(0,y.jsx)(o.Muted,{children:"Your own app would cost about \xa398 in store fees in the first year alone (Apple \xa378.99 a year in the UK, Google US$25 one-off), then \xa378.99 a year."})]})}),(0,y.jsx)(o.Muted,{children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, and subscribers get free lifetime 24/7 customer support. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{children:"Free trial"}),(0,y.jsxs)(o.T,{weight:"bold",colour:h.colours.gold,children:[j.daysLeft," day",1===j.daysLeft?'':'s'," left"]})]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(100*(1-j.daysLeft/j.total))}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),(0,y.jsxs)(o.Muted,{children:["Then \xa3",c.PLAN.monthlyPence/100," a month + VAT if applicable. The trial start date is not set up yet."]})]}),(0,y.jsx)(f.AssistantPlanCard,{}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{weight:"semibold",children:"Free lifetime customer support"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"Included"})]}),(0,y.jsx)(o.Muted,{children:"Free for as long as you subscribe, day or night. Setup is all done digitally. Support contact details: not set up yet."})]})]}):(0,y.jsx)(o.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),i=(e=n)&&e.__esModule?e:{default:e},o=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),p=r(d[8]),f=r(d[9]),y=r(d[10]);const b=!0,j='Founding offer, free trial, set-up guide',x='. The owner\'s dashboard and admin come with Full Restaurant Pro App (\xa399 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',w='Voice Assistant (hold to talk) for seating guests, marking tables as cleared, temperature logs and finding something in the app: fair usage 1,000 voice tasks a month per venue',A='Supplier links: open your suppliers\' ordering sites and keep order lists',P={lite:1,pro:3,early:3},T=e=>`${e} done-for-you ${1===e?'change':'changes'} a month`,k='Customer & Takeaway App',_='Full Restaurant Pro App',C='\xa349',L='\xa399',S='A lite version of CoverCharge: 3 core customer and takeaway functions tailored to you, set up digitally with the in-app guided setup and step-by-step guides, free lifetime 24/7 customer support while subscribed, and unlimited self-edits of your basic info. The owner\'s dashboard and admin, and the voice Assistant, are not included.',v='Every feature, every app, including the owner\'s dashboard and admin and the voice Assistant. Set up digitally with the in-app guided setup and step-by-step guides, the Assistant (fair use 300 tasks a month), free lifetime 24/7 customer support while subscribed, and unlimited self-edits.',O=['Customer app: menu, allergens, bookings and loyalty','Takeaway ordering','Set up digitally: in-app guided setup and step-by-step guides','Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits of your basic info',T(P.lite)],R=['Every feature, every app','The owner\'s dashboard and admin',A,'Set up digitally: in-app guided setup and step-by-step guides','The Assistant, fair use 300 tasks a month',w,'Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits',T(P.pro)],I=[['Choose your 3 core functions','Pick what matters most to you, for example menu & allergens, takeaway ordering or the stamp card.'],['Add your logo and colours','More \u203a Branding: upload your logo; the apps use it everywhere.'],['Check your opening hours','More \u203a Opening hours: set your normal week and any closed days.'],['Add your menu and allergens','Menu & allergens: add dishes, prices and the 14 allergens, then sign each dish off.'],['Invite your team','More \u203a Team: add staff so they can use CoverCharge for Staff.'],['Share the customer app','More \u203a Your apps: copy the link or show the QR code at the counter.'],['Try a test order','Place a test order in the customer app and watch it arrive.']];function M({onBack:e}){const[t,n]=(0,s.useState)([]);return(0,y.jsxs)(i.default,{style:{gap:10},testID:"setup-guide",children:[(0,y.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,y.jsx)(o.H2,{children:"Set-up guide"}),(0,y.jsxs)(o.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",t.length," of ",I.length," done."]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(t.length/I.length*100)}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),I.map(([e,s],l)=>{const u=t.includes(l);return(0,y.jsx)(o.Card,{children:(0,y.jsxs)(o.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,y.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:u?h.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(o.T,{size:14,weight:"bold",colour:u?'#1a1610':h.colours.gold,children:u?'\u2713':String(l+1)})}),(0,y.jsxs)(i.default,{style:{flex:1,gap:4},children:[(0,y.jsx)(o.T,{weight:"semibold",children:e}),(0,y.jsx)(o.Muted,{children:s}),(0,y.jsx)(o.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>n(u?t.filter(e=>e!==l):[...t,l])})]})]})},e)}),(0,y.jsx)(o.Muted,{children:"Stuck? Free lifetime customer support is included while you subscribe. Ticks on this guide are not saved."})]})}},1409,[1410,34,102,794,819,865,1412,840,1100,1413,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceUsageCard=function({rid:e,now:o}){const h=(0,l.useVoiceUsage)(e,o);return(0,c.jsx)(s.Card,{children:(0,c.jsxs)(n.default,{testID:"voice-usage",style:{gap:6},children:[(0,c.jsx)(s.T,{weight:"semibold",children:h.line}),(0,c.jsx)(n.default,{style:{height:8,borderRadius:4,backgroundColor:t.colours.surface2,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${Math.min(100,Math.round(100*h.pct))}%`,height:8,backgroundColor:h.reached?t.colours.red:h.warn?t.colours.amber:t.colours.ok}})}),(0,c.jsxs)(s.Muted,{children:[l.VOICE_FAIR_USAGE,", shared by all of this venue\u2019s apps and devices. Food safety logging always works."]}),h.reached?(0,c.jsx)(s.Banner,{kind:"info",title:"Allowance reached for this month",children:l.REACHED_TEXT}):h.warn?(0,c.jsx)(s.Banner,{kind:"warn",title:"80% of this month\u2019s allowance used",children:"The voice helper keeps working until 1,000; it starts again on the 1st."}):null,(0,c.jsx)(s.Muted,{children:"For now the count is kept on each device; it will become one venue-wide count."})]})})},r(d[0]);var e,o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),l=r(d[4]),c=r(d[5])},1410,[34,102,794,840,1411,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1411,[808,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PLAN",{enumerable:!0,get:function(){return t}}),e.trialStatus=function(n,o){const l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),u=new Date(l.getFullYear(),l.getMonth()+t.trialMonths,l.getDate()),c=Math.max(0,Math.ceil((u.getTime()-o.getTime())/864e5));return{start:l,end:u,daysLeft:c,total:Math.round((u.getTime()-l.getTime())/864e5)}};const t={name:'CoverCharge',monthlyPence:4900,trialMonths:1,vatNote:'+ VAT if applicable'}},1412,[]); +__d(function(g,_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,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return S}}),_e.AssistantFab=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)(e=>e.enabled);return T(e)&&t?(0,k.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:y.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,k.jsx)(v,{size:22}),(0,k.jsx)(h.T,{weight:"bold",colour:A,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=S(e=>e.open),s=()=>S.getState().setOpen(!1),{rid:n,role:u,me:w}=(0,j.useCtx)(3e4),A=(0,x.useAssistant)(),B=R(),[P,O]=(0,o.useState)([]),[E,L]=(0,o.useState)(''),[z,W]=(0,o.useState)(!1),$=(0,o.useRef)(null),_=(0,o.useRef)(null);if((0,o.useEffect)(()=>{setTimeout(()=>$.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!T(u))return null;const N=(e,t,s)=>x.useAssistant.getState().record({at:(new Date).toISOString(),by:w,role:u,asked:e,action:t,outcome:s}),F=(e,t="result")=>O(s=>[...s,{id:I(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;L(''),O(e=>[...e,{id:I(),from:'you',text:t}]);try{s=await(0,m.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),O(e=>[...e,{id:I(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>O(s=>s.map(s=>s.id===e?{...s,state:t}:s)),V=async(e,t,s)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(s??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(C,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await b.repo.bookings.seatWalkIn(n,Number(o.party),s,'Added by Assistant'),s&&(0,p.resetTableLive)(n,s),F(`Done: Walk-in \xb7 ${o.party} seated${s?` at table ${s}`:' (table to assign)'}. It's in Bookings now.`),N(e.asked,t.title,'done');break}case'eightysix':await b.repo.menu.updateItem(String(o.itemId),{soldOut:Boolean(o.soldOut)}),F(o.soldOut?`Done: ${o.name} is marked sold out. Staff see it on the Display.`:`Done: ${o.name} is back on.`),N(e.asked,t.title,'done');break;case'price':await b.repo.menu.updateItem(String(o.itemId),{price:Number(o.pence)}),F(`Done: ${o.name} is now \xa3${(Number(o.pence)/100).toFixed(2)}.`),N(e.asked,t.title,'done');break;case'offer':f.useOwner.getState().addOffer({title:String(o.title),body:String(o.body),kind:'offer',live:!1}),F(`Done: draft offer \u201c${o.title}\u201d saved in Offers & specials (not live).`),N(e.asked,t.title,'done');break;case'rota':case'bookings':F(String(o.result)),N(e.asked,t.title,'looked up')}},G=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===A.tier,Y=(0,x.tasksUsed)(A);return(0,k.jsx)(a.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:s,children:(0,k.jsx)(c.default,{style:[h.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(c.default,{testID:"assistant-sheet",style:{backgroundColor:y.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:y.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:8,style:{flex:1},children:[(0,k.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:18})}),(0,k.jsx)(h.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,k.jsx)(r.default,{accessibilityLabel:"Close",onPress:s,hitSlop:10,children:(0,k.jsx)(h.T,{size:22,colour:y.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(c.default,{testID:"assistant-demo-badge",children:(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,k.jsxs)(c.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"info",title:"The Assistant is switched off in this preview",children:"Ask for things in plain English \u2014 add a walk-in, mark a dish sold out, check the rota, draft posts and replies \u2014 and confirm each one before anything happens. To use it, turn off the preview switch in More \u203a Account \u203a Assistant settings."}),(0,k.jsx)(h.Button,{kind:"secondary",label:"Close",onPress:s})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(l.default,{ref:$,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,k.jsxs)(c.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,k.jsxs)(h.T,{children:["Hi ",w.split(' ')[0]," \u2014 what can I do? I\u2019ll always show you what I\u2019m about to do and wait for you to confirm."]}),(0,k.jsx)(h.Muted,{children:"Try:"}),m.SUGGESTED_PROMPTS.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:y.colours.surface2},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,k.jsx)(c.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(h.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,k.jsx)(D,{m:e,onConfirm:(t,s)=>V(e,t,s),onCancel:()=>G(e)},e.id):'choose'===e.proposal.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,k.jsxs)(c.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:8},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]},e.id):(0,k.jsx)(c.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?y.colours.amberBg:y.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:y.colours.amber},children:(0,k.jsx)(h.T,{children:e.text})},e.id))]}),(0,k.jsxs)(h.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:E,onChangeText:L,onSubmitEditing:()=>H(E),returnKeyType:"send",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),A.voice?(0,k.jsx)(r.default,{testID:"assistant-mic",accessibilityRole:"button",accessibilityLabel:z?'Stop listening':'Speak',onPress:()=>{const e=M();if(e)if(z)_.current?.stop?.();else try{const t=new e;_.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&L(t)},t.onend=()=>W(!1),t.onerror=()=>{W(!1),F("Sorry, I didn't catch that. You can type instead.",'note')},W(!0),t.start()}catch{W(!1),F("Voice input isn't available here. Please type instead.",'note')}else F("Voice input isn't available in this browser (for example Huawei Browser). Please type your request instead.",'note')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:y.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:z?y.colours.gold:'transparent'},children:(0,k.jsx)(h.T,{size:20,children:"\ud83c\udfa4"})}):null,(0,k.jsx)(h.Button,{label:"Send",accessibilityLabel:"Send",disabled:!E.trim(),onPress:()=>H(E)})]}),(0,k.jsxs)(h.Muted,{center:!0,children:["Demo on this device \xb7 ",Y," of ",x.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,j.useCtx)(6e4),s=(0,x.useAssistant)();return T(t)?(0,k.jsxs)(c.default,{style:{gap:12},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(c.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:22})}),(0,k.jsxs)(c.default,{style:{flex:1},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,k.jsx)(h.Muted,{children:"Add walk-ins, mark dishes sold out, change prices, check the rota or bookings, draft offers, posts and replies. You confirm every action."})]})]}),(0,k.jsx)(h.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>S.getState().setOpen(!0)}),(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,k.jsxs)(c.default,{testID:"assistant-log",style:{gap:6},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>x.useAssistant.getState().clearLog()}):null]}),(0,k.jsx)(h.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,k.jsx)(h.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,k.jsxs)(c.default,{style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.T,{size:12,colour:y.colours.muted,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,")"]}),(0,k.jsx)(h.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,k.jsxs)(h.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,k.jsxs)(h.T,{size:13,colour:y.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,k.jsx)(h.Muted,{children:"The activity log is visible to the owner."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)();return T(e)?(0,k.jsxs)(c.default,{style:{gap:12},testID:"assistant-settings",children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,k.jsx)(h.Muted,{children:"Shows the gold Assistant button on every Managers screen."}),(0,k.jsx)(h.Toggle,{label:"Voice input (microphone)",value:t.voice,onChange:e=>t.set({voice:e})}),(0,k.jsx)(h.Muted,{children:"What you say is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. If this device can\u2019t record, just type."})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,k.jsxs)(c.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:y.colours.border,paddingTop:8},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:e.name}),(0,k.jsx)(h.Badge,{kind:"neutral",label:"Not connected"})]}),(0,k.jsxs)(h.Muted,{children:["Needed for ",e.does,". Until it\u2019s connected, the Assistant only shows you a preview \u2014 nothing is sent or changed."]})]},e.id)),(0,k.jsx)(h.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,k.jsx)(h.Muted,{children:"The Assistant comes with Full Restaurant Pro App and the early adopter offer. It isn\u2019t part of Customer & Takeaway App. This switch only shows how the app looks with it switched off."})]}):null,(0,k.jsx)(h.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to the voice assistant to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,x.useAssistant)(),t=(0,x.tasksUsed)(e),s=Math.min(1,t/x.FAIR_USE);return(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,k.jsx)(h.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,k.jsx)(c.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${x.FAIR_USE} tasks used`,style:{height:8,backgroundColor:y.colours.border,borderRadius:4},children:(0,k.jsx)(c.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:y.colours.gold,borderRadius:4}})}),(0,k.jsxs)(h.Muted,{children:[t," of ",x.FAIR_USE," tasks used this month (mock). A task is one confirmed action or look-up."]})]})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),o=_r(d[3]),a=e(_r(d[4]));_r(d[5]);var r=e(_r(d[6])),l=e(_r(d[7])),c=e(_r(d[8])),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),m=_r(d[14]),x=_r(d[15]),y=_r(d[16]),j=_r(d[17]),k=_r(d[18]);const w=!0,C='Nothing was sent or changed: this connection is not set up yet.',A='#1A1408',S=(0,u.create)(e=>({open:!1,setOpen:t=>e({open:t})})),T=e=>'owner'===e||'manager'===e,I=()=>Math.random().toString(36).slice(2,9);function v({size:e=24,colour:t=A}){return(0,k.jsx)(h.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function R(){const{rid:e,r:t,now:n,today:a}=(0,j.useCtx)(3e4),r=(0,b.useAllMenu)(e),l=(0,p.useTableNames)(e),c=(0,b.useBookings)(e),u=(0,f.useOwner)(e=>e.staff),h=(0,f.useOwner)(e=>e.shifts),m=(0,f.useOwner)(e=>e.offers),x=(0,f.useOwner)(e=>e.suppliers);return(0,o.useMemo)(()=>({venue:t.name,now:n.toISOString(),menu:r.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:l,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:h.filter(e=>e.published&&e.date>=(0,f.addDays)(a,-(0,f.weekdayOf)(a))&&e.date<=(0,f.addDays)(a,6-(0,f.weekdayOf)(a))),bookingsToday:c.filter(e=>e.date===a).sort((e,t)=>e.time.localeCompare(t.time)).map(e=>({name:e.walkIn?'Walk-in':e.name,party:e.partySize,time:e.time,table:e.table,status:e.status})),specials:m.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,s.examplesAllowed)()?{from:`${x[0]?.contact??'Alex Sample'}, ${x[0]?.name??'Example Fish Co.'}`,subject:'Price update for next week (example)',body:'Langoustine is up about 8% next week because of the weather. Haddock and hake unchanged. Same delivery days.'}:null}),[t,n.getMinutes(),r,l,c,u,h,m,x])}function D({m:e,onConfirm:s,onCancel:n}){const a=e.proposal,[r,l]=(0,o.useState)(!1),[u,p]=(0,o.useState)('external'===a.kind?a.text:''),b='open'===e.state;return'inapp'!==a.kind&&'external'!==a.kind?null:(0,k.jsxs)(c.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?y.colours.gold:y.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:y.colours.surface2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:a.title}),'external'===a.kind?(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,k.jsx)(h.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===a.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[a.detail?(0,k.jsx)(h.Muted,{children:a.detail}):null,(0,k.jsx)(h.T,{size:14,colour:y.colours.muted,children:a.label}),r&&b?(0,k.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:u,onChangeText:p,style:[h.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,k.jsx)(c.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:y.colours.gold,paddingLeft:10},children:(0,k.jsxs)(h.T,{children:["\u201c",u,"\u201d"]})}),(0,k.jsxs)(h.Muted,{children:["Sends to: ",a.service.map(e=>m.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,k.jsxs)(c.default,{style:{gap:4},children:[(0,k.jsx)(h.Muted,{children:a.detail}),a.warning?(0,k.jsxs)(h.T,{size:13,colour:y.colours.amber,children:["\u26a0 ",a.warning]}):null]}),b?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,k.jsx)(h.Button,{small:!0,label:'inapp'===a.kind?a.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(a,u)}),'external'===a.kind?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:r?'Done editing':'Edit',testID:"edit-action",onPress:()=>l(!r)}):null,(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,k.jsx)(h.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,k.jsxs)(h.Muted,{children:["Nothing happens until you tap ",'inapp'===a.kind?a.confirmLabel:'Confirm',"."]}):null]})}function M(){return'undefined'==typeof window?null:(0,n.speechRecognizer)()}const B=[{id:'facebook',name:'Facebook (Page & Messenger)',does:'posts and the Messenger auto-reply'},{id:'instagram',name:'Instagram',does:'posts'},{id:'gmail',name:'Gmail',does:'drafting and replying to email'},{id:'wix',name:'Website bookings',does:'website changes such as opening hours'}]},1413,[796,858,929,34,395,236,402,295,102,815,794,1096,848,865,1414,1418,840,1100,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"interpretDemo",{enumerable:!0,get:function(){return t.interpretDemo}}),e.getProvider=function(o="demo"){return'xai'===o?n.xaiProvider:t.demoProvider};var t=r(d[0]),n=r(d[1]),o=r(d[2]);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]}})})},1414,[1415,1417,1416]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.interpretDemo=u,Object.defineProperty(_e,"demoProvider",{enumerable:!0,get:function(){return m}});var e=r(_d[0]),t=r(_d[1]);const a=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],n=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,o=e=>e.toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').trim(),s=e=>o(e).replace(/\([^)]*\)/g,' ').split(/[^a-z0-9]+/).filter(e=>e.length>2&&!['the','and','with','our'].includes(e)),l={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},d=e=>e?l[e]??Number(e):NaN,c=e=>(e.match(/["\u201c\u201d']([^"\u201c\u201d]{3,})["\u201c\u201d']?\s*$/)||e.match(/\bto[:\s]+(.{3,})$/i)||[])[1]?.replace(/["\u201c\u201d]+$/,'').trim();function p(e,t){const a=s(t),n=e.menu.map(e=>{const n=s(e.name);return{m:e,hits:a.filter(e=>n.includes(e)).length,exact:o(e.name).includes(o(t))}}),l=n.filter(e=>e.exact);if(1===l.length)return[l[0].m];const d=Math.max(0,...n.map(e=>e.hits));if(!d)return[];const c=n.filter(e=>e.hits===d).map(e=>e.m);return d===a.length&&1===c.length?c:c.slice(0,4)}function u(s,l){const u=o(s),m=new Date(l.now);if(/messenger|auto-?reply|away message/.test(u)){return{kind:'external',intent:'messenger-autoreply',service:['messenger'],title:'Facebook Messenger auto-reply',label:'Change Messenger auto-reply to:',text:c(s)||`Thanks for getting in touch with ${l.venue}! We'll reply as soon as we can. To book a table, use our app.`}}if(/\b(post|share|publish)\b/.test(u)&&/facebook|instagram|\bfb\b|\binsta|\big\b|social/.test(u)){const e=/facebook|\bfb\b|social/.test(u),t=/instagram|\binsta|\big\b|social/.test(u),a=/special/.test(u)&&l.specials.length?`Tonight at ${l.venue}: ${l.specials.map(e=>e.title.replace(/\s*\(example\)/i,'')).join(' \xb7 ')}. Book in the app or just walk in!`:c(s)||`Tonight at ${l.venue} \u2014 come and see us!`,n=[...e?['facebook']:[],...t?['instagram']:[]];return{kind:'external',intent:'social-post',service:n,title:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}`,label:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}:`,text:a}}if(/(reply|respond|answer|draft).*(e-?mail|gmail|supplier)|(e-?mail|gmail).*(reply|draft)/.test(u)){const e=l.latestSupplierEmail;if(!e)return{kind:'unknown',message:"I can't read your email yet: CoverCharge isn't linked to Gmail. Paste the supplier's message here and I'll draft a reply for you to check and send yourself.",suggestions:[]};const t=`Hi ${e.from.split(' ')[0]},\n\nThanks for letting us know. That's fine for this week \u2014 please keep our usual standing order and let me know if anything changes.\n\nBest wishes,\n${l.venue}`;return{kind:'external',intent:'gmail-reply',service:['gmail'],title:`Gmail reply to ${e.from}`,label:`Reply to "${e.subject}" (${e.from}):`,text:t,detail:`Latest supplier email (example): "${e.body}"`}}if(/\bwix\b|website|web site/.test(u)&&/hour|open|clos/.test(u)){return{kind:'external',intent:'wix-hours',service:['wix'],title:'Website bookings opening hours',label:'Update website bookings opening hours to:',text:[1,2,3,4,5,6,0].map(e=>{const t=l.kitchenHours[e];return`${a[(e+6)%7]}: ${t?`${t[0]}\u2013${t[1]}`:'Closed'}`}).join('\n'),detail:'From the kitchen hours saved in CoverCharge.'}}const h=u.match(/walk-?in\b.*?\b(?:for|of)\s+(\d+|[a-z]+)(?:.*?\btable\s+([a-z]?\d+[a-z]?(?:\+\d+)?))?/)||u.match(/\b(\d+|[a-z]+)\s+walk-?ins?\b(?:.*?\btable\s+([a-z]?\d+))?/);if(h&&!Number.isNaN(d(h[1]))){const t=d(h[1]),a=h[2]?h[2].toUpperCase():'';if(a&&!l.tables.map(e=>e.toUpperCase()).includes(a))return{kind:'unknown',message:`There's no table ${a} on the table plan. Try one of: ${l.tables.slice(0,12).join(', ')}.`,suggestions:[`Add a walk-in for ${t} at table ${l.tables[0]}`]};const n=a?l.bookingsToday.find(e=>e.table?.toUpperCase().split('+').includes(a)&&['seated','confirmed'].includes(e.status)):void 0;return{kind:'inapp',intent:'walkin',title:`Seat a walk-in for ${t}${a?` at table ${a}`:''}`,detail:`Adds \u201cWalk-in \xb7 ${t}\u201d to today's bookings${a?` at table ${a}`:' (table to assign)'} and counts ${t} covers.`,confirmLabel:'Seat walk-in',params:{party:t,table:a},warning:n?`${(0,e.tableNumbers)(a)} also has a ${n.status} booking at ${n.time} (party of ${n.party}).`:void 0}}const b=u.match(/^(?:please )?(?:mark |set |make )?(?:the )?(.+?)\s+(?:as |to )?(?:86'?d?|86ed|sold out)(?=\W|$)/)||u.match(/^86 (?:the )?(.+)$/),f=u.match(/^(?:put |mark |set )?(?:the )?(.+?)\s+(?:back on|as available|available again|un-?86'?d?)/);if((b||f)&&!/walk|book|rota|price/.test(u)){const e=(b||f)[1].replace(/^mark |^set /,''),t=p(l,e),a=!!f&&!b;return 1===t.length?{kind:'inapp',intent:'eightysix',title:a?`Put ${t[0].name} back on`:`Mark ${t[0].name} sold out`,detail:a?'Takes it off the Sold out list and the Display.':'A reminder for staff: it shows on the Display and in the Sold out list until you put it back on. It doesn\'t change your till.',confirmLabel:a?'Back on':'Mark sold out',params:{itemId:t[0].id,name:t[0].name,soldOut:!a}}:t.length>1?{kind:'choose',message:`I couldn't find "${e}" exactly on the menu. Did you mean:`,options:t.map(e=>({label:e.name,prompt:`Mark ${e.name} sold out`}))}:{kind:'unknown',message:`I couldn't find "${e}" on the menu.`,suggestions:['Mark the Fish Supper sold out']}}const k=u.match(/(?:change|set|update|make)\s+(?:the\s+)?(?:price\s+of\s+(?:the\s+)?)?(.+?)\s+(?:price\s+)?to\s+\xa3?\s?(\d+(?:\.\d{1,2})?)/);if(k&&/\xa3|price|\d/.test(u)){const e=p(l,k[1].replace(/\s*price$/,'')),t=Math.round(100*Number(k[2]));if(1===e.length)return{kind:'inapp',intent:'price',title:`Change ${e[0].name} to \xa3${(t/100).toFixed(2)}`,detail:`Now ${null==e[0].price?'board price':`\xa3${(e[0].price/100).toFixed(2)}`}. Updates the menu in the customer app.`,confirmLabel:'Change price',params:{itemId:e[0].id,name:e[0].name,pence:t}};if(e.length>1)return{kind:'choose',message:'Which dish?',options:e.map(e=>({label:e.name,prompt:`Change the price of ${e.name} to \xa3${(t/100).toFixed(2)}`}))}}if(/rota|who'?s on|who is on|working|on shift/.test(u)){let e=(m.getDay()+6)%7,t='today';/tomorrow/.test(u)&&(e=(e+1)%7,t='tomorrow');const o=a.findIndex(e=>u.includes(e.toLowerCase()));o>=0&&(e=o,t=a[o]);const s=l.shifts.filter(t=>t.day===e).sort((e,t)=>e.start-t.start).map(e=>{const t=l.staff.find(t=>t.id===e.staffId);return`${t?.name??'Someone'} (${t?.job??''}) ${n(e.start)}\u2013${n(e.end)}`});return{kind:'inapp',intent:'rota',title:`Show the rota for ${t} (${a[e]})`,detail:'Read-only: looks up the rota saved in CoverCharge. Nothing is changed.',confirmLabel:'Show rota',params:{day:e,label:t,result:s.length?s.join('\n'):'Nobody is on the rota.'}}}if(/booking|covers|reservations?/.test(u)&&!/^(add|make|create)/.test(u)){const t=l.bookingsToday.filter(e=>!['cancelled','noshow'].includes(e.status)),a=t.map(t=>`${t.time} \xb7 ${t.name} \xb7 ${t.party}${t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:''} \xb7 ${t.status}`);return{kind:'inapp',intent:'bookings',title:"Show today's bookings",detail:'Read-only: looks up bookings saved in CoverCharge. Nothing is changed.',confirmLabel:'Show bookings',params:{result:`${t.length} bookings, ${t.reduce((e,t)=>e+t.party,0)} covers\n${a.join('\n')}`}}}if(/(draft|create|write|make|add).*(offer|deal|promo|special)/.test(u)){const e=(s.match(/(?:offer|deal|promo|special)\s+(?:for|on)\s+(.+)$/i)||[])[1]?.trim(),t=e?`${e[0].toUpperCase()}${e.slice(1)}`:'Midweek offer (draft)';return{kind:'inapp',intent:'offer',title:`Draft an offer: ${t}`,detail:'Saved as a draft in Offers & specials (not live, nothing sent). Edit it there before you publish.',confirmLabel:'Save draft',params:{title:t,body:e?`${t} at ${l.venue}. Ask your server for details.`:`A midweek treat at ${l.venue}. Add the details before you publish.`}}}return{kind:'unknown',message:"Sorry \u2014 I can't do that yet. Here are some things I can help with:",suggestions:t.SUGGESTED_PROMPTS.slice(1,6)}}const m={id:'demo',label:'On-device assistant',interpret:async(e,t)=>u(e,t)}},1415,[829,1416]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUGGESTED_PROMPTS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SERVICE_LABEL",{enumerable:!0,get:function(){return t}});const o=['Change our Facebook Messenger auto-reply to "Thanks for your message \u2014 we reply within the hour. To book, use the app."','Draft a reply to the latest supplier email','Add a walk-in for 4 at table 7',"Post tonight's specials to Facebook & Instagram",'Mark the fish pie sold out',"Who's on the rota tomorrow?",'Update website bookings opening hours'],t={facebook:'Facebook',messenger:'Facebook Messenger',instagram:'Instagram',gmail:'Gmail',wix:'Website bookings'}},1416,[]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_TOOLS",{enumerable:!0,get:function(){return o}}),e.callToText=a,e.interpretWithServer=s,Object.defineProperty(e,"xaiProvider",{enumerable:!0,get:function(){return u}});var t=_r(d[0]),n=_r(d[1]);const r=(t,n,r,o=[])=>({type:'function',function:{name:t,description:n,parameters:{type:'object',properties:r,required:o}}}),o=[r('walk_in','Seat a walk-in party now',{party:{type:'integer',description:'Number of covers'},table:{type:'string',description:'Table name, optional'}},['party']),r('sold_out','Mark a dish sold out, or put it back on',{dish:{type:'string',description:'Dish name'},back_on:{type:'boolean',description:'True to put it back on'}},['dish']),r('set_price','Change the menu price of a dish',{dish:{type:'string',description:'Dish name'},pounds:{type:'number',description:'New price in pounds'}},['dish','pounds']),r('show_rota','Show who is on the rota',{day:{type:'string',description:'today, tomorrow or a weekday'}}),r('show_bookings',"Show today's bookings and covers",{}),r('draft_offer','Draft an offer (saved as a draft, not live)',{what:{type:'string',description:'What the offer is for'}})];function a(t,n){const r=t=>String(n[t]??'').trim();switch(t){case'walk_in':return Number(n.party)>0?`walk-in for ${Number(n.party)}${r('table')?` table ${r('table')}`:''}`:null;case'sold_out':return r('dish')?n.back_on?`put ${r('dish')} back on`:`mark ${r('dish')} sold out`:null;case'set_price':return r('dish')&&Number(n.pounds)>0?`change the price of ${r('dish')} to \xa3${Number(n.pounds)}`:null;case'show_rota':return`who's on the rota ${r('day')||'today'}`;case'show_bookings':return"today's bookings";case'draft_offer':return"draft an offer"+(r('what')?` for ${r('what')}`:'');default:return null}}async function s(r,s,u=n.askServer){const c=(0,t.interpretDemo)(r,s);if('unknown'!==c.kind)return c;const p=await u('owner',r,o);if('call'===p.kind){const n=a(p.name,p.args);if(n){const r=(0,t.interpretDemo)(n,s);if('unknown'!==r.kind)return r}return c}return'text'===p.kind?{kind:'unknown',message:p.text,suggestions:[]}:c}const u={id:'xai',label:'Voice assistant (server, with on-device fallback)',interpret:s}},1417,[1415,930]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FAIR_USE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useAssistant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tasksUsed",{enumerable:!0,get:function(){return b}});var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]);const c=300,u=(0,s.create)()((0,l.persist)(e=>({enabled:!0,voice:!0,tier:'pro',baseUsed:41,log:[],set:t=>e(t),record:t=>e(e=>({log:[{...t,id:`as-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`},...e.log].slice(0,200)})),clearLog:()=>e({log:[]})}),{name:'covercharge-assistant-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:(e,t)=>t<2?{...e,enabled:!0,voice:!0}:e})),b=e=>((0,t.examplesAllowed)()?e.baseUsed:0)+e.log.filter(e=>['done','demo (nothing sent)','looked up'].includes(e.outcome)).length},1418,[858,808,815,818]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.InfoHours=function(){const{r:e}=(0,w.useCtx)(6e4),[t,s]=(0,d.useState)(e.tagline),[n,i]=(0,d.useState)(e.phone??''),[a,r]=(0,d.useState)(e.about??''),[o,h]=(0,d.useState)(e.kitchenHours),[g,x]=(0,d.useState)(!1);return(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"info",title:"Edit basic info yourself anytime",children:"Prices, sold-out, hours and specials are free to change on any plan, as often as you like."}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.location}),(0,T.jsx)(p.Field,{label:"Tagline",value:t,onChangeText:s}),(0,T.jsx)(p.Field,{label:"Phone",value:n,onChangeText:i,keyboardType:"phone-pad"}),(0,T.jsx)(p.Field,{label:"About",value:a,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Kitchen hours"}),k.map((e,t)=>{const s=P[t],n=o[s];return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{style:{width:44},children:e}),n?(0,T.jsxs)(p.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>h({...o,[s]:[e,n[1]]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,T.jsx)(p.T,{children:"\u2013"}),(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>h({...o,[s]:[n[0],e]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,T.jsx)(p.Muted,{style:{flex:1},children:"Closed"}),(0,T.jsx)(c.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>h({...o,[s]:e?['12:00','20:00']:null}),trackColor:{true:b.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:b.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,T.jsx)(p.Muted,{children:e.hoursNote}):null]}),(0,T.jsx)(p.Button,{label:"Save changes",onPress:()=>{R().updateRestaurant(e.id,{tagline:t,phone:n,about:a,kitchenHours:o}),x(!0)}}),g?(0,T.jsx)(p.Banner,{kind:"success",title:"Saved",children:"Shared with your other devices and the customer app. Guests see it next time they open the app."}):null]})},_e.Photos=function(){const e=(0,x.useOwner)(e=>e.photos),[t,s]=(0,d.useState)('');return i.LIVE_VENUE_BUILD?(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,T.jsx)(p.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Placeholder photos",children:"Adding photos from the camera or gallery isn\u2019t set up yet. Tiles stand in for uploaded photos."}),(0,T.jsx)(p.Row,{wrap:!0,gap:8,children:e.map(e=>(0,T.jsxs)(u.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,T.jsx)(p.T,{size:13,children:e.caption}),(0,T.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>x.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,T.jsx)(p.T,{size:13,colour:b.colours.gold,children:"Remove"})})]},e.id))}),(0,T.jsx)(p.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,T.jsx)(p.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{x.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:n,role:l}=(0,w.useCtx)(6e4),a=(0,g.useAllMenu)(t),[r,c]=(0,d.useState)(null),[h,x]=(0,d.useState)(!1),[f,m]=(0,d.useState)(5),[C,v]=(0,d.useState)([]),[k,P]=(0,d.useState)('all'),B=(0,g.useStore)(e=>e.menu),O=e=>!!B.find(t=>t.id===e)?.hidden,$=a.filter(e=>!e.signOff&&!O(e.id)).length;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Button,{small:!0,label:"Add dish",onPress:()=>c('new')}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{x(!h),v([])}}),!e||'owner'!==l&&'manager'!==l?null:(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),$?(0,T.jsx)(o.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,T.jsx)(p.Banner,{kind:"warn",title:`${$} dish${1===$?'':'es'} awaiting the head chef's sign-off`,children:"Allergens, section and price come from each dish\u2019s recipe card. The head chef signs cards off in the Head Chef app. Tap to open Recipe cards."})}):null,h?(0,T.jsx)(p.Banner,{kind:"warn",title:"Price changes reset sign-off",children:"Each dish\u2019s price is on its recipe card, so a price change sets that card back to \u201cAwaiting sign-off\u201d until the head chef signs it off."}):null,i.LIVE_VENUE_BUILD?(0,T.jsx)(p.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Scheduled menus"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:"All day",selected:'all'===k,onPress:()=>P('all')}),(0,T.jsx)(p.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>P('lunch')}),(0,T.jsx)(p.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>P('dinner')})]}),(0,T.jsx)(p.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,T.jsxs)(p.Card,{highlight:b.colours.gold,children:[(0,T.jsxs)(p.T,{weight:"semibold",children:["Bulk price edit \xb7 ",C.length," selected"]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Change by %"}),(0,T.jsx)(p.Stepper,{value:f,onChange:m,min:-30,max:30,label:"percent"})]}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>v(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,T.jsx)(p.Button,{small:!0,label:`Apply ${f>0?'+':''}${f}%`,disabled:!C.length||0===f,onPress:()=>{C.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&R().updateMenuItem(e,{price:5*Math.round(t.price*(100+f)/100/5)})}),v([])}})]}),(0,T.jsx)(p.Muted,{children:"Prices round to the nearest 5p."})]}):null,s.sections.map(e=>{const t=a.filter(t=>t.section===e&&('all'===k||'lunch'!==k||!/supper|steak|lobster/i.test(t.name)));return t.length?(0,T.jsxs)(u.default,{style:{gap:6},children:[(0,T.jsx)(y.SectionHead,{title:e}),t.map(e=>(0,T.jsxs)(u.default,{style:[p.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,T.jsx)(p.Toggle,{label:`select ${e.name}`,value:C.includes(e.id),onChange:t=>v(t?[...C,e.id]:C.filter(t=>t!==e.id))}):null,(0,T.jsxs)(o.default,{style:{flex:1},onPress:()=>c(e),accessibilityRole:"button",children:[(0,T.jsx)(p.T,{weight:"medium",children:e.name}),(0,T.jsxs)(p.Muted,{children:[null!=e.price?(0,j.gbp)(e.price):e.priceNote??'Board price'," \xb7 ",Object.keys(e.allergens).length," allergens \xb7 ",e.signOff?`signed off by ${e.signOff.by}, ${e.signOff.at}`:'awaiting sign-off']})]})]}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>(R().updateMenuItem(e.id,{soldOut:!e.soldOut}),(0,S.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,T.jsx)(p.Chip,{label:O(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:O(e.id),onPress:()=>R().updateMenuItem(e.id,{hidden:!O(e.id)})})]})]},e.id))]},e):null}),r?(0,T.jsx)(M,{item:'new'===r?null:r,onClose:()=>c(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:s}=(0,w.useCtx)(6e4),n=(0,g.useEvents)(t).filter(e=>e.restaurantId===t),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[h,x]=(0,d.useState)(null),f=(()=>{const e=a.trim(),t=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(e);if(t){const e=Number(t[1]),s=Number(t[2]);return e>=1&&e<=31&&s>=1&&s<=12?`${t[3]}-${String(s).padStart(2,'0')}-${String(e).padStart(2,'0')}`:''}return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:''})(),j=l.trim().length>2&&!!f&&!Number.isNaN((0,m.parseYmd)(f).getTime());return(0,T.jsxs)(u.default,{style:{gap:10},children:[n.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:t.date=s?(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{g.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),x(null)}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>x(null)})]}):(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>x(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Add an event"}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i,placeholder:"e.g. Seafood night"}),(0,T.jsx)(p.Field,{label:"Date (DD/MM/YYYY)",value:a,onChangeText:r,placeholder:"20/11/2026"}),(0,T.jsx)(p.Field,{label:"Description",value:o,onChangeText:c,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add event",disabled:!j,onPress:()=>{R().addEvent({restaurantId:t,date:f,title:l.trim(),kind:'event',description:o.trim(),example:!1}),i(''),r(''),c('')}}),(0,T.jsx)(p.Muted,{children:"Events show in the customer app\u2019s What\u2019s on and on its booking dates, and feed the forecast."})]})]})},_e.GiftCardsPage=function(){const{rid:e}=(0,w.useCtx)(6e4),n=(0,g.useStore)((0,h.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[l,i]=(0,d.useState)(25),[a,r]=(0,d.useState)(''),o=n.reduce((e,t)=>e+t.initial,0),c=n.reduce((e,t)=>e+t.balance,0);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Sold (all time)"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(o)})]}),(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Outstanding balance"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(c)})]})]}),n.map(e=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,T.jsx)(p.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,T.jsxs)(p.Muted,{children:[e.code," \xb7 ",(0,j.gbp)(e.balance)," of ",(0,j.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,T.jsx)(p.Chip,{label:`\xa3${e}`,selected:l===e,onPress:()=>i(e)},e))}),(0,T.jsx)(p.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,T.jsx)(s.GreensideCashOnly,{}):(0,T.jsx)(p.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,T.jsx)(p.Button,{label:`Issue \xa3${l} card`,disabled:a.trim().length<2,onPress:()=>{R().buyGiftCard(e,100*l,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,w.useCtx)(6e4),t=(0,g.useRatings)(e),[s,n]=(0,d.useState)('all'),l=t.filter(e=>'all'===s||e.stars<=3).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),i=t.length?t.reduce((e,t)=>e+t.stars,0)/t.length:0;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,T.jsxs)(p.Row,{gap:4,children:[(0,T.jsx)(p.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,T.jsx)(p.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,T.jsx)(p.Banner,{kind:"danger",title:"Low-rating alert",children:`${t.filter(e=>e.stars<=2).length} rating(s) at 2\u2605 or below. Reply within 24 hours.`}):null,l.map(e=>(0,T.jsxs)(p.Card,{highlight:e.stars<=2?b.colours.red:void 0,children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.customerName}),(0,T.jsxs)(p.T,{colour:b.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,T.jsx)(p.T,{size:14,children:e.comment||'(no comment)'}),(0,T.jsx)(p.Muted,{children:e.context??''})]},e.id)),(0,T.jsx)(p.Banner,{kind:"info",title:"No review gating",children:"After private feedback, every customer (whatever their rating) is shown the link to leave a public Google review. Low ratings alert you here so you can put it right."}),(0,T.jsx)(p.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return y.DemoTag}}),_e.StampSettings=function(){return i.LIVE_VENUE_BUILD||(0,a.staffServer)()?(0,T.jsx)(r.LoyaltySettingsPanel,{}):(0,T.jsx)(O,{})},_e.Offers=function({go:e}){return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,a.staffServer)()?(0,T.jsx)(p.Banner,{kind:"info",title:"Stamp card offers are in Settings \u203a Advanced \u203a Loyalty",children:"Offers there are saved on the server and shown on every guest\u2019s stamp card. Specials below stay as they were."}):null,(0,T.jsx)(B,{go:e})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),o=e(_r(_d[8])),c=e(_r(_d[9])),u=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),m=_r(_d[17]),b=_r(_d[18]),y=_r(_d[19]),w=_r(_d[20]),S=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]);const k=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],P=[1,2,3,4,5,6,0],R=()=>g.useStore.getState();function M({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,w.useCtx)(6e4),[i,a]=(0,d.useState)(e?.name??''),[r,o]=(0,d.useState)(e?.description??''),[c,u]=(0,d.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,g]=(0,d.useState)(e?.section??l.sections[0]??'Mains'),[x,j]=(0,d.useState)(e?.prepMins??0),m=''===c.trim()?null:Math.round(100*Number(c)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},S=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,T.jsx)(p.Field,{label:"Name",value:i,onChangeText:a}),(0,T.jsx)(p.Field,{label:"Description",value:r,onChangeText:o,multiline:!0}),(0,T.jsx)(p.Field,{label:"Price \xa3 (blank = board price)",value:c,onChangeText:u,keyboardType:"decimal-pad"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,T.jsx)(p.Chip,{label:e,selected:h===e,onPress:()=>g(e)},e))}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Prep time (min)"}),(0,T.jsx)(p.Stepper,{value:x,onChange:j,min:1,max:60,label:"prep minutes"})]}),(0,T.jsx)(p.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[f.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,T.jsx)(p.Badge,{label:'may'===y[e.id]?`May contain ${e.short.toLowerCase()}`:e.short,kind:'may'===y[e.id]?'amber':'red'},e.id)),e&&!Object.keys(y).length?(0,T.jsx)(p.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,T.jsx)(p.Muted,{children:e?e.signOff?`Signed off by ${e.signOff.by} on ${e.signOff.at}.`:'Awaiting sign-off by the head chef.':'Saving adds the dish and its recipe card. Add the ingredients and allergens on the card; the dish stays off the menu until the head chef signs it off.'}),s?(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,S&&e?.signOff?(0,T.jsx)(p.Banner,{kind:"warn",title:"Sign-off resets",children:"Name, price and section live on the recipe card. Changing them sets the card back to \u201cAwaiting sign-off\u201d until the head chef signs it off again."}):null,(0,T.jsx)(p.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?R().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:x}):R().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:x,soldOut:!1,signOff:null}),t()}})]})}function B({go:e}){const{now:t}=(0,w.useCtx)(6e4),s=(0,x.useOwner)(e=>e.offers),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)('special'),[h,g]=(0,d.useState)(null);return(0,T.jsxs)(u.default,{style:{gap:10},children:[s.map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,T.jsxs)(p.Muted,{children:[t.body,t.until?` \xb7 until ${(0,m.niceDate)((0,m.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,T.jsx)(p.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Toggle,{label:"Live in app",value:t.live,onChange:e=>x.useOwner.getState().updateOffer(t.id,{live:e})}),(0,T.jsx)(p.Muted,{children:t.live?'Live in app':'Hidden'}),(0,T.jsx)(u.default,{style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>g(t.id)})]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"New special or offer"}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Chip,{label:"Special",selected:'special'===o,onPress:()=>c('special')}),(0,T.jsx)(p.Chip,{label:"Offer",selected:'offer'===o,onPress:()=>c('offer')})]}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i}),(0,T.jsx)(p.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add",disabled:l.trim().length<3,onPress:()=>{x.useOwner.getState().addOffer({title:l.trim(),body:a.trim(),kind:o,live:!0}),i(''),r('')}})]}),h?(()=>{const e=s.find(e=>e.id===h);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:()=>g(null),title:"Push notification composer",children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,T.jsxs)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,T.jsx)(p.Muted,{children:"CoverCharge \xb7 now"}),(0,T.jsx)(p.T,{weight:"semibold",children:e.title}),(0,T.jsx)(p.T,{size:14,children:e.body})]}),(0,T.jsxs)(p.Muted,{children:["Audience: customers who opted in to ",(0,v.venueInfo)().name," offers. No audience count is available."]}),(0,T.jsx)(p.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{x.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,m.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),g(null)}})]})})():null]})}function O(){const{r:e}=(0,w.useCtx)(6e4),t=e.settings,[s,n]=(0,d.useState)(t.stampReward);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Stamp card"}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Stamps for a reward"}),(0,T.jsx)(p.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>R().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Minimum spend"}),(0,T.jsx)(p.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>R().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,T.jsxs)(p.Muted,{children:[(0,j.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,T.jsx)(p.Field,{label:"Reward",value:s,onChangeText:n}),(0,T.jsx)(p.Button,{small:!0,label:"Save reward",onPress:()=>R().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,T.jsx)(u.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:b.colours.gold,backgroundColor:t<3?b.colours.gold:'transparent'}},t))}),(0,T.jsxs)(p.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1419,[5,1342,798,796,806,1206,1364,34,402,410,102,853,794,848,865,830,836,827,840,1147,1100,1135,1367,1167,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1420,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandingSettings=function(){const{rid:e,r:t}=(0,h.useCtx)(6e4),p=(0,l.useBrand)(e),x=(0,c.useOwner)(e=>e.setBranding),[j,f]=(0,r.useState)(''),y=(0,c.useOwner)(o=>o.branding[e]?.recent)??[],[w,C]=(0,r.useState)(p.accent);(0,r.useEffect)(()=>{C(p.accent)},[p.accent]);const v=(0,r.useMemo)(()=>(0,a.checkAccent)(w,u.colours.bg,u.colours.onGold,u.colours.text),[w]);return(0,b.jsxs)(n.default,{style:{gap:10},children:[(0,b.jsx)(d.Muted,{children:"Your logo, name and accent colour lead every CoverCharge app: Managers, Staff, Display, Head Chef and the customer app. A small \u201cpowered by CoverCharge\u201d stays at the top left."}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Customer header preview"}),(0,b.jsxs)(n.default,{testID:"branding-preview",style:{backgroundColor:u.colours.bg,borderRadius:12,borderWidth:1,borderColor:u.colours.border,padding:12,gap:4},children:[(0,b.jsx)(l.PoweredBy,{}),(0,b.jsxs)(d.Row,{gap:10,children:[(0,b.jsx)(l.RestaurantLogo,{rid:e,size:52}),(0,b.jsxs)(n.default,{style:{flex:1},children:[(0,b.jsx)(d.T,{weight:"semibold",size:18,children:t.name}),(0,b.jsx)(d.T,{size:12,colour:v.accentText,children:t.location})]})]}),(0,b.jsx)(n.default,{testID:"branding-preview-button",style:{marginTop:8,backgroundColor:w,borderRadius:10,paddingVertical:10,alignItems:'center'},children:(0,b.jsx)(d.T,{weight:"semibold",colour:v.onAccent,children:"Book a table"})})]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Logo"}),(0,b.jsxs)(d.Muted,{children:[p.custom?'Your uploaded logo.':'anchorage'===e?'Built in: The Anchorage logo in black and gold.':l.BUILTIN_LOGOS[e]?`Built in: ${t.name} logo.`:'Built in: placeholder initials for this demo venue.'," Square images work best."]}),(0,b.jsxs)(d.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(d.Button,{label:"Upload a logo",onPress:async()=>{const r=await o.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(r.canceled||!r.assets?.[0])return;const t=r.assets[0],n=t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri;x(e,{logoUri:n}),f('Logo updated in all apps on this device.')},testID:"branding-upload"}),p.custom?(0,b.jsx)(d.Button,{kind:"secondary",label:"Use the built-in logo",onPress:()=>{x(e,{logoUri:void 0}),f('Back to the built-in logo.')}}):null]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Accent colour"}),(0,b.jsx)(d.Muted,{children:"Any colour you like for your own brand. The preview above changes as you drag."}),(0,b.jsx)(s.ColourPicker,{value:w,onChange:C,onCommit:o=>{o===p.accent&&y[0]===o||(x(e,{accent:o,recent:(0,a.pushRecent)(y,o)}),f(`Accent set to ${o}.`))},quick:l.ACCENTS,recent:y}),v.tips.length?(0,b.jsx)(n.default,{testID:"accent-tip",style:{borderWidth:1,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg,borderRadius:10,padding:10,gap:4},children:v.tips.map(e=>(0,b.jsx)(d.T,{size:13,colour:u.colours.amber,children:e},e))}):null,(0,b.jsx)(d.Muted,{children:"Used for the restaurant line in headers, the logo ring and main buttons. Text on it is picked to stay readable."})]}),j?(0,b.jsx)(d.Banner,{kind:"success",title:"Saved",children:j}):null,(0,b.jsx)(d.Button,{kind:"ghost",label:"Restore default branding",onPress:()=>{x(e,null),f('Default branding restored.')}}),(0,b.jsx)(d.Muted,{children:"Saved the same way as your logo: on this device, shared by all the apps on it. Nothing is uploaded."})]})};var e,o=(function(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(r){if('default'!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),o.default=e,o})(_r(_d[0])),r=_r(_d[1]),t=_r(_d[2]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),b=_r(_d[10])},1421,[1061,34,102,1422,799,847,794,865,840,1100,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ColourPicker=function({value:e,onChange:p,onCommit:v,quick:y,recent:w}){const[R,C]=(0,t.useState)(()=>(0,c.hexToHsv)(e)),[H,T]=(0,t.useState)(e),[S,M]=(0,t.useState)(!1),F=(0,t.useRef)(e);(0,t.useEffect)(()=>{(0,c.normaliseHex)(e)!==(0,c.normaliseHex)(F.current)&&(F.current=e,C((0,c.hexToHsv)(e)),T(e))},[e]);const k=e=>{C(e);const o=(0,c.hsvToHex)(e);F.current=o,T(o),M(!1),p(o)},D=(0,t.useMemo)(()=>(0,c.hsvToHex)({h:R.h,s:R.s,v:1}),[R.h,R.s]),E=(0,t.useMemo)(()=>f.map(e=>(0,c.hsvToHex)({h:e,s:1,v:1})),[]),I=e=>{const o=(0,c.normaliseHex)(e);o&&(F.current=o,C((0,c.hexToHsv)(o)),T(o),M(!1),p(o),v(o))},z=(o,t,n)=>(0,x.jsx)(s.default,{testID:`accent-${n}-${t}`,accessibilityRole:"button",accessibilityLabel:`Accent ${o}`,onPress:()=>I(o),hitSlop:4,style:{width:40,height:40,borderRadius:20,backgroundColor:o,borderWidth:3,borderColor:(0,c.normaliseHex)(e)===(0,c.normaliseHex)(o)?u.colours.text:u.colours.border}},n+o+t);return(0,x.jsxs)(n.default,{testID:"colour-picker",style:{gap:10},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Drag across for the colour, up and down for how strong it is"}),(0,x.jsxs)(b,{testID:"picker-area",label:"Colour and strength",height:170,onMove:(e,o)=>k({h:360*e,s:1-o,v:R.v}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:[(0,x.jsxs)(l.Defs,{children:[(0,x.jsx)(l.LinearGradient,{id:"cpHue",x1:"0",y1:"0",x2:"1",y2:"0",children:E.map((e,o)=>(0,x.jsx)(l.Stop,{offset:o/(E.length-1),stopColor:e},o))}),(0,x.jsxs)(l.LinearGradient,{id:"cpSat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#FFFFFF",stopOpacity:0}),(0,x.jsx)(l.Stop,{offset:1,stopColor:"#FFFFFF",stopOpacity:1})]})]}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpHue)"}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpSat)"})]}),(0,x.jsx)(j,{x:R.h/360*100+"%",y:100*(1-R.s)+"%",colour:D})]}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Brightness"}),(0,x.jsxs)(b,{testID:"picker-brightness",label:"Brightness",height:36,onMove:e=>k({...R,v:Math.max(.04,e)}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 10",children:[(0,x.jsx)(l.Defs,{children:(0,x.jsxs)(l.LinearGradient,{id:"cpVal",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#000000"}),(0,x.jsx)(l.Stop,{offset:1,stopColor:D})]})}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"10",fill:"url(#cpVal)"})]}),(0,x.jsx)(j,{x:100*R.v+"%",y:"0%",colour:(0,c.hsvToHex)(R),round:!1})]}),(0,x.jsxs)(h.Row,{gap:10,style:{alignItems:'center'},children:[(0,x.jsx)(n.default,{testID:"picker-swatch",style:{width:46,height:46,borderRadius:10,backgroundColor:(0,c.normaliseHex)(H)??e,borderWidth:1,borderColor:u.colours.border}}),(0,x.jsxs)(n.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Hex code"}),(0,x.jsx)(o.TextInput,{testID:"picker-hex",value:H,autoCapitalize:"characters",autoCorrect:!1,maxLength:7,placeholder:"#CFA45F",placeholderTextColor:u.colours.muted,accessibilityLabel:"Hex code",onChangeText:e=>{T(e);const o=(0,c.normaliseHex)(e);M(!o&&e.replace('#','').length>=6),o&&6===e.replace('#','').length&&(F.current=o,C((0,c.hexToHsv)(o)),p(o))},onBlur:()=>{const e=(0,c.normaliseHex)(H);e?I(e):(T(F.current),M(!1))},onSubmitEditing:()=>{const e=(0,c.normaliseHex)(H);e?I(e):M(!0)},style:{minHeight:46,borderRadius:10,borderWidth:1,borderColor:S?u.colours.amber:u.colours.accentBorder,backgroundColor:u.colours.surface2,color:u.colours.text,paddingHorizontal:12,fontSize:16}})]})]}),S?(0,x.jsx)(h.T,{size:13,colour:u.colours.amber,children:"Use six letters or numbers after #, like #CFA45F."}):null,(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Quick picks"}),(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:y.map((e,o)=>z(e,o,'quick'))}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Recent colours"}),w.length?(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:w.map((e,o)=>z(e,o,'recent'))}):(0,x.jsx)(h.Muted,{children:"Colours you choose show here."})]})};var o=r(d[0]),t=r(d[1]);r(d[2]);var s=e(r(d[3])),n=e(r(d[4])),l=r(d[5]),i=e(l),c=r(d[6]),u=r(d[7]),h=r(d[8]),x=r(d[9]);const p={touchAction:'none',cursor:'crosshair',userSelect:'none'},f=[0,30,60,90,120,150,180,210,240,270,300,330,360];function b({height:e,onMove:o,onEnd:s,children:l,testID:i,label:c}){const h=(0,t.useRef)({w:1,h:e}),f=e=>{const{locationX:t,locationY:s}=e.nativeEvent;o(Math.min(1,Math.max(0,t/h.current.w)),Math.min(1,Math.max(0,s/h.current.h)))};return(0,x.jsx)(n.default,{testID:i,accessibilityLabel:c,onLayout:e=>{h.current={w:Math.max(1,e.nativeEvent.layout.width),h:Math.max(1,e.nativeEvent.layout.height)}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:f,onResponderMove:f,onResponderRelease:s,onResponderTerminate:s,style:[{height:e,borderRadius:10,overflow:'hidden',borderWidth:1,borderColor:u.colours.border},p],children:(0,x.jsx)(n.default,{pointerEvents:"none",style:{flex:1},children:l})})}const j=({x:e,y:o,colour:t,round:s=!0})=>(0,x.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:e,top:o,width:26,height:s?26:'100%',marginLeft:-13,marginTop:s?-13:0,borderRadius:s?13:6,borderWidth:3,borderColor:u.colours.text,backgroundColor:t,shadowColor:'#000',shadowOpacity:.6,shadowRadius:3}})},1422,[796,34,236,402,102,900,799,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.RecipeCardsPage=function(){const{rid:c,role:u,me:f}=(0,o.useCtx)(),_=(0,o.useSignedIn)(),l='owner'===u?'owner':'manager'===u?'manager':'staff';return(0,s.jsx)(t.RecipeCards,{rid:c,actor:(0,n.cardActorFor)(f,l,_),mode:'staff'===l?'read':'edit'})},r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4])},1423,[34,1132,832,1100,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:c,role:s,me:u,meId:l,today:p}=(0,t.useCtx)(6e4),_='owner'===s||'manager'===s;return(0,o.jsx)(n.CashUpScreen,{rid:c,today:p,canEdit:_,who:{id:l??'me',name:u.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),t=r(d[2]),o=r(d[3])},1424,[34,1048,1100,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1425,[34,1317,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=y,_e.SpendPerHeadPage=function(){const{rid:e,today:s}=(0,c.useCtx)(6e4),a=(0,r.useBookings)(e),n=(0,o.useCashUp)(e=>e.cashUps),[b,j]=(0,t.useState)('day'),k=(0,d.hasAnyTakings)(n,e),w=(0,d.dayRows)(n,a,e,s,14),f=(0,d.weekRows)(n,a,e,s,8),v=(0,d.averageSph)(w),$=(e,t,s,a,n)=>(0,u.jsxs)(l.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:h.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${t}: ${'No takings entered'===a?'no takings entered':`spend per head ${a}`}, ${s}${n?`, ${n}`:''}`,children:[(0,u.jsx)(i.T,{center:!0,children:t}),(0,u.jsx)(i.T,{center:!0,colour:h.colours.muted,children:s}),(0,u.jsx)(i.T,{center:!0,weight:"semibold",colour:'No takings entered'===a?h.colours.muted:h.colours.goldLight,size:'No takings entered'===a?13:16,children:a}),n?(0,u.jsx)(i.Muted,{center:!0,children:n}):null]},e);return(0,u.jsxs)(l.default,{style:{gap:12},testID:"sph-screen",children:[(0,u.jsx)(i.Muted,{children:"Tip: spend per head is Gross takings \xf7 Covers. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,u.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,u.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==v?(0,u.jsx)(i.T,{size:22,weight:"semibold",colour:h.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,u.jsxs)(i.T,{size:34,weight:"bold",colour:h.colours.goldLight,testID:"sph-avg",children:[p(v)," ",(0,u.jsx)(i.T,{size:16,colour:h.colours.muted,children:"per head"})]}),(0,u.jsx)(i.Muted,{children:k?'Only days with gross takings entered are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has Gross takings.'})]}),(0,u.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(i.Chip,{testID:"sph-day",label:"By day",selected:'day'===b,onPress:()=>j('day')}),(0,u.jsx)(i.Chip,{testID:"sph-week",label:"By week",selected:'week'===b,onPress:()=>j('week')})]}),'day'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by day"}),(0,u.jsx)(y,{testID:"sph-trend-day",label:"Spend per head trend by day",points:w.map(e=>({label:x(e.date),value:e.sph}))}),[...w].reverse().map(e=>$(e.date,x(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':p(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${p(e.foodPh)}, drink ${p(e.drinkPh)} per head`:void 0))]}):null,'week'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,u.jsx)(y,{testID:"sph-trend-week",label:"Spend per head trend by week",points:f.map(e=>({label:`w/c ${x(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...f].reverse().map(e=>$(e.weekStart,`w/c ${x(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':p(e.sph)))]}):null,(0,u.jsx)(i.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var t=_r(_d[0]),s=e(t),l=e(_r(_d[1])),a=_r(_d[2]),n=e(a),i=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,x=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function y({points:e,testID:r,label:o}){const[d,c]=(0,t.useState)(320),[x,y]=(0,t.useState)(e.length);(0,t.useEffect)(()=>y(e.length),[e.length,r]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,x)),k=Math.max(0,j-b),w=e.slice(k,j),f=Math.max(140,d-68),v=e.map(e=>e.value).filter(e=>null!=e),$=Math.max(5,5*Math.ceil(Math.max(0,...v)/5)),T=e=>38+e*(f-76)/Math.max(1,w.length-1),S=e=>140-e/$*106,L=[];let D=[];w.forEach((e,t)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:t,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${p(e.value)}`).join(', ');return(0,u.jsxs)(l.default,{testID:r,onLayout:e=>c(e.nativeEvent.layout.width),style:{gap:8},children:[(0,u.jsxs)(l.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,u.jsx)(n.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,u.jsx)(a.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:h.colours.muted,children:p($*e/4)},e))}),(0,u.jsxs)(n.default,{width:f,height:170,children:[[0,1,2,3,4].map(e=>(0,u.jsx)(a.Line,{x1:0,x2:f,y1:S($*e/4),y2:S($*e/4),stroke:h.colours.border,strokeWidth:1},e)),L.map((e,t)=>(0,u.jsx)(a.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:h.colours.gold,strokeWidth:2.5},t)),w.map((e,t)=>(0,u.jsx)(s.default.Fragment,{children:null==e.value?(0,u.jsx)(a.Circle,{cx:T(t),cy:140,r:2,fill:"#444"}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Circle,{cx:T(t),cy:S(e.value),r:4,fill:h.colours.goldLight}),(0,u.jsx)(a.Text,{x:T(t),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:h.colours.goldLight,children:p(e.value)})]})},k+t))]})]}),(0,u.jsx)(l.default,{style:{flexDirection:'row',gap:12},children:w.map((e,t)=>(0,u.jsxs)(l.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':p(e.value)}`,children:[(0,u.jsx)(i.T,{center:!0,size:12,colour:h.colours.muted,children:e.label}),(0,u.jsx)(i.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?h.colours.muted:h.colours.goldLight,children:null==e.value?'No takings entered':p(e.value)})]},k+t))}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===k,onPress:()=>y(Math.max(b,j-b))}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Later",accessibilityLabel:"Later spend per head chart points",disabled:j>=e.length,onPress:()=>y(Math.min(e.length,j+b))})]})]})}},1426,[34,102,900,794,848,1024,1427,840,1100,25]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COUNTED",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"serviceOfBooking",{enumerable:!0,get:function(){return o}}),e.coversOn=d,e.dayRows=i,e.weekRows=function(n,t,s,o,d){const u=(0,r.weekStartOf)(o);return Array.from({length:d},(l,f)=>{const h=(0,r.addDaysYmd)(u,7*(f-d+1)),m=i(n,t,s,(0,r.addDaysYmd)(h,6),7).filter(r=>r.date<=o&&null!=r.gross),p=m.length?Math.round(100*m.reduce((r,n)=>r+n.gross,0))/100:null,v=m.reduce((r,n)=>r+n.covers,0);return{weekStart:h,gross:p,covers:v,days:m.length,sph:c(p,v)}})},e.serviceRows=function(n,t,s,o,i,l=1020){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r])),h=[];for(let n=0;nnull!=r.gross&&r.covers>0);return n.length?c(n.reduce((r,n)=>r+n.gross,0),n.reduce((r,n)=>r+n.covers,0)):null},Object.defineProperty(e,"hasAnyTakings",{enumerable:!0,get:function(){return l}});var r=_r(_d[0]);const n=['seated','finished'],t=r=>n.includes(r.status),s=r=>{const[n,t]=r.split(':').map(Number);return 60*n+(t||0)},o=(r,n)=>s(r.time)r.restaurantId===n&&r.date===s&&t(r)&&(!d||o(r,u)===d)).reduce((r,n)=>r+(n.partySize||0),0)}const u=r=>'number'==typeof r&&Number.isFinite(r)?r:null,c=(r,n)=>null==r||n<=0?null:Math.round(r/n*100)/100;function i(n,t,s,o,i){const l=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,f)=>{const h=(0,r.addDaysYmd)(o,f-i+1),m=l.get(h)?.vals??{},p=(0,r.grossOf)(m),v=d(t,s,h),y=u(m.food),b=u(m.drink);return{date:h,gross:p,covers:v,sph:c(p,v),food:y,drink:b,foodPh:c(y,v),drinkPh:c(b,v)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.grossOf)(n.vals))},1427,[13]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1428,[34,793,1100,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(W,{})},_e.Merch=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(X,{})},_e.TablesQr=function({go:e}={}){const{rid:s,r:t,now:r,me:a}=(0,A.useCtx)(1e4);return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(l.StaffTableOrders,{rid:s,me:a}),(0,V.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(t)?(0,V.jsx)(q,{rid:s,now:r,me:a}):(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:s,r:t,now:r}=(0,A.useCtx)(3e4),n=(0,T.useOrders)(s),a=t.settings,l=(0,P.takeawaySlots)(t,n,r).slice(0,10),i=e=>_().updateSettings(s,e),o=n.filter(e=>'takeaway'===e.type&&(0,B.LIVE)(e));return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:a.takeawayPaused?I.colours.red:I.colours.ok,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:a.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,V.jsx)(v.Toggle,{label:"Takeaway on",value:!a.takeawayPaused,onChange:e=>i({takeawayPaused:!e})})]}),(0,V.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Slot length (min)"}),(0,V.jsx)(v.Stepper,{value:a.slotMinutes,min:5,max:30,onChange:e=>i({slotMinutes:e}),label:"slot minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Orders per slot"}),(0,V.jsx)(v.Stepper,{value:a.slotCap,min:1,max:20,onChange:e=>i({slotCap:e}),label:"orders per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,V.jsx)(v.Stepper,{value:a.leadMins,min:5,max:60,onChange:e=>i({leadMins:e}),label:"lead minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,V.jsx)(v.Stepper,{value:a.bufferMins,min:0,max:20,onChange:e=>i({bufferMins:e}),label:"buffer minutes"})]}),(0,V.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Next slots"}),l.map(e=>(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{size:14,children:e.label}),(0,V.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:I.colours.border,borderRadius:4},children:(0,V.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?I.colours.red:I.colours.gold,borderRadius:4}})}),(0,V.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,V.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,V.jsxs)(v.Muted,{children:[e.slotTime?(0,O.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,B.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:r,r:n}=(0,A.useCtx)(6e4),a=n.settings,l=(0,S.useOwner)(e=>e.reminders),i=e=>_().updateSettings(r,e),o=e=>S.useOwner.getState().setOwner({reminders:{...l,...e}});return(0,V.jsxs)(w.default,{style:{gap:10},children:[s.IS_GREENSIDE?(0,V.jsx)(t.GreensideCashOnly,{}):(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,V.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(a);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,V.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,V.jsx)(v.Toggle,{label:"24h reminder",value:l.h24,onChange:e=>o({h24:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,V.jsx)(v.Toggle,{label:"2h reminder",value:l.h2,onChange:e=>o({h2:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,V.jsx)(v.Toggle,{label:"confirm",value:l.confirmText,onChange:e=>o({confirmText:e})})]}),(0,V.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,V.jsx)(v.Stepper,{value:a.bookingCoversPerSlot,min:2,max:60,onChange:e=>i({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Typical table turn (min)"}),(0,V.jsx)(v.Stepper,{value:a.turnMins,min:30,max:180,onChange:e=>i({turnMins:e}),label:"turn minutes"})]}),(0,V.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,V.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:s,today:t,role:r,me:n}=(0,A.useCtx)(1e4),[a,l]=(0,x.useState)(null),i=(0,T.useOrders)(s),o=(0,T.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===s&&e.date===t))),d=(0,T.useAudit)(s).filter(e=>'allergy'===e.kind),c=(0,z.useUnsignedDishes)(s),h=(0,T.useStore)(e=>e.bookings),u=i.filter(e=>(0,B.LIVE)(e)&&(0,D.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i.filter(B.LIVE))).length,g=(0,A.useSignedIn)(),p=(0,F.cardActorFor)(n,'owner'===r?'owner':'manager'===r?'manager':'staff',g);if('unsigned'===a)return(0,V.jsx)(z.UnsignedDishList,{rid:s,actor:p,onClose:()=>l(null),onOpenCards:()=>e('more','recipecards')});if('pending'===a)return(0,V.jsx)(K,{go:e,onClose:()=>l(null)});const b={flex:1,minHeight:48};return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>l('pending'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?I.colours.red:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,V.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>l('unsigned'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?I.colours.amber:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,V.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,V.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,V.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,V.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,V.jsxs)(v.Muted,{children:[(0,O.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,V.jsx)(v.Muted,{children:"No allergy events yet."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,V.jsx)(w.default,{style:{gap:10},children:(0,V.jsxs)(v.Card,{highlight:I.colours.gold,style:{alignItems:'center'},children:[(0,V.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:I.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,V.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,V.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,V.jsx)(v.T,{size:20,weight:"bold",colour:I.colours.gold,children:"CoverCharge for Display"}),(0,V.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:s,r:t}=(0,A.useCtx)(6e4),r=(0,d.useLiveVenue)(),n=s=>s.startsWith('tab:')?e(s.slice(4)):e('more',s),a=e=>e.startsWith('tab:')?'tab:forecast'!==e||S.CAN.forecasts(s):(()=>{const t=L.PAGES.find(s=>s.id===e);return!!t&&(!t.can||t.can(s))})();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:I.colours.gold,children:[(0,V.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(t)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,s,t])=>(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"medium",children:e}),(0,V.jsx)(v.Muted,{children:s})]}),(0,V.jsx)(v.Badge,{kind:'This app'===t?'ok':'gold',label:t})]},e)),'owner'===s?(0,V.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{S.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,V.jsx)(v.Muted,{children:r?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,V.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...Y].filter(e=>4!==e.n||(0,M.orderAtTableOn)(t)).sort((e,s)=>e.n-s.n).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(v.T,{weight:"bold",colour:I.colours.gold,style:{width:26},children:[e.n,"."]}),(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"semibold",children:e.title}),(0,V.jsx)(v.Muted,{children:e.note})]})]}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>a(e)).map(([e,s])=>(0,V.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>n(s)},s))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"card"}):(0,V.jsx)(G,{})},_e.Referrals=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"referrals"}):(0,V.jsx)(H,{})};var s=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),I=_r(_d[30]),B=_r(_d[31]),A=_r(_d[32]),N=_r(_d[33]),$=_r(_d[34]),L=_r(_d[35]),D=_r(_d[36]),E=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),V=_r(_d[41]);const _=()=>T.useStore.getState();function G(){const{rid:e,r:t,me:n}=(0,A.useCtx)(3e4),a=t.settings,l=(0,T.useStore)((0,k.useShallow)(s=>s.stampCards.filter(s=>s.restaurantId===e))),i=(0,T.useStore)(e=>e.customer.name),o=(0,T.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,x.useMemo)(()=>(0,N.crmCustomers)(),[]),[c,h]=(0,x.useState)(a.stampReward),[u,g]=(0,x.useState)('');(0,x.useEffect)(()=>{(0,$.examplesAllowed)()&&e===s.VENUE_RID&&!l.some(e=>e.customerId.startsWith('cr-'))&&T.useStore.setState(s=>({stampCards:[...s.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((s,t)=>({restaurantId:e,customerId:s.id,stamps:s.stamps%a.stampTarget,rewardsAvailable:t%5==0?1:0,history:[{at:'2026-10-20',source:t%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(s=>s.id===e)?.name??(e===T.useStore.getState().customer.id?i||'Guest':e),b=l.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,s)=>s.stamps-e.stamps),m=(0,$.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(m?31:0);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Active cards"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.length})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Rewards ready"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.reduce((e,s)=>e+s.rewardsAvailable,0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Redeemed"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,V.jsx)(v.Muted,{children:m?'all time (example)':'all time'})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Stamps for a reward"}),(0,V.jsx)(v.Stepper,{value:a.stampTarget,min:3,max:15,onChange:s=>_().updateSettings(e,{stampTarget:s}),label:"stamps"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Min spend \xa3"}),(0,V.jsx)(v.Stepper,{value:a.stampMinSpend/100,min:0,max:50,onChange:s=>_().updateSettings(e,{stampMinSpend:100*s}),label:"minimum spend"})]}),(0,V.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,V.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>_().updateSettings(e,{stampReward:c.trim()||a.stampReward})}),(0,V.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,V.jsx)(B.SectionHead,{title:"Members"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),b.map(s=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(s.customerId)}),s.rewardsAvailable?(0,V.jsx)(v.Badge,{kind:"ok",label:`${s.rewardsAvailable} reward ready`}):null]}),(0,V.jsx)(v.Row,{gap:4,children:Array.from({length:a.stampTarget},(e,t)=>(0,V.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:te.source))).join(', ')||'\u2013']}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>_().addStamp(e,s.customerId,`Manual (${n})`)}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!s.rewardsAvailable,onPress:()=>_().redeemReward(e,s.customerId)})]})]},s.customerId))]})}function H(){const e=(0,S.useOwner)(e=>e.referral),s=(0,S.useOwner)(e=>e.referrals),[t,r]=(0,x.useState)(e.giverReward),[n,a]=(0,x.useState)(e.friendReward),l=e=>s.filter(s=>s.status===e).length,i=(0,$.examplesAllowed)();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[i?(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Invites sent"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,V.jsx)(v.Muted,{children:"example"})]}):null,(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sign-ups"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:s.length+(i?23:0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Ordered"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l('first order')+l('rewarded')+(i?9:0)})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,V.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:s=>S.useOwner.getState().setOwner({referral:{...e,active:s}})})]}),(0,V.jsx)(v.Field,{label:"Reward for the customer who invites",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Reward for the friend (first order)",value:n,onChangeText:a}),(0,V.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>S.useOwner.getState().setOwner({referral:{...e,giverReward:t.trim(),friendReward:n.trim()}})}),(0,V.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,V.jsx)(B.SectionHead,{title:"Referrals"}),s.map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,V.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,V.jsx)(v.Muted,{children:e.at})]},e.id))]})}function Q(){const{me:e}=(0,A.useCtx)(6e4),s=(0,A.useSignedIn)();return(0,V.jsx)(p.GiftCardsPage,{me:(s?.name??e).replace(' (example)','')})}function W(){const{rid:e,me:s}=(0,A.useCtx)(6e4),t=(0,T.useStore)((0,k.useShallow)(s=>s.giftCards.filter(s=>s.restaurantId===e))),[n,a]=(0,x.useState)(25),[l,i]=(0,x.useState)(''),[o,d]=(0,x.useState)(''),[c,h]=(0,x.useState)(''),[u,g]=(0,x.useState)(''),[p,b]=(0,x.useState)(''),[m,f]=(0,x.useState)(null),j=t.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=t.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sold"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.initial,0))})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Outstanding"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.balance,0))})]})]}),m?(0,V.jsx)(v.Banner,{kind:"success",title:m}):null,(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,V.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"No card with that code."}):null,(0,V.jsx)(v.Field,{label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{_().redeemGiftCard(o,Math.round(100*Number(c)),s)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,V.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,V.jsx)(v.Field,{label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const t=_().honourLegacyCard(e,u,Math.round(100*Number(p)),s);f(`Website bookings card ${t.code} honoured`),d(t.code),g(''),b('')}})]}):null]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,V.jsx)(v.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>a(e)},e))}),(0,V.jsx)(v.Field,{label:"Recipient",value:l,onChangeText:i}),(0,V.jsx)(v.Button,{label:`Record a \xa3${n} card paid at the till`,disabled:l.trim().length<2,onPress:()=>{const s=_().buyGiftCard(e,100*n,l.trim(),'Sold at the till');f(`Created ${s.code}`),i('')}}),(0,V.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,V.jsx)(B.SectionHead,{title:"All cards"}),t.map(e=>(0,V.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,V.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,V.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function q({rid:e,now:s,me:t}){const r=(0,T.useOrders)(e).filter(e=>'table'===e.type),[n,l]=(0,x.useState)(null),i=(0,m.useTableUse)(e,s),o=(0,m.useTableNames)(e);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,V.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const s=r.filter(s=>s.tableNo===e&&(0,B.LIVE)(s)),t=s.reduce((e,s)=>e+s.total-s.paid,0);return(0,V.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,a.tableNumbers)(e)}`,onPress:()=>l(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:s.length?I.colours.gold:I.colours.border,backgroundColor:I.colours.surface,gap:2},children:[(0,V.jsx)(v.T,{weight:"bold",children:(0,a.tableNumbers)(e)}),(0,V.jsx)(v.T,{size:12,colour:i[e]?.busy?'#FFD9D4':'#E2C489',children:i[e]?.busy?i[e].label:'Free'}),(0,V.jsx)(v.Muted,{children:s.length?`${s.length} order${s.length>1?'s':''}`:'No orders'}),t?(0,V.jsxs)(v.T,{size:12,colour:I.colours.amber,children:[(0,R.gbp)(t)," to pay"]}):(0,V.jsx)(v.T,{size:12,colour:I.colours.muted,children:"View QR"})]},e)})}),(0,V.jsx)(B.SectionHead,{title:"Live table orders"}),r.filter(B.LIVE).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:[(0,a.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,V.jsx)(v.Badge,{kind:(0,B.statusKind)(e.status),label:(0,B.statusLabel)(e)})]}),(0,V.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,O.minsBetween)(new Date(e.createdAt),s)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),r.filter(B.LIVE).length?null:(0,V.jsx)(v.Muted,{children:"No live table orders."}),n?(0,V.jsxs)(v.Sheet,{visible:!0,onClose:()=>l(null),title:`${(0,a.tableNumbers)(n)} QR code`,children:[(0,V.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,V.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${n}`,size:200})}),(0,V.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",n]}),(0,V.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,V.jsx)(v.Button,{label:`Preview customer table ordering (${(0,a.tableNumbers)(n)})`,onPress:()=>{const e=n;l(null),j.router.push(`/table/${e}`)}}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>l(n)})]}):null]})}function K({go:e,onClose:s}){const{rid:t,today:r,role:n}=(0,A.useCtx)(1e4),a=(0,T.useOrders)(t),l=(0,T.useStore)(e=>e.bookings);(0,E.useBackLayer)(!0,s);const i=a.filter(B.LIVE),o=[...i.filter(e=>(0,D.chainNeedsAction)(e,l)).map(e=>{const s=(0,D.nextStep)(e,(0,D.linkedBooking)(e,l)),t=D.CHAIN_STEPS.find(e=>e.id===s);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,O.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:t?`Next: ${t.n}. ${t.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...l.filter(e=>e.restaurantId===t&&e.date===r&&'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,s)=>e.at.localeCompare(s.at));return(0,V.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,V.jsx)(E.BackButton,{onPress:s,testID:"pending-back"}),(0,V.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:I.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,V.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(s=>(0,V.jsxs)(v.Card,{highlight:I.colours.red,style:{alignItems:'center',gap:8},children:[(0,V.jsxs)(w.default,{testID:`pending-row-${s.id}`,accessible:!0,accessibilityLabel:`${s.title}, ${s.when}, allergies: ${s.allergies}. ${s.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,V.jsx)(v.T,{center:!0,weight:"bold",size:18,children:s.title}),(0,V.jsx)(v.T,{center:!0,children:s.when}),(0,V.jsxs)(v.Muted,{center:!0,children:["Allergies: ",s.allergies]}),(0,V.jsx)(v.T,{center:!0,colour:I.colours.gold,children:s.next})]}),(0,V.jsx)(v.Button,{small:!0,label:s.open,onPress:()=>e(s.tab),style:{alignSelf:'stretch'}})]},s.id)),'owner'===n||'manager'===n?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function X(){const e=(0,S.useOwner)(e=>e.merch),s=(0,S.useOwner)(e=>e.merchOrders),[t,r]=(0,x.useState)(''),[n,a]=(0,x.useState)(''),l=(s,t)=>S.useOwner.getState().setOwner({merch:e.map(e=>e.id===s?{...e,...t}:e)});return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,V.jsx)(B.SectionHead,{title:"Products & stock"}),e.map(e=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,V.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,V.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:s=>l(e.id,{live:s})})}),(0,V.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:s=>l(e.id,{stock:s}),label:`${e.name} stock`})]}),0===e.stock?(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"Out of stock"}):e.stock<8?(0,V.jsx)(v.T,{size:13,colour:I.colours.amber,children:"Low stock"}):null]},e.id)),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,V.jsx)(v.Field,{label:"Name",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Price \xa3",value:n,onChangeText:a,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Add product",disabled:t.trim().length<2||!(Number(n)>0),onPress:()=>{S.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:t.trim(),price:Math.round(100*Number(n)),stock:10,live:!0}]}),r(''),a('')}})]}),(0,V.jsx)(B.SectionHead,{title:"Shop orders"}),s.map(t=>{const r=e.find(e=>e.id===t.productId);return(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[t.qty,"\xd7 ",r?.name," \xb7 ",t.customer]}),(0,V.jsx)(v.Badge,{kind:'new'===t.status?'amber':'ready'===t.status?'blue':'ok',label:t.status})]}),(0,V.jsxs)(v.Muted,{children:[t.at," \xb7 ",(0,R.gbp)((r?.price??0)*t.qty)]}),'collected'!==t.status?(0,V.jsx)(v.Button,{small:!0,label:'new'===t.status?'Mark ready':'Mark collected',onPress:()=>S.useOwner.getState().setOwner({merchOrders:s.map(e=>e.id===t.id?{...e,status:'new'===t.status?'ready':'collected'}:e)})}):null]},t.id)})]})}const Y=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const J=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},Z=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function ee({kind:e}){const{r:s}=(0,A.useCtx)(6e4),t=(0,S.useOwner)(e=>e.offers);(0,x.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:t},J,Z).catch(()=>{})},[]);const r=(0,u.can)('venue.settings');return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(b.LoyaltySummaryCard,{kind:e}),(0,V.jsx)(g.StaffLoyalty,{venue:s.name,canRemove:r,onOpenSettings:r?()=>{i.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),r?(0,V.jsx)(v.Card,{children:(0,V.jsxs)(w.default,{style:{gap:8},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,V.jsx)(b.LoyaltySettingsPanel,{})]})}):null]})}},1429,[5,1342,796,806,829,1430,1363,1401,1173,14,1206,985,1431,1433,1364,34,1096,1409,30,402,102,853,1226,794,848,865,836,855,1104,827,840,1147,1100,1119,858,1379,838,1041,1132,832,830,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1430,[829,34,102,794,830,836,1131,848,838,840,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1431,[985,34,281,236,102,1226,794,1203,1206,840,1432,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1432,[34,236,102,794,1203,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1433,[5,1342,34,102,794,836,1203,1204,1205,985,1206,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SafetyPages",{enumerable:!0,get:function(){return l}}),r(d[0]);var n=r(d[1]),t=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]);const l={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s,initial:"items"})},Haccp:()=>{const{me:n,meId:t,now:o}=(0,c.useCtx)(3e4);return(0,u.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:l}=(0,c.useCtx)(3e4);return(0,u.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===l||'manager'===l})}}},1434,[34,1162,1133,1163,1170,1100,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CAR_LINK",{enumerable:!0,get:function(){return h}}),_e.CarScreen=function(){const e=(0,o.useSync)(e=>'staff'===e.kind&&!!e.venueId),[n,c]=(0,t.useState)(''),[b,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[f,w]=(0,t.useState)(null),[v,k]=(0,t.useState)(null),S=async()=>{try{w(await(0,o.carList)())}catch{w([])}};(0,t.useEffect)(()=>{e&&S()},[e]);const C=n.replace(/\D/g,''),D=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(C);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is signed in as you. It opens the owner screen in a few seconds.'}),S()):y({ok:!1,text:e.message})};return(0,u.jsxs)(s.default,{testID:"car-screen-page",style:{gap:12},children:[(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Sign the car in"}),(0,u.jsx)(r.T,{center:!0,children:`In the car, while parked, open the browser and type ${h}`}),(0,u.jsx)(r.T,{center:!0,children:"The car shows 6 numbers on its screen."}),(0,u.jsx)(r.Field,{testID:"car-code-field",label:"Code shown on the car (6 numbers)",accessibilityLabel:"Code shown on the car, 6 numbers",value:n,onChangeText:e=>c(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,u.jsx)(r.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Signs the car in as you",disabled:!e||x||6!==C.length,onPress:()=>{D()},style:{minHeight:56}}),e?null:(0,u.jsx)(r.Muted,{center:!0,children:"Your phone needs to be connected to approve a car."}),(0,u.jsx)(s.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,u.jsx)(r.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,u.jsx)(r.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars signed in"}),null===f?(0,u.jsx)(r.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):f.length?f.map(e=>(0,u.jsxs)(s.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 signed in as ${e.staffName}`}),(0,u.jsx)(r.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,u.jsx)(r.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Sign this car out",accessibilityLabel:`Sign ${e.label} out`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,u.jsx)(r.Muted,{center:!0,children:"No cars are signed in."})]}),v?(0,u.jsxs)(r.Sheet,{visible:!0,onClose:()=>k(null),title:"Sign this car out?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,u.jsx)(r.T,{center:!0,children:`${v.label} stops working straight away. To use it again, make a new code in the car and approve it here.`}),(0,u.jsx)(r.Button,{testID:"car-revoke-yes",label:"Yes, sign it out",onPress:async()=>{const e=v;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is signed out.`}:{ok:!1,text:t.message}),S()},style:{minHeight:56}}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),u=_r(d[6]);const h='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1435,[34,102,794,985,827,840,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=k,_e.SmsBubble=v,_e.AlertSettings=function({go:e}){const{rid:s}=(0,w.useCtx)(6e4),t=(0,b.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,b.systemSupport)()),[r,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=!0;return'undefined'!=typeof navigator&&/Android/i.test(navigator.userAgent)?p('unsupported'):(0,f.pushState)().then(s=>{e&&p(s)}).catch(()=>{e&&m('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const y='granted'===l?'Allowed on this device':'denied'===l?'Blocked. Turn it back on in your browser or phone settings for this site.':'default'===l?'Not asked yet':'This browser can\u2019t show notifications. On iPhone, add the Managers app to your Home Screen first.';return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Alert sound"}),(0,T.jsx)(u.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,T.jsx)(u.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>b.useAlerts.getState().setPrefs({muted:!e})}),(0,T.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,j.chime)('bright')}),(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,j.lowChime)(.6)})]}),(0,T.jsx)(u.Muted,{children:"The Display is silent and shows alerts on screen. The Head Chef app flashes and plays a soft chime until a takeaway is confirmed and its allergies are ticked."})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Which alerts to show"}),(0,T.jsx)(u.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),b.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindChip,{kind:e,size:30}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(u.Toggle,{label:b.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>b.useAlerts.getState().setType(e,s)})})]},e))]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Send a test alert"}),(0,T.jsx)(u.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,T.jsx)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,T.jsx)(u.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${b.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,b.sendTestAlert)(s,e)},e))})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,T.jsx)(u.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,T.jsx)(u.Muted,{children:y}),(0,T.jsx)(u.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>b.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,T.jsx)(u.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,b.requestSystemPermission)()),b.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,b.showSystemNotification)({id:`test-sys:${Date.now()}`,kind:'test',rid:s,at:Date.now(),name:'Test guest',when:'Today 19:30',covers:4,source:'Phone',test:!0},!0)}):null,(0,T.jsx)(u.Muted,{children:(0,b.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,T.jsxs)(u.Banner,{kind:"info",title:"What works today",children:["Alerts show while the app is open. ",'unsupported'===x?'Locked-phone alerts for this phone are coming soon.':'on'===x?'Locked-phone alerts are on for this phone.':'To get alerts when your phone is locked, tap Turn on alerts.']}),'unsupported'!==x?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:'on'===x?'Check alerts':'Turn on alerts',onPress:async()=>{try{if('on'===x){const e=await(0,f.pushState)();p(e),m('on'===e?'Locked-phone alerts are on for this phone.':'Tap Turn on alerts to connect this phone.')}else{const e=await(0,f.turnOnPush)();m(e.message),e.ok&&(p('on'),o((0,b.systemSupport)()))}}catch{m('Could not turn on alerts. Please try again.')}}}):null,r?(0,T.jsx)(u.Muted,{children:r}):null]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindIcon,{kind:"email"}),(0,T.jsx)(u.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,T.jsx)(u.Badge,{kind:"neutral",label:b.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,T.jsx)(u.Muted,{children:b.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${b.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,T.jsx)(u.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,w.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),h=(0,n.useMemo)(()=>(0,p.templatesFor)(r),[r]),b=(0,x.useAssistant)(e=>e.enabled),[j,f]=(0,n.useState)('booking'),[P,M]=(0,n.useState)('sms'),A=h[j],B=s=>m.useStore.getState().setTemplate(e,j,s),L=Object.fromEntries(p.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),R=l.LIVE_VENUE_BUILD?{sms:L,email:L}:'order'===j?(0,p.orderVars)({...S,slotTime:`${o}T18:45:00`},s):(0,p.bookingVars)({...C,date:o},s),I=(0,p.toGsm)((0,p.fill)(A.sms,R.sms)),N=(0,p.fill)(A.subject,R.email),_=(0,p.emailHtml)((0,p.fillEmailText)(A.body,R.email),{venue:s.name,preheader:N}),O=!!r?.[j],D=s.settings;return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsx)(u.Banner,{kind:"demo",title:"Preview mode",children:p.PREVIEW_BANNER}),(0,T.jsxs)(u.Muted,{children:["Every booking and takeaway order gets a text (a phone number is needed to book) and an email if they gave one. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest."]}),(0,T.jsx)(u.Row,{wrap:!0,gap:6,children:Object.keys(p.DEFAULT_TEMPLATES).map(e=>(0,T.jsx)(u.Chip,{label:p.TEMPLATE_LABEL[e].title,selected:j===e,onPress:()=>f(e)},e))}),(0,T.jsx)(u.Muted,{children:p.TEMPLATE_LABEL[j].when}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Text message"}),(0,T.jsxs)(u.Muted,{children:[(0,p.smsParts)(I).chars," characters"]})]}),(0,T.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:A.sms,onChangeText:e=>B({sms:e}),style:[u.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,p.smsParts)(I).chars>300?(0,T.jsx)(u.T,{size:13,colour:y.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,T.jsx)(u.T,{weight:"semibold",children:"Email subject"}),(0,T.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:A.subject,onChangeText:e=>B({subject:e}),style:u.styles.input}),(0,T.jsx)(u.T,{weight:"semibold",children:"Email message"}),(0,T.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:A.body,onChangeText:e=>B({body:e}),style:[u.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,T.jsxs)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:[b?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>B(E(A))}):null,O?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,j,null)}):null]}),b?(0,T.jsx)(u.Muted,{children:"\u201cMake it warmer\u201d is an on-device wording tool: it rewrites on this device and keeps every detail. Check it reads right before you leave it."}):null,(0,T.jsxs)(u.Muted,{children:["Placeholders: ",p.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Live preview"}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:"Text",selected:'sms'===P,onPress:()=>M('sms')}),(0,T.jsx)(u.Chip,{label:"Email",selected:'email'===P,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,T.jsx)(u.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,T.jsxs)(u.Muted,{children:["Sample guest: Alex, ",'order'===j?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===P?(0,T.jsx)(v,{text:I,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),N]}),(0,T.jsx)(k,{html:_})]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,T.jsx)(u.Muted,{children:"Online bookings above this size wait for you to confirm. The guest gets a \u201cwe\u2019ve got your request\u201d message first, then the confirmation once you accept."}),(0,T.jsx)(u.Stepper,{label:"Auto-accept online bookings up to",value:D.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,T.jsx)(u.Toggle,{label:"Also check online bookings with a special request",value:!!D.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Going live"}),(0,T.jsxs)(u.Muted,{children:["Nothing is sent yet. To send real texts and emails: a text service account (for example Twilio) and an email service (for example Postmark), a small CoverCharge server to keep the keys safe, and your sender name (",s.name,") registered. Your venue name, address and phone come from Info & hours."]})]})]})},_e.Outbox=function(){const{rid:e}=(0,w.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[h,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:y.colours.gold,borderRadius:12,padding:12},children:[(0,T.jsx)(u.T,{weight:"semibold",colour:y.colours.gold,children:(0,p.isLive)()?'Live: messages are sent through your text and email service.':p.PREVIEW_BANNER}),(0,p.isLive)()?null:(0,T.jsx)(u.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,T.jsx)(u.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,T.jsx)(u.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,T.jsx)(u.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(h===e.id?null:e.id),style:{gap:4},children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,T.jsxs)(u.T,{weight:"semibold",children:[P[e.kind]," \xb7 ",e.ref]})]}),(0,T.jsx)(u.Muted,{children:e.at.slice(11,16)})]}),(0,T.jsxs)(u.Muted,{children:["To ",e.toName,", ",e.to]}),(0,T.jsx)(u.T,{size:13,colour:'sent'===e.status?y.colours.ok:'failed'===e.status?y.colours.red:y.colours.amber,children:(0,p.statusLabel)(e)})]}),'sms'===e.channel?(0,T.jsx)(v,{text:e.body}):h===e.id?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),e.subject]}),(0,T.jsx)(k,{html:e.html??'',height:560})]}):(0,T.jsxs)(u.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Clear the Outbox",onPress:()=>m.useStore.getState().clearOutbox(e)}):null]})};var s=_r(d[0]),t=_r(d[1]),l=_r(d[2]),n=_r(d[3]),o=e(n);_r(d[4]);var r=e(_r(d[5])),c=e(_r(d[6])),u=_r(d[7]),h=_r(d[8]),m=_r(d[9]),x=_r(d[10]),p=_r(d[11]),b=_r(d[12]),j=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]);function k({html:e,height:s=520}){return o.default.createElement('iframe',{srcDoc:e,title:'Email preview',sandbox:'',style:{width:'100%',height:s,border:'1px solid #2a2a2a',borderRadius:12,background:'#f4efe6'}})}function v({text:e,to:t}){const l=(0,p.smsParts)(e);return(0,T.jsxs)(c.default,{style:{gap:4},children:[t?(0,T.jsxs)(u.Muted,{children:["To ",t]}):null,(0,T.jsx)(c.default,{style:{alignSelf:'flex-start',maxWidth:420,backgroundColor:(0,s.soutersSurface)('#1f1f22'),borderRadius:18,borderBottomLeftRadius:4,padding:12,borderWidth:1,borderColor:'#2c2c30'},children:(0,T.jsx)(u.T,{size:15,children:e})}),(0,T.jsxs)(u.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const C={name:'Alex Morgan',partySize:4,date:'',time:'19:30',ref:'B-1042',allergies:[{allergen:'peanuts',severity:'allergy'}],notes:'It\u2019s my mum\u2019s birthday',table:void 0},S={customerName:'Alex Morgan',ref:'T-2093',total:3150,slotTime:void 0,readyBy:void 0,allergies:[{allergen:'milk',severity:'intolerance'}],lines:[{qty:2,name:'Fish and chips',choices:[]},{qty:1,name:'Sticky toffee pudding',choices:[]}]};function E(e){const s=e.sms.replace(/^Hi \{first\},/,'Hi {first}, lovely news!').replace(/See you soon,/,'We can\u2019t wait to see you,');let t=e.body;return/can\u2019t wait/.test(t)||(t=t.replace(/(Hi \{first\},\n\n)/,'$1We\u2019re so glad you chose us. ')),t=t.replace(/Warm wishes,/,'With very warm wishes from all of us,'),{sms:s,subject:e.subject,body:t}}const P={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1436,[798,796,806,34,236,402,102,794,1175,848,1418,833,1177,1033,840,1045,1100,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,i.useOwner)(e=>e.site),u=(0,o.useSheets)(e),[c,m]=(0,l.useState)(null);return c?(0,p.jsxs)(s.Card,{children:[(0,p.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===c.id)?`Edit ${c.name}`:'New supplier'}),(0,p.jsx)(x,{rid:e,s:c,onDone:()=>m(null)})]}):(0,p.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,p.jsx)(s.Banner,{kind:"info",title:"Used by the Head Chef app",children:"Each supplier gets an order sheet in Head Chef \u203a Ordering. Text, WhatsApp and phone orders open the phone\u2019s own app with the order written out, and the chef presses Send. Nothing is sent automatically."}),u.map(e=>(0,p.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,p.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,p.jsx)(s.Muted,{children:[e.goods,e.deliveryDays.length?`delivers ${(0,h.dayRange)(e.deliveryDays)}`:'',e.orderDays.length?`order ${(0,h.dayRange)(e.orderDays)}`:'',e.frequency,e.priceCapPerKg?`cap ${(0,d.gbp)(e.priceCapPerKg)}/kg`:''].filter(Boolean).join(' \xb7 ')}),'text'!==e.method&&'whatsapp'!==e.method&&'phone'!==e.method||e.number?null:(0,p.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,p.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,p.jsx)(s.Row,{wrap:!0,gap:8,children:(0,p.jsx)(s.Button,{label:"Add supplier",testID:"sheet-add",onPress:()=>m({id:(0,h.sid)(),name:'',goods:'',method:'text',number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:''})})})]})};var l=r(_d[0]),t=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),i=r(_d[4]),o=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]);const c=['online','phone','text','whatsapp','tbc'];function m({label:e,value:l,onChange:t}){return(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,p.jsx)(s.Chip,{label:e,selected:l.includes(n),onPress:()=>t(l.includes(n)?l.filter(e=>e!==n):[...l,n].sort())},e))})]})}function x({rid:e,s:t,onDone:i}){const d=(0,o.useOrderSheets)(e=>e.upsert),x=(0,o.useOrderSheets)(e=>e.remove),[b,f]=(0,l.useState)(t),[j,y]=(0,l.useState)(t.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[C,v]=(0,l.useState)(t.priceCapPerKg?(t.priceCapPerKg/100).toFixed(2):''),[w,T]=(0,l.useState)(!1),D=e=>f(l=>({...l,...e}));return(0,p.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,p.jsx)(s.Field,{label:"Supplier name",value:b.name,onChangeText:e=>D({name:e})}),(0,p.jsx)(s.Field,{label:"What they supply",value:b.goods,onChangeText:e=>D({goods:e})}),(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:c.map(e=>(0,p.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:b.method===e,onPress:()=>D({method:e})},e))})]}),'text'===b.method||'whatsapp'===b.method||'phone'===b.method?(0,p.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:b.number,keyboardType:"phone-pad",onChangeText:e=>D({number:e})}):null,'online'===b.method?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:b.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>D({url:e.trim()})}),(0,p.jsx)(s.Field,{label:"Button label",value:b.urlLabel??'',placeholder:"Open website",onChangeText:e=>D({urlLabel:e})})]}):null,(0,p.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:b.contact??'',onChangeText:e=>D({contact:e})}),(0,p.jsx)(m,{label:"Delivery days",value:b.deliveryDays,onChange:e=>D({deliveryDays:e})}),(0,p.jsx)(m,{label:"Order days (a reminder shows in the Head Chef app)",value:b.orderDays,onChange:e=>D({orderDays:e})}),(0,p.jsxs)(s.Row,{gap:10,children:[(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:b.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>D({cutoff:e})})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Price cap \xa3/kg (optional)",value:C,keyboardType:"decimal-pad",onChangeText:v})})]}),(0,p.jsx)(s.Field,{label:"Reminder text (optional)",value:b.reminder,onChangeText:e=>D({reminder:e})}),(0,p.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:b.frequency,onChangeText:e=>D({frequency:e})}),b.priceCapPerKg||C?(0,p.jsx)(s.Field,{label:"Seller",value:b.seller,onChangeText:e=>D({seller:e})}):null,(0,p.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:y}),(0,p.jsx)(s.Field,{label:"Notes for the chef",value:b.notes,multiline:!0,onChangeText:e=>D({notes:e})}),(0,p.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,p.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const l=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,l)=>{const[n,s]=e.split('|').map(e=>e.trim()),i=t.items.find(e=>e.name===n);return{id:i?.id??`${b.id}-i${l}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*parseFloat(C.replace(/[\xa3,]/g,'')));d(e,{...b,items:l,priceCapPerKg:n>0?n:0,placeholder:b.placeholder&&'tbc'===b.method}),i()},disabled:!b.name.trim()}),(0,p.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:i}),w?(0,p.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{x(e,t.id),i()}}):(0,p.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>T(!0)})]})]})}},1437,[34,402,102,794,865,1016,836,1017,840,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaySaverSettings=function(){const{rid:e,me:s}=(0,v.useCtx)(6e4),u=s.replace(' (example)','');(0,f.useSync)(e=>e.venueId);const x=(0,b.saverConnected)(),R=!x||(0,f.can)('venue.settings'),D=(0,b.useSaverSync)(),[k,M]=(0,t.useState)(D??p.SAVER_DEFAULT),[C,T]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[L,E]=(0,t.useState)(null);(0,t.useEffect)(()=>{C||M(D??p.SAVER_DEFAULT)},[D]);const O=e=>{R&&(M(t=>({...t,...e})),T(!0),E(null))},_=async()=>{P(!0);try{await(0,b.saveSaver)(k,u),T(!1),E({kind:'success',t:x?'Saved. The Display changes within a few seconds; no need to pair it again.':'Saved on this device (demo).'})}catch(e){E({kind:'danger',t:`Couldn't save: ${e.message}`})}finally{P(!1)}},{width:$}=(0,l.default)(),U=Math.min($-48,520),A=Math.round(10*U/16);return(0,j.jsxs)(n.default,{style:{gap:14,width:'100%',maxWidth:640,alignSelf:'center'},testID:"saver-settings",children:[(0,j.jsx)(i.T,{center:!0,size:22,weight:"semibold",colour:c.colours.gold,accessibilityRole:"header",children:"Display screensaver"}),(0,j.jsx)(i.Muted,{center:!0,children:"What the Display shows when nobody has touched it for a while. Tap anywhere on the Display to wake it; that tap doesn\u2019t press anything."}),R?null:(0,j.jsx)(i.Banner,{kind:"info",title:"Managers and owners only",children:"You can see the screensaver settings, but only a manager or owner can change them."}),!D&&x?(0,j.jsx)(i.Muted,{center:!0,children:"Not set yet: the Display shows your logo after the idle time set on that Display."}):null,(0,j.jsx)(i.Card,{children:(0,j.jsx)(i.Toggle,{label:"Screensaver on",value:k.on,onChange:e=>O({on:e}),testID:"saver-on",a11y:"Screensaver on or off"})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Start after"}),(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:p.IDLE_OPTIONS.map(e=>(0,j.jsx)(i.Chip,{label:e.label,selected:k.idleMins===e.mins,disabled:!k.on,onPress:()=>O({idleMins:e.mins}),testID:`saver-idle-${e.mins}`,accessibilityLabel:e.mins?`Start after ${e.mins} minutes with no touches`:'Never start the screensaver'},e.mins))}),(0,j.jsx)(i.Muted,{center:!0,children:k.on?k.idleMins?`Starts after ${k.idleMins} minutes with no touches.`:'Never: the Display stays on the board.':'Off: the Display never goes to the screensaver.'})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Style"}),(0,j.jsx)(n.default,{accessibilityRole:"radiogroup",style:{gap:8},children:p.SAVER_STYLES.map(e=>{const t=k.style===e.id;return(0,j.jsxs)(o.default,{testID:`saver-style-${e.id}`,onPress:()=>O({style:e.id}),disabled:!R,accessibilityRole:"radio",accessibilityState:{checked:t,disabled:!R},accessibilityLabel:`${e.label}. ${e.sub}`,style:{minHeight:64,borderRadius:14,borderWidth:2,borderColor:t?c.colours.gold:c.colours.border,backgroundColor:t?'rgba(201,162,74,0.12)':'transparent',paddingVertical:10,paddingHorizontal:14,alignItems:'center',justifyContent:'center'},children:[(0,j.jsxs)(i.T,{center:!0,weight:"semibold",colour:t?c.colours.gold:c.colours.text,children:[t?'\u25cf ':'\u25cb ',e.label]}),(0,j.jsx)(i.Muted,{center:!0,children:e.sub})]},e.id)})})]}),(0,j.jsx)(S,{rid:e,c:k,set:O,editor:R,connected:x,onMsg:E}),'photos'===k.style?(0,j.jsx)(w,{c:k,set:O,editor:R,connected:x,onMsg:E}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.Toggle,{label:"Dim at night",value:k.dimOn,onChange:e=>O({dimOn:e}),testID:"saver-dim",a11y:"Dim the screensaver at night"}),k.dimOn?(0,j.jsxs)(n.default,{style:{gap:8,alignItems:'center'},children:[(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"From"}),(0,j.jsx)(i.Stepper,{label:"Dim from",value:(0,y.toMins)(k.dimFrom),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimFrom:(0,y.fromMins)(e)}),testID:"saver-dim-from"})]}),(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"Until"}),(0,j.jsx)(i.Stepper,{label:"Dim until",value:(0,y.toMins)(k.dimTo),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimTo:(0,y.fromMins)(e)}),testID:"saver-dim-to"})]})]}):null,(0,j.jsxs)(i.Muted,{center:!0,children:[(0,p.dimWords)(k),". The screensaver is shown much darker between these times."]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Preview"}),(0,j.jsx)(n.default,{style:{alignItems:'center'},testID:"saver-preview",accessibilityLabel:"Preview of the screensaver",children:(0,j.jsx)(n.default,{style:{width:U,height:A,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:c.colours.border},children:k.on?(0,j.jsx)(h.Saver,{rid:e,cfg:k,box:{width:U,height:A}},`${k.style}-${k.photos.length}-${k.logo??''}`):(0,j.jsx)(n.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.Muted,{center:!0,children:"Screensaver off"})})})})]}),L?(0,j.jsx)(i.Banner,{kind:L.kind,children:L.t}):null,R?(0,j.jsx)(i.Button,{label:I?'Saving\u2026':C?'Save screensaver':'Saved',disabled:I||!C,onPress:()=>{_()},testID:"saver-save"}):null]})};var t=r(d[0]),s=e(t);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),l=e(r(d[4])),i=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),v=r(d[13]),j=r(d[14]);const x='undefined'!=typeof document;function w({c:e,set:o,editor:l,connected:h,onMsg:u}){const y=(0,t.useRef)(null),[f,v]=(0,t.useState)(!1),[w,S]=(0,t.useState)({});(0,t.useEffect)(()=>{let t=!0;return Promise.all(e.photos.map(async e=>[e,await(0,b.saverPhotoUrl)(e)])).then(e=>{t&&S(Object.fromEntries(e.filter(e=>e[1])))}),()=>{t=!1}},[e.photos.join('|')]);const R=async t=>{if(t?.length){v(!0);try{const s=[];for(const o of Array.from(t).slice(0,p.MAX_SAVER_PHOTOS-e.photos.length))s.push(h?await(0,b.uploadSaverPhoto)(o,e.photos.length+s.length):URL.createObjectURL(o));o({photos:[...e.photos,...s]}),u({kind:'success',t:`${s.length} photo${1===s.length?'':'s'} added. Tap Save screensaver to show ${1===s.length?'it':'them'} on the Display.`})}catch(e){u({kind:'danger',t:e.message})}finally{v(!1),y.current&&(y.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Slideshow photos"}),(0,j.jsxs)(i.Muted,{center:!0,children:["Your own photos of the venue, food and team, one every 8 seconds. Up to ",p.MAX_SAVER_PHOTOS,". With no photos the Display shows your logo."]}),e.photos.length?(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:e.photos.map((t,h)=>(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:4},children:[w[t]&&x?s.default.createElement('img',{src:w[t],alt:`Slideshow photo ${h+1}`,style:{width:96,height:64,objectFit:'cover',borderRadius:8}}):(0,j.jsx)(n.default,{style:{width:96,height:64,borderRadius:8,backgroundColor:c.colours.border}}),l?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove photo ${h+1} from the slideshow`,onPress:()=>o({photos:e.photos.filter(e=>e!==t)})}):null]},t))}):(0,j.jsx)(i.Muted,{center:!0,children:"No photos yet."}),l?(0,j.jsx)(i.Button,{kind:"secondary",label:f?'Uploading\u2026':'Upload photos',disabled:f||e.photos.length>=p.MAX_SAVER_PHOTOS,onPress:()=>{x&&y.current?.click()},testID:"saver-upload",accessibilityLabel:"Upload photos for the slideshow"}):null,x?s.default.createElement('input',{ref:y,type:'file',accept:'image/jpeg,image/png,image/webp',multiple:!0,style:{display:'none'},'aria-hidden':!0,onChange:e=>{R(e.target.files)}}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Removing a photo takes it off the slideshow; the file itself is kept."})]})}function S({rid:e,c:o,set:l,editor:y,connected:f,onMsg:v}){const w=(0,t.useRef)(null),[S,R]=(0,t.useState)(!1),[D,k]=(0,t.useState)(!1),M=(0,u.useBrand)(e).name,C=!!o.logo,T=async e=>{const t=e?.[0];if(t){R(!0);try{let e;if(f)e=await(0,b.uploadSaverLogo)(t);else{const s=(0,p.logoFileProblem)(t.type,t.size);if(s)throw new Error(s);if('image/svg+xml'===t.type&&!(0,p.svgSafe)(await t.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');e=URL.createObjectURL(t)}l({logo:e}),v({kind:'success',t:(C?'New logo ready':'Logo uploaded')+". Tap Save screensaver to show it on the Display."})}catch(e){v({kind:'danger',t:e.message})}finally{R(!1),w.current&&(w.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:10},testID:"saver-logo-card",children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Screensaver logo"}),(0,j.jsx)(i.Muted,{center:!0,children:'logo'===o.style?'Shown drifting slowly round the Display.':'Shown with the Logo style, and small on the clock and covers screens.'}),(0,j.jsx)(n.default,{style:{minWidth:132,maxWidth:240,height:132,paddingHorizontal:12,borderRadius:14,backgroundColor:'#000000',borderWidth:1,borderColor:c.colours.border,alignItems:'center',justifyContent:'center'},accessible:!0,accessibilityLabel:C?'Your uploaded logo':`Your standard logo, ${M}`,children:(0,j.jsx)(h.SaverLogoPreview,{rid:e,path:o.logo,size:108})}),(0,j.jsx)(i.Muted,{center:!0,children:C?'Your uploaded logo':'Your standard logo'}),y?(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:C?'secondary':'primary',label:S?'Uploading\u2026':C?'Replace logo':'Upload logo',disabled:S,onPress:()=>{x&&w.current?.click()},testID:"saver-logo-upload",accessibilityLabel:C?'Replace the screensaver logo':'Upload a logo for the screensaver'}),C?(0,j.jsx)(i.Button,{kind:"ghost",label:"Remove",disabled:S,onPress:()=>k(!0),testID:"saver-logo-remove",accessibilityLabel:"Remove the uploaded logo and go back to the standard one"}):null]}):null,(0,j.jsx)(i.Muted,{center:!0,children:"PNG, JPG or SVG, up to 2 MB (an SVG is saved as a picture). A square logo on a transparent or black background looks best."})]}),x?s.default.createElement('input',{ref:w,type:'file',accept:Object.keys(p.LOGO_TYPES).join(','),style:{display:'none'},'aria-hidden':!0,onChange:e=>{T(e.target.files)}}):null,D?(0,j.jsx)(i.Sheet,{visible:!0,onClose:()=>k(!1),title:"Remove the uploaded logo?",maxWidth:520,testID:"saver-logo-remove-confirm",children:(0,j.jsxs)(n.default,{style:{gap:12,alignItems:'center'},children:[(0,j.jsx)(i.Muted,{center:!0,children:"The screensaver goes back to your standard logo once you save. The uploaded file is kept, and the standard logo isn\u2019t changed."}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep it",onPress:()=>k(!1),testID:"saver-logo-remove-no"}),(0,j.jsx)(i.Button,{kind:"danger",label:"Remove logo",onPress:()=>{l({logo:null}),k(!1),v({kind:'success',t:'Logo removed. Tap Save screensaver to go back to the standard logo on the Display.'})},testID:"saver-logo-remove-yes"})]})]})}):null]})}},1438,[34,236,402,102,426,794,840,1301,847,1303,827,985,1304,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1439,[804,982,1377,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableQrPage=function(){const{rid:e,me:t}=(0,h.useCtx)(6e4),b=t.replace(' (example)','');return(0,u.jsxs)(s.default,{style:{gap:14,width:'100%',maxWidth:760,alignSelf:'center'},testID:"table-qr-page",children:[(0,u.jsx)(l.T,{center:!0,size:22,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Table QR codes"}),(0,u.jsx)(l.Muted,{center:!0,children:"Guests scan the code on their table, see the menu and send their order to the kitchen. They pay at the bar or with their server."}),(0,u.jsx)(c.TableOrderSettings,{rid:e,me:b}),(0,u.jsx)(l.T,{center:!0,size:20,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Orders from the tables"}),(0,u.jsx)(n.StaffTableOrders,{rid:e,me:b})]})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),n=r(d[5]),h=r(d[6]),u=r(d[7])},1440,[34,102,794,840,1359,1430,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=m,_e.HelpPage=function({go:e}){const[i,o]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[m,y]=(0,s.useState)(null),w=(0,s.useMemo)(()=>i.trim()?(0,c.searchHelp)(r.HELP,i,10).map(e=>e.a):r.HELP.filter(e=>!h||e.topic===h),[i,h]);return(0,x.jsxs)(n.default,{style:{gap:10},testID:"help-page",children:[(0,x.jsxs)(n.default,{style:[a.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\ud83d\udd0d"}),(0,x.jsx)(t.TextInput,{testID:"help-search",value:i,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:u.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),i?(0,x.jsx)(l.default,{onPress:()=>o(''),accessibilityLabel:"Clear search",children:(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\u2715"})}):null]}),(0,x.jsx)(j,{go:e}),i?(0,x.jsx)(a.Muted,{children:w.length?`${w.length} result${1===w.length?'':'s'} for \u201c${i.trim()}\u201d`:`Nothing for \u201c${i.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:[null,...r.HELP_TOPICS].map(e=>(0,x.jsx)(a.Chip,{label:e??'All',selected:h===e,onPress:()=>p(e)},e??'all'))}),w.map((t,s)=>(0,x.jsx)(f,{a:t,go:e,open:m===t.id||!!i&&0===s&&null===m,onToggle:()=>y(m===t.id?'':t.id)},t.id)),(0,x.jsxs)(a.Card,{style:{alignItems:'center'},children:[(0,x.jsx)(a.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:"Chat with CoverCharge support"}),(0,x.jsx)(a.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,x.jsx)(a.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=j;var t=_r(d[0]),s=_r(d[1]),l=e(_r(d[2])),n=e(_r(d[3])),a=_r(d[4]),i=_r(d[5]),o=_r(d[6]),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),p=_r(d[11]),x=_r(d[12]);function m(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>o.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function f({a:e,go:t,open:s,onToggle:i}){return(0,x.jsx)(n.default,{testID:`help-${e.id}`,children:(0,x.jsxs)(a.Card,{children:[(0,x.jsx)(l.default,{accessibilityRole:"button",onPress:i,children:(0,x.jsxs)(a.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,x.jsxs)(n.default,{style:{flex:1},children:[(0,x.jsx)(a.T,{weight:"semibold",children:e.title}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,x.jsx)(a.Muted,{size:12,children:e.topic})]})]}),(0,x.jsx)(a.T,{colour:u.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,x.jsxs)(a.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,x.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,x.jsx)(a.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>m(e,t)})}):null]})})}function j({go:e}){const{rid:t,today:l}=(0,p.useCtx)(6e4),i={rid:t,today:l,go:(t,s)=>e(t,s??null)},[o,c]=(0,s.useState)(''),[f,j]=(0,s.useState)(null),[b,C]=(0,s.useState)(null),k=async()=>{const e=o.trim();if(!e)return;C(null),j(null);const t=(0,h.matchIntent)(e,l);if('action'!==t.kind)'help'!==t.kind?C({text:'Sorry, I didn\u2019t follow that. Try \u201cadd a walk-in for 4 at table 7\u201d, \u201cput Ellie on Friday 5 till 11\u201d, or ask \u201chow do I export hours?\u201d.',kind:'note'}):C({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,h.needsConfirm)(t.action.risk)){const e=await(0,h.runAction)(t.action.id,t.params,i);return void C({text:'done'===e.status?e.message:e.message??'',kind:'done'})}j({action:t.action,params:{...y(t.action,l),...t.params},asked:e})}};return(0,x.jsx)(n.default,{testID:"ask-assistant",children:(0,x.jsxs)(a.Card,{highlight:u.colours.gold,children:[(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(n.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,x.jsxs)(n.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,x.jsx)(a.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:c,placeholder:"Ask in plain words",onSubmitEditing:k,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,x.jsx)(a.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:k,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:['Add a walk-in for 4 at table 7','Put a shift on Friday 5 till 11','How do I export hours for payroll?','Pay out the tips'].map(e=>(0,x.jsx)(a.Chip,{label:e,onPress:()=>c(e)},e))}),f?(0,x.jsx)(w,{p:f,today:l,onChange:e=>j({...f,params:e}),onConfirm:async()=>{if(!f)return;const e=await(0,h.runAction)(f.action.id,f.params,i,!0);j(null),c(''),C('done'===e.status?{text:e.message,kind:'done'}:'demo_only'===e.status?{text:e.message,kind:'demo'}:{text:e.message??'Couldn\u2019t do that.',kind:'error'})},onCancel:()=>{j(null),C({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,b?(0,x.jsxs)(n.default,{style:{gap:6},testID:"assistant-reply",children:[(0,x.jsx)(a.Banner,{kind:'done'===b.kind?'success':'error'===b.kind?'warn':'demo'===b.kind?'demo':'info',title:b.text}),b.help?.map(t=>{const s=(0,r.helpById)(t);return(0,x.jsxs)(a.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,x.jsx)(a.T,{style:{flex:1},children:s.title}),s.showMe?(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>m(s,e)}):null]},t)})]}):null,(0,x.jsx)(a.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})}function y(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function w({p:e,today:t,onChange:s,onConfirm:l,onCancel:o}){const r=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,h.demoOnly)(e.action.risk),p=(t,l)=>s({...e.params,[t]:l}),m=e.action,f=e.params,j=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,x.jsxs)(n.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?u.colours.red:u.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':u.colours.okBg},children:[(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:c?'red':'ok',label:h.RISK_LABEL[m.risk]}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>p('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>p('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{size:12,children:"Who"}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:r.slice(0,14).map(e=>(0,x.jsx)(a.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>p('staffId',e.id)},e.id))}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1.3},children:(0,x.jsx)(a.Field,{label:"Date (YYYY-MM-DD)",value:String(f.date??t),onChangeText:e=>p('date',e)})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>p('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>p('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,x.jsx)(a.T,{children:j?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,x.jsx)(a.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,x.jsx)(a.Muted,{children:"Nothing happens until you tap Confirm."}),(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(a.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!j,onPress:l,style:{flex:1}}),(0,x.jsx)(a.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1441,[796,34,402,102,794,865,1391,1442,1443,1444,840,1100,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1442,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1443,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${$[t.risk]}${O(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if(O(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(u.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const u=(0,l.searchHelp)(p.HELP,e,3);return u.length?{kind:'help',ids:u.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,$={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},O=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);if(!(e.staffId&&e.date&&a>t))return'That shift isn\u2019t complete.';const s=(0,n.leaveOn)(n.useOwner.getState().leave,String(e.staffId),String(e.date));return s?`${_(e.staffId)} has time off then (${N(s.from)} to ${N(s.to)}). Add the shift on the Rota yourself if they\u2019ve agreed to work.`:(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`)}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...c.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1444,[1445,1098,829,1446,1447,865,848,1014,1391,1442,1443,1449,1448,1451,1452,1012,1013]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1445,[1399,1398,1038]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1446,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1447,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1448,1446]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1448,[804,1098,829,1120,1206,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1449,1450]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1449,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1450,[808,815,818]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1451,[800,865,989,836,1448,1032]); +__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1452,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceSettingsPage=function(){const{rid:e,r:s,now:t}=(0,f.useCtx)(6e4),o=(0,p.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"Staff hold the gold button, say what they need and let go. It sits at the top right in Managers, Head Chef, the Staff app (the full voice assistant, without team financial or HR information) and on the Display (no money, tips or HR either), never in the customer app. Tap it to type or open the Assistant. Replies and change confirmations are shown in text, never spoken. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts for you."}),(0,x.jsx)(c.VoiceUsageCard,{rid:e,now:t}),(0,x.jsxs)(i.Card,{children:[(0,x.jsxs)(i.T,{weight:"semibold",children:["Who gets the voice button at ",s.name]}),(0,x.jsx)(n.default,{style:{gap:6,marginTop:8},children:p.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:p.VOICE_ROLE_LABEL[s],value:(0,p.voiceOn)(o.enabled,e,s),onChange:t=>o.setEnabled(e,s,t)},s))}),(0,x.jsx)(i.Muted,{children:"Saved on this device for now; set it on each device."})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{testID:"voice-text-only",weight:"semibold",children:"The helper replies in text only. It never speaks."}),(0,x.jsx)(i.Row,{gap:8,wrap:!0,style:{marginTop:8},children:(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Show the microphone explanation again",onPress:()=>o.setMicExplained(!1)})})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{weight:"semibold",children:"Privacy"}),(0,x.jsxs)(i.Muted,{children:["What is said while the button is held (up to 30 seconds) is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. Each device asks once to use the microphone. ",(0,u.canListen)()?'This device can listen.':'This device can\u2019t listen, so the button offers \u201ctype instead\u201d.']})]})]})},_e.DraftsPage=function(){const{rid:e,me:o,role:h}=(0,f.useCtx)(6e4),p=(0,r.useDrafts)(e=>e.drafts),u=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[j,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=p.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),C='owner'===h||'manager'===h,D=e=>e.supplier?d.SUPPLIER_PORTALS.find(s=>s.id===e.supplier):void 0,P=e=>(0,x.jsx)(i.Card,{children:(0,x.jsxs)(n.default,{testID:`draft-${e.id}`,style:{gap:6},children:[(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Badge,{label:r.DRAFT_LABEL[e.kind],kind:"gold"}),'draft'!==e.status?(0,x.jsx)(i.Badge,{label:'approved'===e.status?'Approved':'Dismissed',kind:'approved'===e.status?'ok':'neutral'}):null]}),(0,x.jsx)(i.T,{weight:"semibold",children:e.title}),e.lines.map((s,t)=>(0,x.jsxs)(i.T,{size:15,children:['shopping'===e.kind?'\u2022 ':'',s]},t)),(0,x.jsxs)(i.Muted,{children:["From ",e.by," (",e.app,"), ",b(e.at),e.decidedBy?` \xb7 ${e.status} by ${e.decidedBy}, ${b(e.decidedAt)}`:'']}),'draft'===e.status&&C?(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Button,{small:!0,kind:"success",label:"Approve",testID:`draft-approve-${e.id}`,onPress:()=>y({d:e,status:'approved'})}),(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Dismiss",testID:`draft-dismiss-${e.id}`,onPress:()=>y({d:e,status:'dismissed'})}),D(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${D(e).name} ordering`,onPress:()=>{t.default.openURL(D(e).links.order)}}):null]}):null]})},e.id);return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Nothing here has been sent, ordered or paid",children:"The voice helper and the Assistant save bookings, supplier shopping lists, offers, events, specials, messages and payments here for you to check. Approving marks it approved and takes you to the right screen; you still do the booking, the order or the post yourself."}),C?null:(0,x.jsx)(i.Banner,{kind:"warn",title:"Owners and managers approve drafts",children:"You can see the drafts but not approve them."}),B.length?B.map(P):(0,x.jsx)(i.Muted,{children:"No drafts waiting. Try holding the voice button and saying \u201cadd blue roll to the Booker list\u201d."}),S.length?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:k?'Hide approved and dismissed':`Show approved and dismissed (${S.length})`,onPress:()=>w(!k)}):null,k?S.map(P):null,(0,x.jsx)(i.Sheet,{visible:!!j,onClose:()=>y(null),title:'approved'===j?.status?'Approve this draft?':'Dismiss this draft?',children:j?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:j.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===j.status?`This marks it approved${v[j.d.kind]?` and opens ${v[j.d.kind].label}`:''}. Nothing is sent, ordered or paid automatically.`:'It moves to the dismissed list. Nothing is sent.'}),(0,x.jsx)(i.Button,{kind:'approved'===j.status?'success':'danger',label:'approved'===j.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{u(j.d.id,j.status,o.replace(' (example)',''));const e=v[j.d.kind];y(null),'approved'===j.status&&e&&c&&c(e.tab,e.sub)}}),(0,x.jsx)(i.Button,{kind:"secondary",label:"Back",onPress:()=>y(null)})]}):null})]})},_e.ShiftNotesPage=function(){const{rid:e}=(0,f.useCtx)(6e4),s=(0,h.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,h.useShiftNotes)(e=>e.setDone);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.Muted,{children:"Notes left for the next shift, by voice (\u201ctell the next shift the glass washer is leaking\u201d) or the Assistant. Kept on this device for now."}),s.length?s.slice(0,60).map(e=>(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{style:{textDecorationLine:e.done?'line-through':'none'},colour:e.done?o.colours.muted:o.colours.text,children:e.text}),(0,x.jsxs)(i.Row,{style:{justifyContent:'space-between',marginTop:6},children:[(0,x.jsxs)(i.Muted,{children:[e.by," (",e.app,"), ",b(e.at)]}),(0,x.jsx)(i.Button,{small:!0,kind:e.done?'ghost':'success',label:e.done?'Reopen':'Done',onPress:()=>t(e.id,!e.done)})]})]},e.id)):(0,x.jsx)(i.Muted,{children:"No shift notes yet."})]})};var s=_r(_d[0]),t=e(_r(_d[1])),n=e(_r(_d[2])),i=_r(_d[3]),o=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),l=_r(_d[7]),h=_r(_d[8]),p=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),f=_r(_d[12]),x=_r(_d[13]);const b=e=>new Date(e).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});const v={booking:{tab:'bookings',sub:null,label:'Bookings'},offer:{tab:'more',sub:'offers',label:'Specials & offers'},event:{tab:'more',sub:'events',label:'Events'},special:{tab:'more',sub:'specialsboard',label:'Specials board'},shopping:{tab:'more',sub:'suppliers',label:'Suppliers'}}},1453,[34,379,102,794,840,1387,1449,1401,1450,1117,929,1410,1100,25]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1454,[34,102,794,830,1203,1455,1456,840,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1455,[830]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1456,[985,1455,1206]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:s,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,d.useCashUp)(e=>e.cashUps),k=(0,d.useCashSettings)(e),w=(0,o.useNightlyPrefs)(l=>l.email[e]??!1),T=(0,o.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(l=>l.rid===e&&l.on).map(e=>e.name),[N,P]=(0,l.useState)((0,u.addDaysYmd)(v,-1)),U=(0,u.cashFieldsForRecord)(k.cashFields,s.settings.cashUpRecord),_=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:U,soldOut:C}),D='anchorage'!==e&&w,E=[0,1,2].map(e=>(0,u.addDaysYmd)(v,-e));return(0,j.jsxs)(t.default,{testID:"nightly-report",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,j.jsx)(n.Muted,{center:!0,children:"Spend per head, Covers and the cash-up for one night. Blank means it was not entered."}),(0,j.jsx)(t.default,{style:{width:'100%',gap:8},children:E.map(e=>(0,j.jsx)(n.Button,{kind:e===N?'primary':'secondary',label:e===v?'Today':e===(0,u.addDaysYmd)(v,-1)?'Yesterday':e,accessibilityLabel:`Nightly report for ${e}`,onPress:()=>P(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:_.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(_.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(_.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(_.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:_.takings}),(0,j.jsx)(x,{label:"Tips",value:_.tips}),(0,j.jsx)(x,{label:"Takings last week",value:_.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:_.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:_.soldOut.length?_.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),_.cashUp.length?_.cashUp.map(e=>(0,j.jsx)(x,{label:e.label,value:e.value},e.label)):(0,j.jsx)(n.Muted,{center:!0,children:"No cash-up fields for this venue."})]}),p.RELEASE.nightlyEmail&&'anchorage'!==e?(0,j.jsx)(n.Toggle,{testID:"nightly-email",label:"Also email the nightly report",value:D,onChange:l=>T(e,l)}):null]})};var e,l=_r(_d[0]),s=_r(_d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),d=_r(_d[4]),o=_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=({label:e,value:l})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${l}`,style:{width:'100%',alignItems:'center',gap:2,paddingVertical:8},children:[(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,children:e}),(0,j.jsx)(n.T,{center:!0,children:l})]})},1457,[34,102,794,848,1024,1458,977,13,1459,1035,840,1100,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useNightlyPrefs",{enumerable:!0,get:function(){return s}});var e,t=r(d[0]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);const s=(0,n.create)()((0,o.persist)(e=>({email:{},setEmail:(t,l)=>e(e=>({email:{...e.email,[t]:'anchorage'!==t&&l}}))}),{name:'covercharge-nightly-email-v1',storage:(0,o.createJSONStorage)(()=>l.default),version:1}))},1458,[808,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(o){const{rid:u,date:c,bookings:f,cashUps:p,fields:v,soldOut:h}=o,b=f.filter(t=>t.restaurantId===u&&t.date===c),k=p.find(t=>t.rid===u&&t.date===c&&t.confirmedAt),y=p.find(n=>n.rid===u&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),N=k?(0,t.grossOf)(k.vals)??(0,t.takings)(k.vals):null,O=(0,n.coversOn)(f,u,c),S=null==N||O<=0?null:Math.round(N/O*100)/100,_=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&_.set(n,(_.get(n)??0)+(t.partySize||0))}let w=null;for(const[t,n]of _)(!w||n>w.n)&&(w={hour:t,n:n});return{date:c,spendPerHead:s(S),covers:O,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(N),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(y?(0,t.grossOf)(y.vals)??(0,t.takings)(y.vals):null),busiestHour:w?`${String(w.hour).padStart(2,'0')}:00 \xb7 ${w.n} Covers`:'Not entered',soldOut:h.filter(Boolean),cashUp:v.map(t=>({label:t.label,value:k?l(k.vals[t.key],t.kind):'Not entered'}))}};var t=r(d[0]),n=r(d[1]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t)},1459,[13,1427]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{rid:e,me:o,meId:S}=(0,m.useCtx)(6e4),j=(0,u.useSupportChat)(e=>e.messages).filter(t=>t.rid===e),C=(0,u.useSupportChat)(e=>e.send),y=(0,u.useSupportChat)(e=>e.markSent),[f,I]=(0,s.useState)(''),[M,w]=(0,s.useState)(''),T=S===b,v=async e=>{const t=await(0,p.writeSupportMessage)(e);if(t.ok)return y(e.id),void w('');w(t.message||c.SUPPORT_NOT_SENT)};return(0,x.jsxs)(n.default,{testID:"support-chat",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.Muted,{center:!0,children:"A message to the CoverCharge team. Nobody replies automatically."}),M?(0,x.jsx)(l.Muted,{center:!0,testID:"support-note",children:M}):null,j.length?j.map(e=>(0,x.jsxs)(l.Card,{style:{alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:e.from}),(0,x.jsx)(l.T,{center:!0,children:e.text}),(0,x.jsxs)(l.Muted,{center:!0,children:[e.sent?'Sent':'Not sent'," \xb7 ",new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]}),e.sent?null:(0,x.jsx)(l.Button,{kind:"ghost",label:"Send again",accessibilityLabel:`Send again: ${e.text}`,onPress:()=>{v(e)}})]},e.id)):(0,x.jsx)(l.Muted,{center:!0,children:"No messages yet."}),(0,x.jsx)(t.TextInput,{testID:"support-draft",accessibilityLabel:"Message to CoverCharge support",value:f,onChangeText:I,placeholder:"Write a message",placeholderTextColor:h.colours.muted,multiline:!0,style:{width:'100%',minHeight:88,borderWidth:1,borderColor:h.colours.border,borderRadius:12,padding:12,color:h.colours.text,textAlign:'center'}}),(0,x.jsx)(l.Button,{testID:"support-send",label:"Send",accessibilityLabel:"Send message to CoverCharge support",disabled:!f.trim(),onPress:()=>{const t=C(e,o||'Manager',S||'',f);t&&(I(''),v(t))}}),T?(0,x.jsxs)(n.default,{testID:"support-inbox",style:{width:'100%',alignItems:'center',gap:8},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Support inbox"}),(0,x.jsx)(l.Muted,{center:!0,children:j.length?`${j.length} message${1===j.length?'':'s'} from this venue.`:'No messages in the inbox.'})]}):null]})};var e,t=r(d[0]),s=r(d[1]),o=r(d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),p=r(d[7]),m=r(d[8]),x=r(d[9]);const b='st-gordon'},1460,[796,34,102,794,1461,1036,840,1462,1100,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSupportChat",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);let c=0;const u=(0,n.create)()((0,o.persist)(e=>({messages:[],send:(t,s,n,o)=>{const u=o.trim().slice(0,1e3);if(!u)return null;const l={id:`sm-${Date.now().toString(36)}${(c++).toString(36)}`,rid:t,at:(new Date).toISOString(),from:s.slice(0,80),staffRef:n,text:u,sent:!1};return e(e=>({messages:[...e.messages,l].slice(-200)})),l},markSent:t=>e(e=>({messages:e.messages.map(e=>e.id===t?{...e,sent:!0}:e)}))}),{name:'covercharge-support-chat-v1',storage:(0,o.createJSONStorage)(()=>s.default),version:1}))},1461,[808,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.writeSupportMessage=async function(S){if(!s.RELEASE.supportSync)return{ok:!1,message:t.SUPPORT_NOT_SENT};if(!(0,n.isSupabaseConfigured)())return{ok:!1,message:t.SUPPORT_NOT_SENT};const _=u.useSync.getState().venueId;if(!_)return{ok:!1,message:`${t.SUPPORT_NOT_SENT} Sign in and try again.`};try{const s=(0,o.getSupabase)(),{error:n}=await s.from('support_messages').insert({venue_id:_,body:S.text,from_name:S.from,staff_ref:S.staffRef||null});return n?{ok:!1,message:t.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:t.SUPPORT_NOT_SENT}}};var s=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4])},1462,[1035,1036,974,931,985]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1463,[236]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopShell=function(){const{rid:e,r:c,role:g,today:_,now:$,meId:V,me:Q}=(0,z.useCtx)(3e4);(0,m.useTipsPosted)(e,_);const Y=(0,z.useSignedIn)();(0,x.useSoldOutLink)(!0,(Y?.name??Q).replace(' (example)',''));const[ee,te]=(0,a.useState)({kind:'tab',tab:'home'}),[se,ae]=(0,a.useState)(''),oe=(0,a.useRef)(null);(0,a.useEffect)(()=>{(0,z.ensureAttendance)(_,$),(0,M.ensureChat)($)},[_]),globalThis.__ccNow=$.getTime();const ne=(0,a.useCallback)((e,t=null)=>{if('more'===e&&t){const e=q[t];return void te(e?{kind:'edit',id:e}:{kind:'page',id:t})}te('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,a.useEffect)(()=>(S.useVoiceNav.setState({go:ne}),()=>S.useVoiceNav.setState({go:null})),[ne]),(0,a.useEffect)(()=>{D.PITCH&&(globalThis.__pitchGo=ne,globalThis.__deskGo=e=>te(e))},[ne]),(0,E.useAlertWatcher)(e,{nag:'staff'!==g}),(0,w.useScheduledNotices)({rid:e,staffId:Y?.id??'',name:Q,onOpen:()=>ne('more','orderlists')}),(0,y.useOffRotaAlerts)({enabled:'staff'!==g&&!!Y}),(0,a.useEffect)(()=>((0,T.warmDesktopStt)(),(0,C.installVoiceKeys)()),[]);const re=(0,a.useMemo)(()=>[...G,...U].map(e=>e.s),[]);(0,a.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void oe.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=re[Number(e.key)-1];return void(t&&(e.preventDefault(),te(t)))}if('z'===t&&!Z(e.target)){const t=(0,W.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!Z(e.target)){const t=(0,W.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[re]);const ie=O.PAGES.filter(e=>(!e.can||e.can(g))&&!q[e.id]),le=(0,a.useMemo)(()=>{const e=se.trim().toLowerCase(),t={};return ie.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[ie,se]),de=G.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(g)),ue=p.CAN.forecasts(g)?U:U.filter(e=>'rota'===e.s.id),ce='page'===ee.kind?(0,O.pageFor)(ee.id):void 0,be='tab'===ee.kind?G.find(e=>X(e.s,ee))?.label:'edit'===ee.kind?U.find(e=>X(e.s,ee))?.label:ce?.title,he='tab'===ee.kind?G.find(e=>X(e.s,ee))?.tip:'page'===ee.kind?`${ce?.sub??''}. Press ${(0,N.CMD)()}K to jump to any page, or hold Space and ask.`:'',fe=({label:e,s:t,n:s})=>{const a=X(t,ee);return(0,K.jsxs)(o.default,{accessibilityRole:"button",accessibilityState:{selected:a},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>te(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:a?A.colours.goldTint:e?A.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:a?A.colours.gold:'transparent'}),children:[(0,K.jsx)(f.T,{size:14,weight:a?'semibold':'regular',colour:a?A.colours.gold:A.colours.text,style:{flex:1},numberOfLines:1,children:e}),s?(0,K.jsxs)(f.T,{size:11,colour:A.colours.muted,children:[(0,N.CMD)(),s]}):null]})},ge=({t:e})=>(0,K.jsx)(f.T,{size:11,weight:"semibold",colour:A.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),pe='owner'===g?'OWNER':'manager'===g?'MANAGER':'STAFF';return(0,K.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:A.colours.bg},testID:"desktop-shell",children:[(0,K.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,K.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(f.Row,{gap:10,children:[(0,K.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsx)(u.VenueName,{name:c.name}),(0,K.jsx)(f.Row,{gap:6,children:(0,K.jsx)(l.AppBadge,{label:pe})})]})]}),(0,K.jsx)(u.PoweredBy,{}),(0,K.jsx)(s.TextInput,{ref:oe,testID:"side-filter",value:se,onChangeText:ae,placeholder:`Find a page (${(0,N.CMD)()}K)`,placeholderTextColor:A.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,K.jsxs)(n.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[se?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{t:"Run the day"}),de.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:t+1},e.label)),(0,K.jsx)(ge,{t:"Drag-and-drop editors"}),ue.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:de.length+t+1},e.label))]}),Object.entries(le).map(([e,t])=>(0,K.jsxs)(r.default,{children:[(0,K.jsx)(ge,{t:e}),t.map(e=>(0,K.jsx)(fe,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{flex:1},children:[(0,K.jsx)(r.default,{testID:"desk-title",children:(0,K.jsx)(f.T,{size:24,weight:"bold",children:be??''})}),(0,K.jsxs)(f.Muted,{size:12,children:[Y?`Signed in as ${Y.name} \xb7 ${p.ROLE_LABEL[g]}`:`Preview \xb7 ${p.ROLE_LABEL[g]}`," \xb7 ",c.name]})]}),(0,K.jsxs)(r.default,{style:{alignItems:'flex-end'},children:[(0,K.jsx)(f.T,{size:15,weight:"bold",colour:A.colours.gold,children:"Talk to CoverCharge"}),(0,K.jsxs)(f.Muted,{size:12,children:["Hold Space, or ",(0,N.CMD)(),"\u21e7G"]})]}),(0,K.jsx)(v.VoiceSlot,{size:76})]}),(0,K.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[he?(0,K.jsx)(F.Tip,{children:he}):null,'edit'===ee.kind?(0,K.jsx)(J,{id:ee.id,rid:e,me:Q,role:'owner'===g?'owner':'manager',today:_,venue:c.name}):(0,K.jsxs)(n.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===ee.kind&&'home'===ee.tab?(0,K.jsx)(H.Dashboard,{go:ne}):null,'tab'===ee.kind&&'orders'===ee.tab?(0,K.jsx)(I.Orders,{}):null,'tab'===ee.kind&&'bookings'===ee.tab?(0,K.jsx)(R.Bookings,{}):null,'tab'===ee.kind&&'forecast'===ee.tab?(0,K.jsx)(P.Forecasts,{go:ne}):null,'tab'===ee.kind&&'chat'===ee.tab?(0,K.jsx)(M.Chat,{go:ne}):null,ce?(0,K.jsx)(ce.C,{go:ne}):'page'===ee.kind?(0,K.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,K.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==g?(0,K.jsx)(h.PrintHost,{rid:e}):null,'staff'!==g?(0,K.jsx)(b.AlertHost,{variant:"managers",rid:e,me:Q,onOpen:e=>ne('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,K.jsx)(L.AssistantSheet,{}),(0,K.jsx)(B.OnboardingHost,{go:ne}),(0,K.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),s=_r(d[1]),a=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),i=_r(d[6]),l=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]),f=_r(d[12]),g=_r(d[13]),p=_r(d[14]),x=_r(d[15]),m=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),S=_r(d[22]),v=_r(d[23]),T=_r(d[24]),E=_r(d[25]),D=_r(d[26]),A=_r(d[27]),L=_r(d[28]),R=_r(d[29]),M=_r(d[30]),z=_r(d[31]),H=_r(d[32]),P=_r(d[33]),B=_r(d[34]),I=_r(d[35]),O=_r(d[36]);_r(d[37]);var _=_r(d[38]),N=_r(d[39]),W=_r(d[40]),$=_r(d[41]),V=_r(d[42]),F=_r(d[43]),K=_r(d[44]);const G=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Hold Space and say \u201chow many Covers tonight?\u201d for a quick answer without leaving this screen.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first. Say \u201cshow new orders\u201d to jump back any time.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber. Hold Space and say \u201caccept the 7 o\u2019clock\u201d.'},{label:'Forecasts',s:{kind:'tab',tab:'forecast'},tip:'The forecast learns from your past weeks; the more you trade, the better it gets.'},{label:'Staff chat',s:{kind:'tab',tab:'chat'},tip:'Messages here go to staff in the Staff app only, never by text or WhatsApp.'}],U=[{label:'Table plan',s:{kind:'edit',id:'plan'},tip:''},{label:'Menu',s:{kind:'edit',id:'menu'},tip:''},{label:'Rota',s:{kind:'edit',id:'rota'},tip:''},{label:'Branding & Display',s:{kind:'edit',id:'brand'},tip:''}],q={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},X=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),Z=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function J({id:e,rid:t,me:s,role:o,today:n,venue:i}){const l=(0,g.usePlan)(t),[u,b]=(0,a.useState)(0),[h,p]=(0,a.useState)('');return'menu'===e?(0,K.jsx)($.MenuEditor,{rid:t,me:s,role:o}):'rota'===e?(0,K.jsx)(V.RotaEditor,{today:n}):'brand'===e?(0,K.jsx)(_.BrandEditor,{rid:t}):(0,K.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,K.jsxs)(F.Tip,{children:["Drag tables to move them; they snap to the grid and line up with their neighbours (gold lines). Hold Option (Alt) to move freely. \u201cTidy up\u201d lines up a whole area. ",(0,N.CMD)(),"Z undoes, then Save."]}),h?(0,K.jsx)(f.T,{size:13,colour:A.colours.goldLight,children:h}):null,(0,K.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:A.colours.border,borderRadius:12,overflow:'hidden'},children:(0,K.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{g.useFloor.getState().setPlan(t,e),p('Table plan saved. The Display uses it straight away.'),b(e=>e+1)},onCancel:()=>{p('Changes thrown away.'),b(e=>e+1)}},u)})]})}},1464,[798,796,34,402,295,102,36,1290,847,1293,1175,1311,794,1014,865,977,1048,1391,1087,1086,1085,1465,1401,1116,929,1177,2,840,1413,1341,1135,1100,1356,1393,1385,1395,1379,1396,1466,1463,1468,1470,1472,1469,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1465,[815]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandEditor=function({rid:e}){const w=(0,l.useBrand)(e),k=(0,u.useOwner)(t=>t.branding[e]?.recent)??[],[D,B]=(0,t.useState)(w.accent);(0,t.useEffect)(()=>B(w.accent),[w.accent]);const[S,v]=(0,t.useState)(!1),[O,C]=(0,t.useState)(''),P=(0,j.useHistory)(()=>{const t=u.useOwner.getState().branding[e];return t?{...t}:void 0},t=>{u.useOwner.getState().setBranding(e,null),t&&u.useOwner.getState().setBranding(e,t)},'branding'),R=(0,h.checkAccent)(D,x.colours.bg,x.colours.onGold,x.colours.text),T=async t=>{t.preventDefault(),v(!1);const o=(0,b.filesOf)(t)[0];if(o)try{const t=await(0,b.shrinkImage)(o,512,'image/png'===o.type?'image/png':'image/jpeg');P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:t}),C('Logo updated in all apps.')}catch{C('That picture couldn\u2019t be read.')}else C('Drop a picture file (PNG or JPEG).')};return(0,y.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:30},testID:"desk-brand",children:[(0,y.jsx)(f.Tip,{children:"Drop your logo from Finder onto the box, then pick an accent colour. \u2318Z undoes. Display layout settings are further down."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(n.default,{style:{flex:1}}),O?(0,y.jsx)(c.T,{size:13,colour:x.colours.goldLight,children:O}):null,(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"brand-undo"}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"brand-redo"})]}),(0,y.jsxs)(n.default,{style:{flexDirection:'row',gap:16,flexWrap:'wrap'},children:[(0,y.jsxs)(n.default,{style:{width:320,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Logo"}),(0,y.jsxs)("div",{"data-testid":"brand-logo-drop",onDragOver:e=>{(0,b.hasFiles)(e)&&(e.preventDefault(),v(!0))},onDragLeave:()=>v(!1),onDrop:e=>{T(e)},style:(0,f.box)({height:200,borderRadius:14,border:`2px dashed ${S?x.colours.gold:x.colours.accentBorder}`,background:S?x.colours.accentBg:x.colours.surface,display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',gap:10}),children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:96}),(0,y.jsx)("span",{style:(0,f.box)({fontSize:13,color:x.colours.muted}),children:"Drop a logo here (PNG with a clear background is best)"})]}),w.custom&&u.useOwner.getState().branding[e]?.logoUri?(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Use the standard logo",onPress:()=>{P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:void 0})}}):null,(0,y.jsx)(c.T,{weight:"semibold",children:"Preview"}),(0,y.jsxs)(n.default,{style:{backgroundColor:x.colours.bg,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12,gap:8},children:[(0,y.jsxs)(c.Row,{gap:10,children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:44}),(0,y.jsx)(c.T,{weight:"bold",children:w.name})]}),(0,y.jsx)(n.default,{style:{backgroundColor:D,borderRadius:10,padding:10,alignItems:'center'},children:(0,y.jsx)(c.T,{weight:"semibold",colour:R.onAccent,children:"Book a table"})})]})]}),(0,y.jsxs)(n.default,{style:{width:380,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Accent colour"}),(0,y.jsx)(s.ColourPicker,{value:D,onChange:B,onCommit:t=>{t!==w.accent&&(P.record('accent colour'),u.useOwner.getState().setBranding(e,{accent:t,recent:(0,h.pushRecent)(k,t)}),C(`Accent set to ${t}.`))},quick:l.ACCENTS,recent:k}),R.tips.length?(0,y.jsx)(c.Banner,{kind:"warn",children:R.tips.join(' ')}):(0,y.jsx)(c.Muted,{size:12,children:"Easy to read on the dark background."})]})]}),(0,y.jsxs)(n.default,{style:{maxWidth:760,gap:8},children:[(0,y.jsx)(c.T,{size:18,weight:"bold",children:"Display layout"}),(0,y.jsx)(p.DisplaySettingsPage,{})]})]})};var t=r(d[0]),o=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]),p=r(d[8]),x=r(d[9]),b=r(d[10]),j=r(d[11]),f=r(d[12]),y=r(d[13])},1466,[34,295,102,1422,847,794,865,799,1380,840,1467,1468,1469,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dragData",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"readDrag",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"filesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"hasFiles",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"readDataUrl",{enumerable:!0,get:function(){return i}}),_e.shrinkImage=async function(e,t=1024,r="image/jpeg"){const n=await i(e),o=await new Promise((e,t)=>{const r=new Image;r.onload=()=>e(r),r.onerror=t,r.src=n}),s=Math.min(1,t/Math.max(o.width,o.height)),c=document.createElement('canvas');return c.width=Math.round(o.width*s),c.height=Math.round(o.height*s),c.getContext('2d').drawImage(o,0,0,c.width,c.height),c.toDataURL(r,.82)};const e=(e,t,r)=>{try{e.dataTransfer.setData('text/plain',`${t}:${r}`),e.dataTransfer.effectAllowed='copyMove'}catch{}},t=e=>{const t=e.dataTransfer?.getData('text/plain')??'',r=t.indexOf(':');return r>0?{kind:t.slice(0,r),id:t.slice(r+1)}:null},r=e=>Array.from(e.dataTransfer?.files??[]).filter(e=>/^image\//.test(e.type)),n=e=>Array.from(e.dataTransfer?.types??[]).includes('Files'),i=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error),n.readAsDataURL(e)})},1467,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"activeUndo",{enumerable:!0,get:function(){return u}}),e.useHistory=function(u,c,s="change",l=60){const o=(0,t.useRef)([]),f=(0,t.useRef)([]),[,h]=(0,t.useState)(0),[v,b]=(0,t.useState)(''),w=(0,t.useRef)(u);w.current=u;const R=(0,t.useRef)(c);R.current=c;const p=(0,t.useCallback)((t=s)=>{o.current=[...o.current,{v:w.current(),what:t}].slice(-l),f.current=[],b(t),h(t=>t+1)},[s,l]),_=(0,t.useCallback)(()=>{const t=o.current.pop();t&&(f.current.unshift({v:w.current(),what:t.what}),R.current(t.v),b(`Undid: ${t.what}`),h(t=>t+1))},[]),k=(0,t.useCallback)(()=>{const t=f.current.shift();t&&(o.current.push({v:w.current(),what:t.what}),R.current(t.v),b(`Redid: ${t.what}`),h(t=>t+1))},[]),y={undo:_,redo:k,canUndo:o.current.length>0,canRedo:f.current.length>0,label:s,record:p,last:v};return(0,t.useEffect)(()=>(n=y,()=>{n===y&&(n=null)})),y};var t=r(d[0]);let n=null;const u=()=>n},1468,[34]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Tip=function({children:e}){return(0,c.jsxs)(t.default,{testID:"desk-tip",style:{flexDirection:'row',gap:8,alignItems:'flex-start',borderWidth:1,borderColor:n.colours.accentBorder,backgroundColor:n.colours.accentBg,borderRadius:10,paddingHorizontal:12,paddingVertical:8},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:n.colours.gold,children:"Tip"}),(0,c.jsx)(l.T,{size:13,colour:n.colours.text,style:{flex:1},children:e})]})},Object.defineProperty(_e,"box",{enumerable:!0,get:function(){return s}}),r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},l=r(d[2]),n=r(d[3]),c=r(d[4]);const s=(e={})=>({fontFamily:'Poppins_400Regular',color:n.colours.text,boxSizing:'border-box',...e})},1469,[34,102,794,840,25]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuEditor=function({rid:e,me:o,role:s}){const a=(0,d.useAllMenu)(e),c=(0,l.useStore)(o=>o.restaurants.find(o=>o.id===e)),[u,h]=(0,t.useState)('dishes'),[D,O]=(0,t.useState)(null),[k,w]=(0,t.useState)(null),[C,I]=(0,t.useState)(''),z=(0,t.useMemo)(()=>{const e=[...c?.sections??[]];return a.forEach(o=>{e.includes(o.section)||e.push(o.section)}),e},[c?.sections,a]),M=a.filter(e=>!e.hidden||e.recipeCardId),P=e=>(0,p.hasRecipeCards)()?(0,p.recipeCards)().byMenuItem(e):void 0,T={name:o,role:s},R=(0,b.useHistory)(()=>({sections:[...z],items:Object.fromEntries(l.useStore.getState().menu.filter(o=>o.restaurantId===e).map(e=>{const o=a.find(o=>o.id===e.id)??e;return[e.id,{section:o.section,sort:e.sort,price:o.price,allergens:{...o.allergens},soldOut:e.soldOut,photo:P(e.id)?.photo}]}))}),o=>{const t=l.useStore.getState();c&&o.sections.join('|')!==(c.sections??[]).join('|')&&t.updateRestaurant(e,{sections:o.sections});for(const[e,s]of Object.entries(o.items)){const o=a.find(o=>o.id===e),n=t.menu.find(o=>o.id===e);if(!o||!n)continue;const r={};o.section!==s.section&&(r.section=s.section),n.sort!==s.sort&&(r.sort=s.sort),o.price!==s.price&&(r.price=s.price),JSON.stringify(o.allergens)!==JSON.stringify(s.allergens)&&(r.allergens=s.allergens),n.soldOut!==s.soldOut&&(r.soldOut=s.soldOut),Object.keys(r).length&&t.updateMenuItem(e,r);const d=P(e);d&&d.photo!==s.photo&&(0,p.recipeCards)().update(d.id,{photo:s.photo},T)}},'menu change'),B=(e,o,t)=>{const s=a.find(o=>o.id===e);if(!s)return;R.record(`moved ${s.name}`);const n=l.useStore.getState(),r=a.map(t=>t.id===e?{...t,section:o}:t);s.section!==o&&n.updateMenuItem(e,{section:o}),(0,y.reorder)(r,e,o,t).forEach(e=>n.updateMenuItem(e.id,{sort:e.sort})),I(`${s.name} moved${s.section!==o?` to ${o}`:''}.`)},F=async(o,t)=>{const s=P(o),n=a.find(e=>e.id===o);if(s&&n)try{const o=await(0,f.shrinkImage)(t,1024);R.record(`photo for ${n.name}`);const r=await(0,p.recipeCards)().savePhoto(e,s.id,{dataUrl:o,width:0,height:0,bytes:Math.round(.75*o.length)});await(0,p.recipeCards)().update(s.id,{photo:r},T),I(`Photo added to ${n.name}. The dish needs the Head Chef\u2019s sign-off again.`)}catch{I('That picture couldn\u2019t be read. Try a JPEG or PNG.')}else I('This dish has no recipe card yet, so it can\u2019t hold a photo.')},_=a.find(e=>e.id===D),E=({m:e})=>{const o=P(e.id),t=o?.photo&&(0,p.hasRecipeCards)()?(0,p.recipeCards)().photoSource(o.photo):null,s=t?.uri,n=D===e.id,r=k===`d:${e.id}`;return(0,S.jsxs)("div",{"data-testid":`menu-dish-${e.id}`,draggable:!0,onDragStart:o=>(0,f.dragData)(o,'dish',e.id),onClick:()=>O(e.id),onDragOver:o=>{o.preventDefault(),w(`d:${e.id}`)},onDragLeave:()=>w(null),onDrop:o=>{o.preventDefault(),o.stopPropagation(),w(null);const t=(0,f.filesOf)(o)[0];if(t)return void F(e.id,t);const s=(0,f.readDrag)(o);'dish'===s?.kind&&s.id!==e.id&&B(s.id,e.section,e.id)},style:(0,j.box)({display:'flex',alignItems:'center',gap:10,padding:'8px 10px',borderRadius:10,cursor:'grab',userSelect:'none',marginBottom:6,background:n?x.colours.goldTint:x.colours.tile,border:`1px solid ${r?x.colours.gold:n?x.colours.accentBorder:x.colours.hairline}`,borderTop:r?`3px solid ${x.colours.gold}`:void 0}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted,fontSize:16}),children:"\u283f"}),(0,S.jsx)("div",{style:(0,j.box)({width:40,height:40,borderRadius:8,background:x.colours.surface2,backgroundImage:s?`url(${s})`:void 0,backgroundSize:'cover',backgroundPosition:'center',flexShrink:0,display:'flex',alignItems:'center',justifyContent:'center',fontSize:10,color:x.colours.muted}),children:s?'':'photo'}),(0,S.jsxs)("div",{style:(0,j.box)({flex:1,minWidth:0}),children:[(0,S.jsx)("div",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',fontSize:14,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',textDecoration:e.soldOut?'line-through':void 0}),children:e.name}),(0,S.jsxs)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[Object.keys(e.allergens).length?Object.keys(e.allergens).length+' allergens':'No allergens',e.hidden?' \xb7 hidden':'']})]}),e.soldOut?(0,S.jsx)("span",{style:(0,j.box)({fontSize:11,color:x.colours.amber,border:`1px solid ${x.colours.amber}`,borderRadius:6,padding:'1px 6px'}),children:"Sold out"}):null,(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',color:x.colours.gold,fontSize:14}),children:v(e.price)})]})};return(0,S.jsxs)(n.default,{style:{flex:1,gap:10},testID:"desk-menu",children:[(0,S.jsx)(j.Tip,{children:"Drag a dish (\u283f) to put it in order or onto another section. Drag a section name to move the whole section. Drop a photo from Finder onto a dish. \u2318Z undoes."}),(0,S.jsxs)(r.Row,{gap:8,children:[(0,S.jsx)(r.Chip,{label:"Dishes",selected:'dishes'===u,onPress:()=>h('dishes'),testID:"menu-tab-dishes"}),(0,S.jsx)(r.Chip,{label:"Sold out & counts",selected:'soldout'===u,onPress:()=>h('soldout'),testID:"menu-tab-soldout"}),(0,S.jsx)(n.default,{style:{flex:1}}),C?(0,S.jsx)(r.T,{size:13,colour:x.colours.goldLight,children:C}):null,(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!R.canUndo,onPress:R.undo,testID:"menu-undo"}),(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!R.canRedo,onPress:R.redo,testID:"menu-redo"})]}),'soldout'===u?(0,S.jsx)(n.default,{style:{maxWidth:760},children:(0,S.jsx)(m.SoldOutList,{rid:e,by:o})}):(0,S.jsxs)(n.default,{style:{flex:1,flexDirection:'row',gap:14,minHeight:0},children:[(0,S.jsx)("div",{style:(0,j.box)({flex:1,overflowY:'auto',paddingRight:6}),"data-testid":"menu-sections",children:z.map(o=>{const t=M.filter(e=>e.section===o),s=k===`s:${o}`;return(0,S.jsxs)("div",{style:(0,j.box)({marginBottom:14}),onDragOver:e=>{e.preventDefault(),w(`s:${o}`)},onDragLeave:()=>w(null),onDrop:t=>{t.preventDefault(),w(null);const s=(0,f.readDrag)(t);var n,r;'dish'===s?.kind&&B(s.id,o,null),'section'===s?.kind&&s.id!==o&&(n=s.id,r=o,c&&(R.record(`moved section ${n}`),l.useStore.getState().updateRestaurant(e,{sections:(0,y.moveSection)(z,n,r)}),I(`${n} moved.`)))},children:[(0,S.jsxs)("div",{draggable:!0,onDragStart:e=>(0,f.dragData)(e,'section',o),"data-testid":`menu-section-${o}`,style:(0,j.box)({display:'flex',alignItems:'center',gap:8,padding:'6px 4px',cursor:'grab',borderBottom:`${s?2:1}px solid ${s?x.colours.gold:x.colours.border}`,marginBottom:8}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted}),children:"\u283f"}),(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_700Bold',fontSize:16,color:x.colours.goldMuted,letterSpacing:.5,textTransform:'uppercase'}),children:o}),(0,S.jsxs)("span",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[t.length," dishes"]})]}),t.map(e=>(0,S.jsx)(E,{m:e},e.id)),t.length?null:(0,S.jsx)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted,padding:8,border:`1px dashed ${x.colours.border}`,borderRadius:8}),children:"Drop a dish here"})]},o)})}),(0,S.jsx)(n.default,{style:{width:340,gap:10},testID:"menu-inspector",children:_?(0,S.jsx)($,{rid:e,m:_,me:o,record:R.record,onPhoto:e=>{F(_.id,e)}},_.id):(0,S.jsx)(r.Muted,{children:"Click a dish to change its price, allergens and sold-out state."})})]})]})};var e,o=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),n=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),m=_r(_d[11]),x=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),S=_r(_d[17]);const v=e=>null==e?'Board':`\xa3${(e/100).toFixed(2)}`,D={none:'contains',contains:'may',may:void 0};function $({rid:e,m:s,me:d,record:p,onPhoto:m}){const[b,y]=(0,t.useState)(null==s.price?'':(s.price/100).toFixed(2)),v=(e,o)=>{p(o),l.useStore.getState().updateMenuItem(s.id,e)},$=(0,c.dishUsesFor)(e).find(e=>e.id===s.id),O=(0,c.itemsFor)(e),k=()=>{const e=b.trim(),o=''===e?null:Number(e.replace('\xa3',''));if(null!==o&&(!isFinite(o)||o<0))return void y(null==s.price?'':(s.price/100).toFixed(2));const t=null==o?null:Math.round(100*o);t!==s.price&&v({price:t},`price of ${s.name}`)},w=e=>{const o=s.allergens[e]??'none',t=D[o],n={...s.allergens};t?n[e]=t:delete n[e],v({allergens:n},`allergens on ${s.name}`)};return(0,S.jsxs)(n.default,{style:{gap:10,backgroundColor:x.colours.surface,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12},children:[(0,S.jsx)(r.T,{size:17,weight:"bold",children:s.name}),(0,S.jsxs)(r.Muted,{size:12,children:[s.section,s.signOff?` \xb7 signed off by ${s.signOff.by}`:' \xb7 awaiting Head Chef sign-off']}),(0,S.jsx)("div",{onDragOver:e=>{(0,f.hasFiles)(e)&&e.preventDefault()},onDrop:e=>{e.preventDefault();const o=(0,f.filesOf)(e)[0];o&&m(o)},"data-testid":"menu-photo-drop",style:(0,j.box)({border:`1px dashed ${x.colours.accentBorder}`,borderRadius:10,padding:12,textAlign:'center',fontSize:12,color:x.colours.muted}),children:"Drop a photo from Finder here"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Price (\xa3)"}),(0,S.jsx)(o.TextInput,{testID:"menu-price",value:b,onChangeText:y,onBlur:k,onSubmitEditing:k,placeholder:"Blank = on the specials board",placeholderTextColor:x.colours.muted,style:[r.styles.input,{width:160}]})]}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Allergens"}),(0,S.jsx)(r.Muted,{size:12,children:"Click to cycle: contains \u2192 may contain \u2192 none. Changes go to the recipe card and need the Head Chef\u2019s sign-off."}),(0,S.jsx)(r.Row,{gap:6,wrap:!0,children:h.ALLERGENS.map(e=>{const o=s.allergens[e.id];return(0,S.jsx)(r.Chip,{testID:`menu-al-${e.id}`,label:'may'===o?`${e.short} (may)`:e.short,selected:!!o,onPress:()=>w(e.id)},e.id)})})]}),(0,S.jsx)(r.Toggle,{label:"Sold out now",value:s.soldOut,onChange:e=>{p(`sold out ${s.name}`),(0,a.setSoldOut)(s.id,e,d)},testID:"menu-soldout"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Sold-out link"}),$&&$.uses.length?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r.Muted,{size:12,children:(0,u.usesText)($.uses,O)}),(0,S.jsx)(r.Badge,{kind:"gold",label:"Sells out on its own when the count runs out"})]}):(0,S.jsx)(r.Muted,{size:12,children:"Not linked to a count. Link it in \u201cSold out & counts\u201d."})]})]})}},1470,[796,34,102,794,850,800,977,979,980,830,856,1130,840,1467,1468,1469,1471,25]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1471,[865]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const y=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[$,j]=(0,t.useState)((0,i.mondayOfDate)(e)),[v,k]=(0,t.useState)(null),[w,D]=(0,t.useState)(''),B=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),O=b.map((e,t)=>(0,i.addDays)($,t)),P=(e,t,o)=>{e.preventDefault(),k(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=y.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=$&&e.date<=O[6]),I=T.filter(e=>!e.published||e.changed).length;return(0,p.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,p.jsx)(h.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,p.jsxs)(s.Row,{gap:8,children:[(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>j((0,i.addDays)($,-7))}),(0,p.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date($+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>j((0,i.addDays)($,7))}),(0,p.jsx)(d.default,{style:{flex:1}}),w?(0,p.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:w}):null,(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!B.canUndo,onPress:B.undo,testID:"rota-undo"}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!B.canRedo,onPress:B.redo,testID:"rota-redo"}),(0,p.jsx)(s.Button,{small:!0,label:I?`Publish (${I})`:'Published',disabled:!I,onPress:()=>{B.record('published the week');const e=i.useOwner.getState().publishWeek($);D(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,p.jsx)("div",{style:(0,h.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,p.jsxs)("div",{style:(0,h.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,p.jsx)("div",{style:(0,h.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),O.map((t,o)=>(0,p.jsxs)("div",{style:(0,h.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[b[o]," ",Number(t.slice(8))]},t)),y.map(e=>(0,p.jsxs)(o.default.Fragment,{children:[(0,p.jsxs)("div",{style:(0,h.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,p.jsx)("div",{style:(0,h.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,p.jsx)("div",{style:(0,h.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),O.map(t=>{const o=`${e.id}|${t}`,d=T.filter(o=>o.staffId===e.id&&o.date===t);return(0,p.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',k(o)},onDragLeave:()=>k(null),onDrop:o=>P(o,e.id,t),style:(0,h.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,p.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,h.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,p.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]),f=r(_d[9]),p=r(_d[10]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1472,[34,102,794,865,1103,840,1467,1468,1469,1471,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=R,_e.CarApp=function(){const{width:e,height:d}=(0,l.default)(),{role:h,today:b,now:y}=(0,f.useCtx)(3e4),[w,W]=(0,t.useState)(d),v=(0,D.railSizes)(e,w),$=Math.max(320,e-v.railW-1),[M,P]=(0,t.useState)(null),[A,_]=(0,t.useState)(null),[E,N]=(0,t.useState)(!1),[U,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,f.ensureAttendance)(b,y),(0,u.ensureChat)(y)},[b]),(0,t.useEffect)(()=>{R().then(_)},[]),(0,t.useEffect)(()=>{if(I.PITCH)return;const e=setInterval(()=>{(0,C.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==h&&j.useOwner.getState().setPreviewRole('owner')},[h]);const F=(0,t.useCallback)(()=>P(null),[]);(0,p.useBackLayer)(!!M,F);const Y=e=>P({btn:e,page:e.pages[0].id}),G=(0,t.useCallback)((e,t)=>{const n=e=>D.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return P(null);if('bookings'===e)return P({btn:n('@bookings'),page:'@bookings'});if('chat'===e)return P({btn:n('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return P(t=>({btn:t?.btn??D.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=n(t);return P(n=>({btn:e??n?.btn??D.CAR_BUTTONS[0],page:t}))}P(null)},[]),q=$<1400?$:Math.round(Math.min($,Math.max(960,.72*$))),J=M?M.btn.pages.find(e=>e.id===M.page)?.label??(0,c.pageFor)(M.page)?.title??M.btn.label:'';return(0,B.jsxs)(s.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-w)>1&&W(t)},style:{flex:1,flexDirection:'row',backgroundColor:T.colours.bg,minHeight:0},children:[(0,B.jsxs)(s.default,{testID:"car-board",style:{width:$,minWidth:0,minHeight:0},children:[(0,B.jsx)(a.DisplayBoard,{embedded:!0,noVoice:!0,boardW:$,headerExtra:(0,B.jsx)(S.ParkedOnly,{small:e<1400}),subHeader:(0,B.jsx)(L,{onRota:()=>Y(D.CAR_BUTTONS[0]),onAccount:()=>N(!0)})}),M?(0,B.jsxs)(s.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:q,zIndex:40,backgroundColor:T.colours.bg,borderLeftWidth:1,borderColor:T.colours.gold,boxShadow:'-18px 0 40px rgba(0,0,0,0.55)'},children:[(0,B.jsxs)(s.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,B.jsx)(n.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${J}, back to the board`,onPress:()=>{(0,p.runBackLayer)()||F()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:T.colours.border,alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(x.T,{weight:"semibold",center:!0,children:"Close"})}),(0,B.jsx)(s.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,B.jsx)(x.T,{size:20,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:M.btn.label})}),(0,B.jsx)(s.default,{style:{minWidth:96}})]}),M.btn.pages.length>1?(0,B.jsx)(s.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:M.btn.pages.map(e=>{const t=e.id===M.page;return(0,B.jsx)(n.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>P({btn:M.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?T.colours.gold:T.colours.border,backgroundColor:t?H:'transparent',alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(x.T,{weight:"semibold",colour:t?T.colours.goldLight:T.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,B.jsx)(o.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:'assistant'===M.page&&!1===A?(0,B.jsx)(O,{}):(0,B.jsx)(z,{id:M.page,go:G},M.page)})]}):null]}),(0,B.jsxs)(s.default,{testID:"car-rail",accessibilityRole:"toolbar",accessibilityLabel:"Owner tools",style:{width:v.railW+1,borderLeftWidth:1,borderColor:T.colours.border,backgroundColor:'#0A0A0A',paddingTop:6,paddingBottom:6,alignItems:'stretch',minHeight:0,overflow:'hidden'},children:[(0,B.jsx)(s.default,{style:{height:D.RAIL_TITLE,alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(x.T,{size:11,weight:"semibold",colour:T.colours.goldMuted,center:!0,style:{letterSpacing:1},children:"OWNER"})}),(0,B.jsx)(s.default,{testID:"car-rail-grid",style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'flex-start',minHeight:0},children:D.CAR_BUTTONS.map(e=>{const t=M?.btn.id===e.id;return(0,B.jsxs)(n.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>t?F():Y(e),style:{width:v.colW,height:v.per,alignItems:'center',justifyContent:'center',gap:4,overflow:'hidden'},children:[(0,B.jsx)(s.default,{style:{width:v.circle,height:v.circle,borderRadius:v.circle/2,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:t?T.colours.gold:H,alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(k.CarGlyph,{name:e.icon,size:v.icon,colour:t?'#0B0B0B':T.colours.goldLight})}),(0,B.jsx)(x.T,{size:v.label,weight:t?'semibold':'medium',colour:t?T.colours.goldLight:T.colours.text,center:!0,numberOfLines:1,style:{lineHeight:v.lineH,maxWidth:v.colW-6},children:v.colW<150?e.short:e.label})]},e.id)})})]}),E?(0,B.jsxs)(x.Sheet,{visible:!0,onClose:()=>N(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,B.jsx)(x.T,{center:!0,children:"This car is signed in to The Anchorage as you, with your own rights. Use it only when the car is in Park."}),(0,B.jsx)(x.Muted,{center:!0,children:"To sign it out from your phone: Managers, More, Car screen."}),(0,B.jsx)(x.Button,{testID:"car-sign-out",kind:"secondary",label:"Sign this car out",onPress:()=>{N(!1),V(!0)},style:{minHeight:56}}),(0,B.jsx)(x.Button,{kind:"ghost",label:"Close",onPress:()=>N(!1),style:{minHeight:56}})]}):null,U?(0,B.jsxs)(x.Sheet,{visible:!0,onClose:()=>V(!1),title:"Sign this car out?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,B.jsx)(x.T,{center:!0,children:"You\u2019ll need a new code, approved on your phone, to use it again."}),(0,B.jsx)(x.Button,{testID:"car-sign-out-yes",label:"Yes, sign this car out",onPress:()=>{V(!1),(0,C.carSignOut)()},style:{minHeight:56}}),(0,B.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]);r(_d[1]);var n=e(r(_d[2])),o=e(r(_d[3])),s=e(r(_d[4])),l=e(r(_d[5])),a=r(_d[6]),c=r(_d[7]);r(_d[8]);var d=r(_d[9]),u=r(_d[10]),h=r(_d[11]),b=r(_d[12]),f=r(_d[13]),p=r(_d[14]),x=r(_d[15]),y=r(_d[16]),j=r(_d[17]),w=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),S=r(_d[24]),W=r(_d[25]),v=r(_d[26]),B=r(_d[27]);const H='rgba(201,162,74,0.14)';async function R(){try{const e='undefined'!=typeof navigator?navigator.mediaDevices:null;if(!e?.getUserMedia||!e?.enumerateDevices)return!1;return(await e.enumerateDevices()).some(e=>'audioinput'===e.kind)}catch{return!1}}function L({onRota:e,onAccount:o}){const l=(0,f.useSignedIn)(),a=(0,j.useOwner)(e=>e.attendance),c=(0,j.useOwner)(e=>e.staff),[d,u]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>u(Date.now()),3e4);return()=>clearInterval(e)},[]);const h=a.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(c.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),b=[...new Set(h)],p=b.length?`On now: ${b.join(' \xb7 ')}`:'Nobody clocked in';return(0,B.jsxs)(s.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,B.jsx)(n.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${p}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,B.jsx)(x.T,{size:14,weight:"semibold",colour:T.colours.goldLight,numberOfLines:1,center:!0,children:p})}),l?(0,B.jsx)(n.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:`Signed in as ${l.name}. Car sign-in options.`,onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:T.colours.gold,flexShrink:0},children:(0,B.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,children:l.name.replace(' (example)','')})}):null,(0,B.jsx)(W.CarGameButton,{}),(0,B.jsx)(v.CarFullscreenButton,{})]})}function $({go:e}){const{rid:t,now:n}=(0,f.useCtx)(3e4),o=(0,y.useBookings)(t),l=(0,w.ymd)(n),a=(0,w.ymd)(new Date(n.getTime()-24192e5)),c=o.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=l).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),d=o.filter(e=>e.date===l&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,B.jsxs)(s.default,{testID:"car-noshows",style:{gap:10},children:[(0,B.jsx)(x.T,{center:!0,size:18,weight:"semibold",colour:T.colours.goldLight,children:c.length?`${c.length} no-show${1===c.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),d.length?(0,B.jsxs)(s.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:T.colours.amber,borderRadius:12,padding:12},children:[(0,B.jsx)(x.T,{center:!0,weight:"semibold",colour:T.colours.amber,children:"Running more than 15 minutes late"}),d.map(e=>(0,B.jsx)(x.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,B.jsx)(x.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,c.map(e=>(0,B.jsxs)(s.default,{style:{borderWidth:1,borderColor:T.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,B.jsx)(x.T,{center:!0,weight:"semibold",children:`${e.date===l?'Today':(0,w.niceDate)((0,w.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,B.jsx)(x.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,B.jsx)(x.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function O(){return(0,B.jsxs)(s.default,{testID:"car-no-mic",accessibilityLiveRegion:"polite",style:{gap:10,alignItems:'center',paddingVertical:24},children:[(0,B.jsx)(x.T,{center:!0,size:20,weight:"semibold",colour:T.colours.goldLight,children:"The Assistant needs the car\u2019s microphone"}),(0,B.jsx)(x.Muted,{center:!0,style:{maxWidth:520},children:"Sorry, this car\u2019s browser isn\u2019t letting the page use a microphone. For now, please use the Assistant in Managers on your phone."})]})}function z({id:e,go:t}){if('@bookings'===e)return(0,B.jsx)(d.Bookings,{go:t});if('@chat'===e)return(0,B.jsx)(u.Chat,{go:t});if('@noshows'===e)return(0,B.jsx)($,{go:t});if('@orders'===e)return(0,B.jsx)(h.Orders,{});if('@forecast'===e)return(0,B.jsx)(b.Forecasts,{go:t});const n=(0,c.pageFor)(e);if(!n)return(0,B.jsx)(x.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const o=n.C;return(0,B.jsx)(o,{go:t})}},1473,[34,236,402,295,102,426,1279,1379,1396,1341,1135,1395,1393,1100,1041,794,848,865,827,985,2,840,1474,1475,1476,1477,1478,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"RAIL_TITLE",{enumerable:!0,get:function(){return o}}),e.railSizes=function(s,l){const t=l>=1e3?13:11,n=Math.round(1.45*t),c=48+n+8,b=Math.floor((l-o-12)/12)>=c?1:2,h=12/b,p=Math.floor((l-o-12)/h),u=1===b?s>=1600?168:s>=1200?136:120:s>=1600?128:s>=1100?100:88,f=Math.max(44,Math.min(1===b?72:64,p-n-12,u-24));return{railW:u*b,colW:u,cols:b,per:p,circle:f,label:t,lineH:n,icon:Math.round(.46*f)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return l}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}],o=32;const l=s=>s.split('').join(' ')},1474,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGlyph=function({name:e,size:x,colour:n}){const c={stroke:n,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'},l={rota:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h3M14 14h3M7 17h3",...c})]}),signoff:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...c}),(0,h.jsx)(s.Path,{d:"M12 7v5l3 2",...c}),(0,h.jsx)(s.Path,{d:"M15.5 18.5l1.8 1.8 3.4-3.6",...c})]}),menu:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M6 3v8a2 2 0 0 0 2 2v8M10 3v8a2 2 0 0 1-2 2M8 3v6",...c}),(0,h.jsx)(s.Path,{d:"M16 21V3c2.5 1.5 3 5 3 8h-3",...c})]}),bookings:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...c})]}),noshow:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...c}),(0,h.jsx)(s.Path,{d:"M3 21c0-4 3-6 7-6s7 2 7 6M17 9l4 4M21 9l-4 4",...c})]}),chat:(0,h.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...c}),stock:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M3 7l9-4 9 4-9 4z",...c}),(0,h.jsx)(s.Path,{d:"M3 7v10l9 4 9-4V7M12 11v10",...c})]}),loyalty:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"2",...c}),(0,h.jsx)(s.Circle,{cx:"8",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"16",cy:"12",r:"1.5",...c})]}),takings:(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...c})}),safety:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M10 14V5a2 2 0 0 1 4 0v9a4 4 0 1 1-4 0z",...c}),(0,h.jsx)(s.Path,{d:"M12 9v7",...c})]}),reviews:(0,h.jsx)(s.Path,{d:"M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z",...c}),assistant:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",...c}),(0,h.jsx)(s.Path,{d:"M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6",...c})]})};return(0,h.jsx)(t.default,{width:x,height:x,viewBox:"0 0 24 24",children:l[e]})},_e.GameGlyph=function({size:e,colour:x}){const n={stroke:x,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,h.jsxs)(t.default,{width:e,height:e,viewBox:"0 0 24 24",children:[(0,h.jsx)(s.Path,{d:"M7 8h10a4 4 0 0 1 4 4v3a3 3 0 0 1-5.4 1.8L14.5 15h-5l-1.1 1.8A3 3 0 0 1 3 15v-3a4 4 0 0 1 4-4z",...n}),(0,h.jsx)(s.Path,{d:"M7 11v3M5.5 12.5h3",...n}),(0,h.jsx)(s.Circle,{cx:"16",cy:"11.5",r:"0.9",...n}),(0,h.jsx)(s.Circle,{cx:"18",cy:"13.5",r:"0.9",...n})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},h=r(d[2])},1475,[34,900,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1476,[34,102,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGameButton=function(){const e=(0,u.useStore)(e=>!1!==e.restaurants.find(e=>e.id===f.VENUE_RID)?.settings?.games),s=(0,c.useSession)(e=>e.meId),j=(0,b.useSignedIn)(),[C,S]=(0,n.useState)(!1),[k]=(0,n.useState)(()=>new Date),x=(0,o.useGameClock)(s,C?new Date:k);return e?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(t.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>S(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:y.colours.gold,flexShrink:0},children:(0,_.jsx)(h.T,{size:13,weight:"semibold",colour:y.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),C?(0,_.jsx)(o.BreakRoom,{car:!0,staffId:s??null,name:j?.name??'Owner',playable:(0,l.gamePlayable)(x),clock:x,onClose:()=>S(!1)}):null]}):null};var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8]),y=r(d[9]),_=r(d[10])},1477,[34,402,1137,1138,800,997,1100,5,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FS_KEY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"THEATRE_KEY",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EASY_LINK",{enumerable:!0,get:function(){return b}}),_e.theatreUrl=p,_e.inTheatre=v,_e.CarFullscreenButton=function(){const[t,n]=(0,e.useState)(y),[f,T]=(0,e.useState)(!1),[x]=(0,e.useState)(v);(0,e.useEffect)(()=>{if(!u)return;const e=()=>{const e=y();n(e),e||w.set(h,null)};document.addEventListener('fullscreenchange',e),document.addEventListener('webkitfullscreenchange',e);let t='1'===w.get(h)&&!y();const c=()=>{t&&(t=!1,E())};return t&&(document.addEventListener('click',c,!0),document.addEventListener('touchend',c,!0)),()=>{document.removeEventListener('fullscreenchange',e),document.removeEventListener('webkitfullscreenchange',e),document.removeEventListener('click',c,!0),document.removeEventListener('touchend',c,!0)}},[]);const k=(0,e.useCallback)(async()=>{if(y()){w.set(h,null);try{await((document.exitFullscreen??document.webkitExitFullscreen)?.call(document))}catch{}return}const e=window.innerHeight;await E()?(w.set(h,'1'),setTimeout(()=>{(!y()||window.innerHeight<=e+8)&&T(!0)},900)):T(!0)},[]);return!u||x?null:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(c.default,{testID:"car-fullscreen",accessibilityRole:"button",accessibilityLabel:t?'Exit full screen':'Full screen: hide the browser bar',onPress:()=>{k()},style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:l.colours.gold,backgroundColor:t?'rgba(201,162,74,0.14)':'transparent',flexShrink:0},children:(0,o.jsx)(s.T,{size:13,weight:"semibold",colour:l.colours.gold,center:!0,numberOfLines:1,children:t?'Exit full screen':'Full screen'})}),f?(0,o.jsxs)(s.Sheet,{visible:!0,onClose:()=>T(!1),title:"Full screen in the car",maxWidth:600,testID:"car-fullscreen-help",children:[(0,o.jsx)(s.T,{center:!0,children:"The car\u2019s browser keeps its bar at the top. The car\u2019s own full-screen view has no bar at all."}),(0,o.jsx)(s.T,{center:!0,children:"Tap Open full screen. A YouTube page says you\u2019re leaving YouTube: tap the link on it. The car screen then opens with no bar."}),(0,o.jsx)(s.Muted,{center:!0,children:"The first time only, sign the car in again with a new code from your phone: the full-screen view keeps its own sign-in. The Assistant\u2019s microphone doesn\u2019t work there. To leave, tap the car\u2019s \u2715 in the top corner."}),(0,o.jsx)(s.Muted,{center:!0,children:`Easy link to save as a favourite: ${b}`}),(0,o.jsx)(s.Button,{testID:"car-fullscreen-theatre",label:"Open full screen",onPress:()=>{location.href=p(location.origin)},style:{minHeight:56}}),(0,o.jsx)(s.Button,{kind:"secondary",label:"Not now",onPress:()=>T(!1),style:{minHeight:56}})]}):null]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},s=r(d[3]),l=r(d[4]),o=r(d[5]);const u='undefined'!=typeof document,h='cc-car-fullscreen',f='cc-car-theatre',b='covercharge-apps.static.hf.space/car?full';function p(e){return`https://www.youtube.com/redirect?q=${encodeURIComponent(`${e}/car-app/index.html?theatre=1`)}`}const w={get:e=>{try{return localStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{null==t?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}};function v(){if(!u)return!1;try{return/[?&]theatre=1\b/.test(location.search)&&w.set(f,'1'),/TESLA_AUTO/i.test(navigator.userAgent)||'1'===w.get(f)}catch{return!1}}const y=()=>u&&!(!document.fullscreenElement&&!document.webkitFullscreenElement);async function E(){const e=document.documentElement,t=e.requestFullscreen??e.webkitRequestFullscreen;if(!t)return!1;try{return await t.call(e,{navigationUI:'hide'}),!0}catch{return!1}}},1478,[34,236,402,794,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1479,[30,34,846,1480,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1480,[1380,1481,798,991,1073,1430,1161,1040,1041,1431,1454,1433,1130,977,1042,2,1047,1048,1407,993,34,1132,1186,1190,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1341,1070,1085,1086,1082,1043,1025,1100,1425,1420,1439,1482,1349,997,236,1192,1145,1151,1378,1155,1154,1392,1148,15,1162,1163,899,793,985,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1481,[34,102,794,1100,985,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1482,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); +__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]})}},1483,[30,34,846,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1484,[1374,985,795,1335,1485,1011,30,1512,496,34,385,336,236,41,102,5,847,846,1514,36,848,1014,865,840,1349,997,1010,1515,1516,1517,1518,1099,2,1024,1520,1304,25,1521,1522,1523,1524]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1485,[1486,1509,1511]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1486,[215,1487,1490,1504,1505,1506,1507,1508]); +__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1487,[215,1488]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1488,[1489]); +__d(function(g,r,i,a,m,e,d){},1489,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1490,[1491,215,1487,1504,1505]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1491,[1492,1493,1503]); +__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1492,[1493,1497,1502]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1493,[215,372,1494,1498,1499,1500,1501,1497,1502]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1494,[215,1495,339,280,1496,1497]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1495,[504]); +__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1496,[215,339]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1497,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1498,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1499,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1500,[1498]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1501,[]); +__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1502,[372,1496]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1503,[34,1493]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1504,[1491,215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1505,[1491,1504]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1506,[1487]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1507,[215,1487,1490,1488]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1508,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1509,[215,54,1510]); +__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1510,[215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1511,[34,1486]); +__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]}})})},1512,[1513]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1513,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1514,[34,41,102,426,794,847,997,985,2,5,840,1474,1476,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1515,[986,857,856,985]); +__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1516,[798,796,34,1381,1015,402,102,846,985,1007,1014,5,840,794,1287,974,2,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1517,[796,34,236,402,102,840,985,1045,2,25]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1518,[5,796,34,385,283,364,380,236,402,295,426,102,1413,1116,2,900,1100,15,865,794,840,1444,930,1519,1442,1443,1401,1117,1411,929,1465,1452,25,277]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1519,[865,800,1014]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=u(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),k=[],A=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);if(i.includes(c))continue;k.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0});const u='st-jack'===t?{auto:'rota'}:{};d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:f(d,23.5)}:void 0,...u}):d===y&&e<=m&&A.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:f(d,u.auto?e:e-.05),inSite:!0,...u})}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!k.some(e=>e.staffId===t.staffId&&e.date===t.date)),...k],attendance:[...S.attendance,...A]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:f(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:f((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,f=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1520,[848,800,865,1024,15,997,846]); +__d(function(e,o,s,p,t,a,n){"use strict";t.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1521,[]); +__d(function(o,s,e,p,c,t,d){"use strict";c.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1522,[]); +__d(function(o,s,e,p,t,d,f){"use strict";t.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1523,[]); +__d(function(o,s,p,d,e,t,n){"use strict";e.exports="/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1524,[]); +__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]})}},1525,[30,34,846,25]); +__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1526,[1527]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1527,[25,1528,591]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1528,[34,172]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1529,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1530,[25,499,34,270,651]); __r(501); __r(21); __r(0); \ No newline at end of file diff --git a/car-app/index.html b/car-app/index.html index b2633d9592579a5ff9ab4239aacc9b6ea8337318..aad067afffc057492d28ebf120ee91b7052bbb04 100644 --- a/car-app/index.html +++ b/car-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/car-app/owner.html b/car-app/owner.html index cf943724aa16ff8564dc4c03cdbfd51466beb3aa..338eb40b4fff475900ce2c5b984284a1250a1316 100644 --- a/car-app/owner.html +++ b/car-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/car-app/sw.js b/car-app/sw.js index b16b5d5fb923483d0a70a3e3b31ca0ea6061126b..b2f419e338ef1c696cfa40a38d560dd2ae5ad61a 100644 --- a/car-app/sw.js +++ b/car-app/sw.js @@ -1,7 +1,7 @@ // Anchorage car screen service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-car-a74800d200"; +const V = "cc-car-e8f97e3f28"; const BASE = "/car-app/"; -const PRECACHE = ["/car-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/car-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/car-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/car-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/car-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/car-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/car-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/car-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/car-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/car-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/car-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/car-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/car-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/car-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/car-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/car-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/car-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/car-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/car-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/car-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/car-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/car-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/car-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/car-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/car-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/car-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/car-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/car-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=a74800d20032801f15bc11a79b15a15aa1ffd123172ed153506cf0348f39259b"]; +const PRECACHE = ["/car-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/car-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/car-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/car-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/car-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/car-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/car-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/car-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/car-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/car-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/car-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/car-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/car-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/car-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/car-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/car-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/car-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/car-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/car-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/car-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/car-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/car-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/car-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/car-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/car-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/car-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/car-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/car-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=e8f97e3f28f7309cf679bf7e302b48a0039a662217e164f1bf839ccf71bd2b5e"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/car.html b/car.html index c0fede91399bf4db6aad958f6a8e1e7d478db92a..721625b51024f47995c5ac52f6874ad572dea0b0 100644 --- a/car.html +++ b/car.html @@ -6,7 +6,12 @@ The Anchorage · car screen - +

Opening The Anchorage car screen…

Tap here if it doesn’t open

diff --git a/chef-app/_expo/static/js/web/bundle.js b/chef-app/_expo/static/js/web/bundle.js index f5fb5f291c9d1339577871f9b3034ca3efaecd8d..6d77ebb87a6ab4447a46637c7e85d2b911c35b11 100644 --- a/chef-app/_expo/static/js/web/bundle.js +++ b/chef-app/_expo/static/js/web/bundle.js @@ -23,11 +23,11 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_VENUE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PITCH_TEAM",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_TEXT",{enumerable:!0,get:function(){return o}}),e.pitchText=function(a){let n=a;for(const[a,t]of o)a.test(n)?(a.lastIndex=0,n=n.replace(a,t)):a.lastIndex=0;return n};const a={name:'The Harbour Kitchen',tagline:'Harbourside seafood & seasonal plates',location:'12 Quay Street, Portmorran',phone:'01632 960 123',website:'harbourkitchen.example'},n={'st-tracy':{name:'Morgan',job:'Owner',hourlyPence:null,salaried:!0},'st-gordon':{name:'Alex',job:'General Manager',dept:'Management',hourlyPence:null,salaried:!0},'st-bisto':{name:'Ravi',job:'Head Chef',hourlyPence:null,salaried:!0},'st-agate':{name:'Priya',job:'Front of house supervisor',hourlyPence:1450},'st-lenny':{name:'Tom',job:'Commis Chef',hourlyPence:1325},'st-finn':{name:'Lewis',job:'Bar staff',hourlyPence:1290},'st-eilidh':{name:'Chloe',job:'Front of house',hourlyPence:1271},'st-emily':{name:'Ellie',job:'Front of house',hourlyPence:1271},'st-lillie':{name:'Jordan',job:'Kitchen porter (KP)',hourlyPence:1271},'st-jack':{name:'Sam',job:'Kitchen porter (KP)',hourlyPence:1271}},o=[['Harbour View, Dunure, South Ayrshire',a.location],['Harbour View, Dunure',a.location],['Harbour View mug','Harbour Kitchen mug'],['Harbour View','Quay Street'],['anchoragedunure.com',a.website],['01292 502826',a.phone],['Mini Anchors','Little Crew'],['The Anchorage',a.name],['Anchorage','Harbour Kitchen'],['ANCHORAGE','HARBOUR KITCHEN'],['South Ayrshire','the Firth coast'],['Ayrshire','the Firth coast'],['Dunure','Portmorran'],['Kittyfisher boat (Big Sean)','Coastal Fish Co'],['Kittyfisher','Coastal Fish Co'],['Big Sean','Coastal Fish Co'],['Example Fish Co.','Coastal Fish Co'],['Sample Dairy Ltd','Hillside Dairy'],['Sample Fruit & Veg','Fieldfare Veg'],['Mills milk','Hillside Dairy milk'],['Mills','Hillside Dairy'],['J. Pieroni & Sons','Fieldfare Veg'],["Pieroni's",'Fieldfare Veg'],['Pieroni','Fieldfare Veg'],['Alsons (drinks)','Drinks wholesaler'],['Alsons','the drinks wholesaler'],['Spes Bona','the deli wholesaler'],['Tarelgin','the butcher'],['Reids','the bakery'],['Reeds','the bakery'],['Example Butchers Ltd','Quayside Butchers'],['Example Dry Goods Wholesale','Dry goods wholesaler'],['Sample Brewing Co.','Harbourside Brewing'],['Example Cleaning Supplies','Cleaning supplies'],['Sample Packaging Ltd','Packaging supplier'],['Example Kitchen Repairs','Kitchen repairs'],['Preston','Ravi'],['Bisto','Ravi'],['Tracy','Morgan'],['James','Morgan'],['Gordon','Alex'],['Agate','Priya'],['Lenny','Tom'],['Finn','Lewis'],['Eilidh','Chloe'],['Emily','Ellie'],['Gabrielle','Ellie'],['Cameron Mc','Sam'],['Cameron','Sam'],['Lillie','Jordan'],['Lily','Jordan'],['Mia','Jordan'],['Jack','Sam'],['Harvey','Jordan'],['Anna','the supplier'],['(preview)',''],[' (example)','']].map(([a,n])=>[new RegExp(`${/^[A-Za-z]/.test(a)?'(?g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`](_),globalThis.__webpack_require__=o=>{const t=ErrorUtils.reportFatalError;_&&(ErrorUtils.reportFatalError=_=>{throw _});try{return g[`${__METRO_GLOBAL_PREFIX__}__r`](o)}finally{_&&(ErrorUtils.reportFatalError=t)}}},23,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1446,1449]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1447,1450]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},25,[26]); __d(function(g,r,i,a,m,e,d){ /** @@ -41,7 +41,7 @@ __d(function(g,r,i,a,m,e,d){ */ "use strict";var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(t,o,f){var l=null;if(void 0!==f&&(l=""+f),void 0!==o.key&&(l=""+o.key),"key"in o)for(var y in f={},o)"key"!==y&&(f[y]=o[y]);else f=o;return o=f.ref,{$$typeof:n,type:t,key:l,ref:void 0!==o?o:null,props:f}}e.Fragment=t,e.jsx=o,e.jsxs=o},26,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ctx",{enumerable:!0,get:function(){return t}});const t=r(d[0])},27,[28]); -__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1192,1193,1195,1197,1199,1206,1260,1261,1262,1263,1264,1265,1267,1268,1269,1270,1271,1272,1273,1274,1277,1335,1336,1337,1339,1381,1382,1445]); +__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1193,1194,1196,1198,1200,1207,1261,1262,1263,1264,1265,1266,1268,1269,1270,1271,1272,1273,1274,1275,1278,1336,1337,1338,1340,1382,1383,1446]); __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]})}},29,[30,34,792,846,988,25]); __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)},30,[31,32,782,783,785]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},31,[]); @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1159,1160,899,997,1161,1133,1162,1169,1174,1183,1176,1132,1185,1189,1156,848,1190,1130,985,1191,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1160,1161,899,997,1162,1133,1163,1170,1175,1184,1177,1132,1186,1190,1156,848,1191,1130,985,1192,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,899,927,924,840,928,25]); __d(function(g,_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 C.webLine}}),_e.T=R,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return T}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:l=!0,right:o,maxWidth:n=640,footer:s,scroll:c=!0}){const h=(0,S.jsxs)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===k.APP_VARIANT?(0,S.jsx)(D,{}):null]});return(0,S.jsxs)(x.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,S.jsx)(A,{title:t,subtitle:r,back:l,right:o})}),c?(0,S.jsx)(u.default,{contentContainerStyle:{paddingBottom:40},children:h}):(0,S.jsx)(f.default,{style:{flex:1},children:h}),s?(0,S.jsx)(f.default,{style:O.footer,children:(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=z,_e.Card=v,_e.Badge=function({label:e,kind:t="neutral"}){const r={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,S.jsx)(f.default,{style:[O.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:I?'center':'flex-start'}],children:(0,S.jsx)(R,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return E}}),_e.Row=V,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return $}}),_e.Field=function({label:e,...r}){return(0,S.jsxs)(f.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,S.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...r,style:[O.input,r.multiline&&{minHeight:70,textAlignVertical:'top'},r.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:l,sub:o,testID:n,accessibilityLabel:s}){return(0,S.jsxs)(c.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${s??e}${!s&&o?`, ${o}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:r,style:[O.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e.trim()}),o?(0,S.jsx)(R,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:o}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:l,disabled:o,a11y:n}){return(0,S.jsxs)(V,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,S.jsx)(R,{style:{flex:1,flexShrink:1},children:r}),(0,S.jsx)(b.default,{testID:l,disabled:o,accessibilityLabel:n??r,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:r=1,max:l=20,label:o,step:n=1,format:s,testID:u}){const h=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,S.jsxs)(V,{gap:10,children:[(0,S.jsx)(c.default,{testID:u?`${u}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${o??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[O.stepBtn,e<=r?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,S.jsx)(f.default,{testID:u?`${u}-value`:void 0,accessibilityLabel:o?`${o}: ${h}`:h,children:(0,S.jsx)(R,{weight:"semibold",size:p.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:h})}),(0,S.jsx)(c.default,{testID:u?`${u}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${o??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,b(e+n))),style:[O.stepBtn,e>=l?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:r,children:l,maxWidth:n,testID:h,footer:b}){const{height:j}=(0,y.default)(),C=o.default.useContext(x.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},w=Math.max(320,j-C.top-C.bottom-24);return(0,S.jsx)(s.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,S.jsx)(f.default,{style:[O.overlay,{padding:12,paddingTop:12+C.top,paddingBottom:12+C.bottom}],children:(0,S.jsxs)(f.default,{style:[O.sheet,{maxHeight:w},n?{maxWidth:n}:null],testID:h,children:[(0,S.jsxs)(V,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,S.jsx)(P,{style:{flex:1},children:r}),(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:B?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,S.jsx)(R,{size:B?18:24,colour:p.colours.text,children:B?'Close':'\u2715'})})]}),(0,S.jsx)(u.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:l}),b?(0,S.jsx)(f.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:h?`${h}-footer`:void 0,children:b}):null]})})})},_e.SectionTitle=function({children:e}){return(0,S.jsx)(R,{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 O}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),l=_r(d[3]),o=e(_r(d[4])),n=e(_r(d[5])),s=e(_r(d[6]));_r(d[7]);var c=e(_r(d[8])),u=e(_r(d[9])),h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=_r(d[14]),p=_r(d[15]),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),k=_r(d[19]),W=_r(d[20]),S=_r(d[21]);const B=['kirkton','abbotsford'].includes(w.VENUE_RID),I='display'!==k.APP_VARIANT;function R({children:e,style:r,size:l=p.font.body,weight:o="regular",colour:n=p.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:b,accessibilityLabel:f}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,w=h.default.flatten(r)||{},k=1===w.flex||1===w.flexGrow||'number'==typeof w.width||'left'===w.textAlign,W=c??(I&&('semibold'===o||'bold'===o)&&!k);return(0,S.jsx)(t.Text,{testID:u??(y?'cc-url':void 0),...W?{dataSet:{centre:'heading'}}:{},accessibilityRole:b,accessibilityLabel:f,numberOfLines:s,style:[{minWidth:0,fontFamily:p.fonts[o],fontSize:l,color:n,lineHeight:(0,j.lineFor)(l)},W&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},r,x,(0,C.webLine)(r,l),W&&'left'!==w.textAlign?{textAlign:'center'}:null],children:e})}const L=e=>(0,S.jsx)(R,{size:p.font.title,weight:"semibold",center:!0,...e}),P=e=>(0,S.jsx)(R,{size:p.font.large,weight:"semibold",center:!0,...e}),T=e=>(0,S.jsx)(R,{colour:p.colours.muted,size:p.font.small,...e,center:e.center??I});function A({title:e,back:t=!0,right:l,subtitle:o}){return(0,S.jsxs)(f.default,{style:O.brandBar,children:[(0,S.jsxs)(f.default,{style:O.row,children:[(0,S.jsx)(f.default,{style:O.brandSide,children:t?(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>r.router.canGoBack()?r.router.back():r.router.replace(k.ENTRY[k.APP_VARIANT]),style:O.backBtn,hitSlop:10,children:(0,S.jsx)(R,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,S.jsx)(c.default,{onPress:()=>r.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:O.brandCenter,children:(0,S.jsx)(W.RestaurantBrand,{size:W.HEADER_LOGO})}),(0,S.jsx)(f.default,{style:[O.brandSide,{alignItems:'flex-end'}],children:l?(0,S.jsx)(f.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,S.jsx)(L,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,S.jsx)(T,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function D(){const e=(0,r.useLocalSearchParams)().rid??w.VENUE_RID,t=(0,l.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,S.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{n.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,S.jsx)(R,{center:!0,size:14,colour:p.colours.gold,children:t})}):null}function z({label:e,sub:t,onPress:r,kind:l="primary",disabled:o,small:n,style:s,accessibilityLabel:u,accessibilityHint:h,testID:b}){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],x={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,S.jsxs)(c.default,{testID:b,accessibilityRole:"button",accessibilityLabel:u??e,accessibilityHint:h,accessibilityState:{disabled:!!o},disabled:o,onPress:r,style:({pressed:e})=>[O.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:x,opacity:o?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:j.control.min,minWidth:44},s],children:[(0,S.jsx)(R,{weight:"semibold",size:n?p.font.small:p.font.body,colour:y,center:!0,children:e.trim()}),t?(0,S.jsx)(R,{size:n?p.font.small-2:p.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function v({children:e,style:t,onPress:r,highlight:l}){const o=l===p.colours.gold||l===p.colours.accentBorder,n=(0,S.jsx)(f.default,{testID:"cc-card",style:[O.card,{alignItems:'stretch'},l?{borderColor:o?p.colours.accentBorder:l,borderWidth:o?1:2}:null,t],children:e});return r?(0,S.jsx)(c.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function F({kind:e="info",title:t,children:r}){const l={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,S.jsxs)(f.default,{accessibilityRole:"summary",style:[O.banner,{backgroundColor:l[0],borderLeftColor:l[1]}],children:[t?(0,S.jsx)(R,{weight:"semibold",colour:l[2],center:!0,children:t}):null,o.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,S.jsx)(R,{size:p.font.small,colour:l[2],center:!0,children:r}):r]})}T.statusLine=!0,z.centreRow=!0;const H=()=>(0,S.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."}),E=()=>(0,S.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function V({children:e,style:t,gap:r=8,wrap:l}){const n=o.default.Children.map(e,e=>{if(!o.default.isValidElement(e))return e;const t=e,r=h.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:o.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===v?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),s=h.default.flatten(t)||{},c=o.default.Children.toArray(n).filter(o.default.isValidElement),u=e=>e.type;if(I&&'space-between'===s.justifyContent&&1!==s.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,S.jsx)(f.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const b=I&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==s.justifyContent&&'space-between'!==s.justifyContent;return(0,S.jsx)(f.default,{...b?{dataSet:{centre:'buttons'}}:{},style:[O.row,{gap:r},b&&{justifyContent:'center',flexWrap:'wrap'},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:n})}const $=()=>(0,S.jsx)(f.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const O=h.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},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:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:j.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:j.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',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,boxSizing:'border-box',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:{maxWidth:'100%',flexShrink:0,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:j.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}})},794,[795,796,30,800,34,379,395,236,402,295,41,410,102,426,36,840,844,845,5,846,847,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -945,7 +945,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},862,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},863,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},864,[]); -__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 h}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return g}}),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 S}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return v}}),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 D}}),_e.openShiftOf=T,_e.loggedBreakMins=$,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 U}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return x}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return F}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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',h=e=>!!e.out&&!!e.signOff,g={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},y=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return b(new Date(a,n-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),S=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),E=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],R=1271,v=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,D=[{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 T(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function $(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-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 B=()=>{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:{},chatRead:{},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:D.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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},U=(0,u.create)()((0,f.persist)((e,a)=>({...B(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:a,job:n,active:!0,level:q[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}: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,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}: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,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=y(t,e),o=y(n,e);i.shifts.filter(e=>e.date===a&&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 a=y(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,a)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??$({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=T(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:$({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),g.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,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>g.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};g.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(B()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=j().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,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=B();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}})),V=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,q={owner:'Owner',manager:'Manager',staff:'Staff'},x={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 K=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,a)=>a.indexOf(e)===t),W=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=K(e);return n.includes(a)||n.includes(a.split(' ')[0])},F=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return $}}),_e.openShiftOf=P,_e.loggedBreakMins=A,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return W}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return H}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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,t,a)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=a&&a<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,k={send:null},y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,I=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},w=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return y(new Date(a,n-1,i+t))},S=e=>w(e,-I(e)),E=(e,t)=>e.filter(e=>e.date===t),O=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),R=(e,t)=>t?e:e.filter(e=>e.published),v=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],_=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,$=[{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 P(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function A(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),M=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,N=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function C(){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,...B.includes(e.id)?{displayClock:!0}:{}}))}const B=['st-jack'];function U(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const V=()=>{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:{},chatRead:{},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:$.map(e=>({...e})),workEmail:'',staff:C(),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:U(),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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},q=(0,u.create)()((0,f.persist)((e,a)=>({...V(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:M('st'),name:t,role:a,job:n,active:!0,level:K[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:M('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:M('ph'),caption:t,tone:N[e.photos.length%N.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:M('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:M('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:M('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:M('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:M('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:I(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:I(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=w(t,e),o=w(n,e);i.shifts.filter(e=>e.date===a&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!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:I(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 a=w(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const a={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[a,...e.leave]})),a},setLeave:(t,n)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)}));const i=a().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:M('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??A({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:M('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=P(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:A({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:M('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),k.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:M('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:M('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};k.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(V()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=C().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,hourly:{...e.hourly,...U()},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=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=V();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=S(y(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:w(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}})),x=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,K={owner:'Owner',manager:'Manager',staff:'Staff'},W={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 F=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,a)=>a.indexOf(e)===t),G=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=F(e);return n.includes(a)||n.includes(a.split(' ')[0])},H=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},866,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},867,[]); __d(function(s,t,r,i,c,e,a){"use strict";c.exports={uri:"/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},868,[]); @@ -1065,7 +1065,7 @@ __d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModul __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},982,[804]); __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 u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).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 u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),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(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};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 u=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):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},983,[982]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return c.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const c=e.IS_CAR?b[n]:'nolink'===n&&'display'===e.APP_VARIANT?p:f[n];return(0,h.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${c}`,style:{borderRadius:16,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface,padding:14,gap:4},children:[(0,h.jsx)(u.T,{size:12,weight:"semibold",colour:l.colours.goldMuted,children:o.toUpperCase()}),(0,h.jsx)(u.T,{size:18,weight:"semibold",children:c})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]);const f={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},p="This Display isn't paired yet. Tap Not paired to pair it.",b={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when the car is back online.',nolink:'Not connected yet. Check the car has internet. If this stays, sign the car in again from Managers on your phone.'}},984,[846,34,102,985,2,840,794,25]); -__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return he}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),It(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=he.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Gt,i.readAccessLog=async function(){const e=he.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Qt}}),i.uploadOrderLogo=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Qt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=Jt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Qt).createSignedUrl(e,3600);if(t?.signedUrl)return Jt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Qt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return zt}}),i.claimInvite=ca,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(na,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ia,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=he.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=he.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(na),await T.kv.remove(ia),Se({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=he.getState().venueId;if(ae.PITCH||!s||'staff'!==he.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await ma('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'}}},i.claimInviteForSync=async function(e){const t=await ca(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return await ma('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return ma('staff_app_link_history',{p_venue:he.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await ma('revoke_staff_app_link',{p_venue:he.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=he.getState().venueId;if(!e||'staff'!==he.getState().kind)return{};try{const t=await ma('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return Number(await ma('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=he.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(sa,n),Sa(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(la,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:fa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(la,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(na,null);await T.kv.set(na,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||Sa()}return'revoked'!==i&&'unknown'!==i||await pa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await pa(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}Se({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await ma('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:fa(e)}}},i.carList=async function(){const e=he.getState().venueId;if(!e)return[];return(await ma('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await ma('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:fa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(sa),await ha();try{await _e().auth.signOut()}catch{}Se({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(na),await T.kv.remove(ia),await ha();try{await _e().auth.signOut()}catch{}Se({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Se({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ga,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return ma}}),i.mendSession=ya,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,wa=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,h.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,h.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Se({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 Ka(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void Se({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void Se({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];Se({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>Se({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>Se({mode:e?he.getState().venueId?'live':he.getState().mode:he.getState().venueId?'offline':he.getState().mode}))),await va()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ua}}),i.goLive=Ea,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ga}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Va.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Va.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),ma('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Ue(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Ue(a.from_time),to:Ue(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Va.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ga.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Va.get(a);e&&!e.ok&&Va.delete(a)}));const n=Va.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=he.getState().venueId;if(!n||'staff'!==he.getState().kind)throw new Error('Connect to your venue first.');const i=await ma('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),h=t(r[10]),S=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),D=t(r[21]),U=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),j=t(r[34]),B=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,U.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const he=(0,D.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Se=e=>he.setState(e),ye=e=>{const t=he.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=he.getState().mode;return'live'===e||'offline'===e||'connecting'===e};he.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),De=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Ue=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=De(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=De(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==he.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(j.useFloor.getState().plans[e]??(0,j.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:he.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&j.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>j.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>B.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>B.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>B.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>B.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(B.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==he.getState().kind&&('device'!==he.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>B.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>B.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(B.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={...B.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;B.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{B.useShellStore.getState().server[e]||B.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const je=new Set;function Be(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,h.isAnchorage)(e)&&(0,h.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,h.isAnchorage)(e)&&(s={...s,signOff:(0,h.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,h.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,h.isAnchorage)(e)&&(0,h.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,h.isAnchorage)(e)&&(0,h.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!je.has(e)){je.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){je.delete(e),Se({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,D.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==he.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,h.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${he.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=De(62),t=e=>ye('rota.manage')||e.staffId===he.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,S.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,S.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=De(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===he.getState().staffRef&&'open'===e.status,writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===he.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const gt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function mt(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function _t(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:j.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:gt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...St??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...St?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...St?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},St=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&j.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&mt(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=j.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,St=null;const yt=()=>new Date(Date.now()-2592e6).toISOString(),wt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},vt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},bt=()=>he.getState().perms.includes('*');function kt(){const e=()=>he.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!wt(t.ch)&&(t.from===e()||bt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('created_at',yt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=yt(),toRow:(e,t)=>{const a=wt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=vt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=vt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function It(e,t,a){const s=he.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':wt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Ot(e){const t=he.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':vt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function Rt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function At(e){const t=De(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===he.getState().staffRef,writable:()=>'staff'===he.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ut=e=>null==e||''===e?null:Number(e),Ct=e=>e.filter(e=>!e.startsWith('data:'));function Et(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',De(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Ct(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Tt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Ct(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Nt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function Mt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',De(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function xt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ut(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function Kt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function qt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Lt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function Pt(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===he.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:he.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function $t(e){const t=De(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,S.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Bt(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===he.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ft(e){const t=De(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=he.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===he.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Wt(e,t=!1){const a=De(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Ht(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Vt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Gt(){const e=he.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Qt='order-list-logos';const Jt=new Map;const zt=(0,D.create)(()=>({live:!1,known:!1}));async function Zt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const Xt=(e,t)=>Ee({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)}),ea='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function ta(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Xt(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function aa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ea).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Xt(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const sa='pair:v1',na='staff:v1',ia='staff:rejoin:v1';async function ra(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function oa(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ia,null);if(!e)return'none';try{await ua();const{data:t,error:a}=await ra(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ia),await T.kv.remove(na),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(na,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ia),'refused')}catch{return'offline'}}const da=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 ua(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}Se({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 ca(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ua();const{data:t,error:a}=await ra(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(na,n),await T.kv.set(ia,e),Re&&Sa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Se({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const la='car:request:v1',fa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function pa(){await T.kv.remove(na),await T.kv.remove(la),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ga(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ua(),!0}catch{return!1}}const ma=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let _a=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],_a&&(clearInterval(_a),_a=null)}async function Sa(){await ha(),await va()}async function ya(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ia,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await oa()&&(Sa(),!0)}catch{return!1}}(0,d.setSessionMender)(ya);let wa=o.VENUE_RID;async function va(){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 e=wa;try{if(Se({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Oa(e);const t=await T.kv.get(sa,null);let a=await T.kv.get(na,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await oa();if('offline'===t)return Se({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{wa===e&&Sa()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(na,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void Se({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await ma('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(sa):(await T.kv.remove(na),await T.kv.remove(ia)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))Se({mode:'offline'});else if(da(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await oa()&&setTimeout(()=>{wa===e&&Sa()},500)}i=he.getState().perms}Se({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await ka(n.venueId,e,n.kind)}catch(e){Se({mode:'local',lastError:String(e?.message??e)})}}const ba=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 ka(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ea(a),Oe.push(Ha(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[_t(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Wa()},onRemote:()=>{Wa()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[wa]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[wa],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&&V.useSetup.getState().patch(wa,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[wa]?.staffGrade!==a.sites[wa]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Be(a),La(a)];ye('wages.view')&&n.push(Pa(a)),'staff'===s&&(n.push(ut(),ct(),lt(),pt(a)),ft(e));const i='staff'===s&&await Yt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(kt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Vt('hr_questions')&&(n.push(ta(a)),ba.add('hr_questions'),aa(e,a)),'guest'!==s&&await Vt('sold_out_items')?(n.push(Wt(a,await Vt('sold_out_items','auto'))),ba.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Vt('sold_out_links')?(n.push(Ht(a)),ba.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Zt()&&(n.push(Rt(a)),'staff'===s&&n.push(At(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Vt('staff','nickname'),Ze=await Vt('staff','display_clock');const[e,t,s,i]=await Promise.all([Vt('scheduled_notifications'),Vt('order_lists'),Vt('venue_clock_area'),Vt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Bt(a),Ft(a)),ba.add('daily_tasks'),ba.add('daily_task_ticks')),e&&(n.push(qt(a)),Gt()),t&&n.push(Lt(a),Pt(a),$t(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ba.add(n)}if('guest'!==s&&await Vt('day_tips')){n.push(Mt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ba.add(e);await Vt('tips_pot_events')&&n.push(xt(a),Kt(a)),'staff'===s&&(n.push(Et(a),Tt(a),Nt(a)),ba.add('cash_ups'),ba.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Vt('scheduled_notifications')&&n.push(qt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Vt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ba.add('ingredient_prices'),await Vt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ba.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Vt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ba.add('specials_boards'));const c={onActivity:()=>Se({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Se({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Se({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await ma('whoami')??[]).some(t=>t.venue_id===e))return void(wa===a&&Sa());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await ma('whoami');if(!t?.some(t=>t.venue_id===e))return void(wa===a&&Sa())}catch(e){if(da(e)){const e=await oa();return void('ok'!==e&&'refused'!==e||wa===a&&Sa())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Ot(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(Se({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):Se({mode:'offline'}),!ye('wages.view')){const e=he.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ba.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const h=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);Se({lastSyncAt:(new Date).toISOString()})},e=>{Se({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(h)}),_a=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...he.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Ia='guest:sent:v1';async function Oa(e){Se({kind:'guest',venueSlug:e,perms:[]});try{const t=(await ma('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){Se({venueId:t.id,venueName:t.name}),await Ea(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),mt(e,t.app?.events)}await Ra(e),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Se({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Ra(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Aa(e)}async function Ra(e){const t=await ma('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Aa(e){let t=await T.kv.get(Ia,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ga())return;for(const a of n)try{const s=(await ma('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await ma('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Order: ${e?.message}`}))}await T.kv.set(Ia,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await ma('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Ia,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await ma('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Se({mode:(0,E.isOnline)()?he.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),_a=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ua={bridges:()=>Ie,restart:Sa},Ca='golive:v1:';async function Ea(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await Ka(e):(await T.kv.get(Ca+e,!1)||await Ka(e),await T.kv.get(Ma+e,!1)||(xa(e),await T.kv.set(Ma+e,!0)),await T.kv.get(Ta+e,!1)||(Na(),await T.kv.set(Ta+e,!0)))}const Ta='golive:v3:';function Na(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 Ma='golive:v2:';function xa(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 Ka(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,h.isDemoCard)(e)),log:m.log.filter(e=>!(0,h.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ca+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),j.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:[],swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ca+e,!0)}const qa=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function La(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(j.useFloor.getState().live[e]??{}).map(([e,t])=>qa(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===he.getState().kind||ye('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:he.getState().staffRef??ve}),fromRow:e=>qa(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>j.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>j.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Pa(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const $a='staff-avatars',ja=new Map;let Ba=!1;const Fa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Wa(){if(!Ba){Ba=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===he.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from($a).download(t);if(n||!s)continue;const i=await Fa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ba=!1}}}function Ha(e){const t=async()=>{const t=he.getState().staffRef,a=t?Ye.get(t)??he.getState().staffUuid:void 0;if(!t||!a||'staff'!==he.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from($a).remove([t]).catch(()=>{})};if(!s)return void(n&&(await ma('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Se({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 _e().storage.from($a).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await ma('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Se({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==he.getState().staffRef){const e=s[t].path;ja.set(t,null),ma('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from($a).remove([e])).catch(()=>{})}});return t(),s}const Va=new Map,Ga=(0,D.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),Ot(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=Se.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(Zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Qt,i.readAccessLog=async function(){const e=Se.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Jt}}),i.uploadOrderLogo=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Jt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=zt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Jt).createSignedUrl(e,3600);if(t?.signedUrl)return zt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Jt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return Zt}}),i.claimInvite=la,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(ia,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ra,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(ia),await T.kv.remove(ra),he({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Se.getState().venueId;if(ae.PITCH||!s||'staff'!==Se.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await _a('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'}}},i.claimInviteForSync=async function(e){const t=await la(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return _a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return await _a('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),_a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return _a('staff_app_link_history',{p_venue:Se.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await _a('revoke_staff_app_link',{p_venue:Se.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=Se.getState().venueId;if(!e||'staff'!==Se.getState().kind)return{};try{const t=await _a('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return Number(await _a('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=Se.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(na,n),ya(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(fa,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:pa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(fa,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(ia,null);await T.kv.set(ia,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||ya()}return'revoked'!==i&&'unknown'!==i||await ga(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await ga(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}he({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await _a('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:pa(e)}}},i.carList=async function(){const e=Se.getState().venueId;if(!e)return[];return(await _a('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await _a('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:pa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(na),await ha();try{await _e().auth.signOut()}catch{}he({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(ia),await T.kv.remove(ra),await ha();try{await _e().auth.signOut()}catch{}he({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}he({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ma,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return _a}}),i.mendSession=wa,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,va=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,S.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,S.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void he({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 qa(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void he({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void he({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];he({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>he({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>he({mode:e?Se.getState().venueId?'live':Se.getState().mode:Se.getState().venueId?'offline':Se.getState().mode}))),await ba()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ca}}),i.goLive=Ta,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Qa}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Ga.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Ga.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),_a('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:De(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:De(a.from_time),to:De(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Ga.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Qa.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ga.get(a);e&&!e.ok&&Ga.delete(a)}));const n=Ga.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Se.getState().venueId;if(!n||'staff'!==Se.getState().kind)throw new Error('Connect to your venue first.');const i=await _a('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),U=t(r[21]),D=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),B=t(r[34]),j=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,D.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const Se=(0,U.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),he=e=>Se.setState(e),ye=e=>{const t=Se.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=Se.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Se.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),Ue=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),De=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=Ue(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=Ue(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Se.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(B.useFloor.getState().plans[e]??(0,B.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:Se.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&B.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>B.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>j.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>j.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>j.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>j.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(j.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Se.getState().kind&&('device'!==Se.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>j.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>j.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(j.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={...j.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;j.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{j.useShellStore.getState().server[e]||j.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const Be=new Set;function je(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,S.isAnchorage)(e)&&(0,S.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,S.isAnchorage)(e)&&(s={...s,signOff:(0,S.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,S.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,S.isAnchorage)(e)&&(0,S.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,S.isAnchorage)(e)&&(0,S.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!Be.has(e)){Be.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Be.delete(e),he({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,U.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==Se.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,S.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${Se.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=Ue(62),t=e=>ye('rota.manage')||e.staffId===Se.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,h.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,h.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=Ue(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===Se.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.leaveRemote.decide=t=>!(!ye('rota.manage')||!(0,z.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(K.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),Oe.push(()=>{J.leaveRemote.decide=null})}function pt(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function gt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Se.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const mt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function _t(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function St(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:B.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...yt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...yt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...yt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},yt=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&B.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&_t(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=B.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,yt=null;const wt=()=>new Date(Date.now()-2592e6).toISOString(),vt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},bt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},kt=()=>Se.getState().perms.includes('*');function It(){const e=()=>Se.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!vt(t.ch)&&(t.from===e()||kt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('created_at',wt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=wt(),toRow:(e,t)=>{const a=vt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=bt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=bt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Ot(e,t,a){const s=Se.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':vt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Rt(e){const t=Se.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':bt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function At(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Ut(e){const t=Ue(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===Se.getState().staffRef,writable:()=>'staff'===Se.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ct=e=>null==e||''===e?null:Number(e),Et=e=>e.filter(e=>!e.startsWith('data:'));function Tt(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',Ue(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Et(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Nt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Et(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Mt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function xt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',Ue(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.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:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ct(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function qt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Lt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Pt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function $t(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Se.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Se.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Bt(e){const t=Ue(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,h.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Ft(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===Se.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Wt(e){const t=Ue(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Se.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===Se.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Ht(e,t=!1){const a=Ue(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Vt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Gt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Qt(){const e=Se.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();Zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Jt='order-list-logos';const zt=new Map;const Zt=(0,U.create)(()=>({live:!1,known:!1}));async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Xt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const ea=(e,t)=>Ee({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)}),ta='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function aa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ea(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function sa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ta).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ea(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const na='pair:v1',ia='staff:v1',ra='staff:rejoin:v1';async function oa(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function da(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ra,null);if(!e)return'none';try{await ca();const{data:t,error:a}=await oa(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ra),await T.kv.remove(ia),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(ia,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ra),'refused')}catch{return'offline'}}const ua=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 ca(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}he({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 la(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ca();const{data:t,error:a}=await oa(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(ia,n),await T.kv.set(ra,e),Re&&ya(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return he({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const fa='car:request:v1',pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function ga(){await T.kv.remove(ia),await T.kv.remove(fa),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ma(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ca(),!0}catch{return!1}}const _a=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let Sa=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],Sa&&(clearInterval(Sa),Sa=null)}async function ya(){await ha(),await ba()}async function wa(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ra,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await da()&&(ya(),!0)}catch{return!1}}(0,d.setSessionMender)(wa);let va=o.VENUE_RID;async function ba(){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 e=va;try{if(he({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Ra(e);const t=await T.kv.get(na,null);let a=await T.kv.get(ia,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await da();if('offline'===t)return he({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{va===e&&ya()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(ia,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void he({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await _a('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(na):(await T.kv.remove(ia),await T.kv.remove(ra)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))he({mode:'offline'});else if(ua(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await da()&&setTimeout(()=>{va===e&&ya()},500)}i=Se.getState().perms}he({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await Ia(n.venueId,e,n.kind)}catch(e){he({mode:'local',lastError:String(e?.message??e)})}}const ka=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 Ia(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ta(a),Oe.push(Va(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[St(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ha()},onRemote:()=>{Ha()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[va]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[va],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&&V.useSetup.getState().patch(va,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[va]?.staffGrade!==a.sites[va]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},je(a),Pa(a)];ye('wages.view')&&n.push($a(a)),'staff'===s&&(n.push(ut(),ct(),lt(),gt(a)),pt(e)),'staff'===s&&await Gt('staff_leave')&&(n.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Se.getState().staffRef&&'pending'===e.status||ye('rota.manage')),writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:Ee(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),ka.add('staff_leave'),ft(e));const i='staff'===s&&await Xt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(It(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Gt('hr_questions')&&(n.push(aa(a)),ka.add('hr_questions'),sa(e,a)),'guest'!==s&&await Gt('sold_out_items')?(n.push(Ht(a,await Gt('sold_out_items','auto'))),ka.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Gt('sold_out_links')?(n.push(Vt(a)),ka.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Yt()&&(n.push(At(a)),'staff'===s&&n.push(Ut(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Gt('staff','nickname'),Ze=await Gt('staff','display_clock');const[e,t,s,i]=await Promise.all([Gt('scheduled_notifications'),Gt('order_lists'),Gt('venue_clock_area'),Gt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Ft(a),Wt(a)),ka.add('daily_tasks'),ka.add('daily_task_ticks')),e&&(n.push(Lt(a)),Qt()),t&&n.push(Pt(a),$t(a),Bt(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ka.add(n)}if('guest'!==s&&await Gt('day_tips')){n.push(xt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ka.add(e);await Gt('tips_pot_events')&&n.push(Kt(a),qt(a)),'staff'===s&&(n.push(Tt(a),Nt(a),Mt(a)),ka.add('cash_ups'),ka.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Gt('scheduled_notifications')&&n.push(Lt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Gt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ka.add('ingredient_prices'),await Gt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ka.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Gt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ka.add('specials_boards'));const c={onActivity:()=>he({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>he({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{he({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await _a('whoami')??[]).some(t=>t.venue_id===e))return void(va===a&&ya());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await _a('whoami');if(!t?.some(t=>t.venue_id===e))return void(va===a&&ya())}catch(e){if(ua(e)){const e=await da();return void('ok'!==e&&'refused'!==e||va===a&&ya())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Rt(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(he({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):he({mode:'offline'}),!ye('wages.view')){const e=Se.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ka.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);he({lastSyncAt:(new Date).toISOString()})},e=>{he({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(S)}),Sa=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...Se.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Oa='guest:sent:v1';async function Ra(e){he({kind:'guest',venueSlug:e,perms:[]});try{const t=(await _a('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){he({venueId:t.id,venueName:t.name}),await Ta(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),_t(e,t.app?.events)}await Aa(e),he({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{he({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Aa(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Ua(e)}async function Aa(e){const t=await _a('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Ua(e){let t=await T.kv.get(Oa,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ma())return;for(const a of n)try{const s=(await _a('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await _a('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Order: ${e?.message}`}))}await T.kv.set(Oa,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await _a('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Oa,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await _a('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),he({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{he({mode:(0,E.isOnline)()?Se.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),Sa=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ca={bridges:()=>Ie,restart:ya},Ea='golive:v1:';async function Ta(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await qa(e):(await T.kv.get(Ea+e,!1)||await qa(e),await T.kv.get(xa+e,!1)||(Ka(e),await T.kv.set(xa+e,!0)),await T.kv.get(Na+e,!1)||(Ma(),await T.kv.set(Na+e,!0)))}const Na='golive:v3:';function Ma(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 xa='golive:v2:';function Ka(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 qa(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,S.isDemoCard)(e)),log:m.log.filter(e=>!(0,S.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ea+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),B.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:e.leave.filter(e=>(0,z.isUuid)(e.id)),swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ea+e,!0)}const La=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Pa(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(B.useFloor.getState().live[e]??{}).map(([e,t])=>La(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Se.getState().kind||ye('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:Se.getState().staffRef??ve}),fromRow:e=>La(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>B.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>B.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function $a(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ba='staff-avatars',ja=new Map;let Fa=!1;const Wa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ha(){if(!Fa){Fa=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Se.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from(Ba).download(t);if(n||!s)continue;const i=await Wa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Fa=!1}}}function Va(e){const t=async()=>{const t=Se.getState().staffRef,a=t?Ye.get(t)??Se.getState().staffUuid:void 0;if(!t||!a||'staff'!==Se.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from(Ba).remove([t]).catch(()=>{})};if(!s)return void(n&&(await _a('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void he({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 _e().storage.from(Ba).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await _a('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){he({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Se.getState().staffRef){const e=s[t].path;ja.set(t,null),_a('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from(Ba).remove([e])).catch(()=>{})}});return t(),s}const Ga=new Map,Qa=(0,U.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=O,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return b}}),_e.useGpCalcView=function(){const e=b();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...O(e)}:e,[e])},Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return v}}),_e.gpSyncItems=E,_e.gpSyncFromRow=P,_e.mergeGpItems=w,_e.gpSyncSpec=function(e,t){const i='ing'===e?'ingredient_prices':'card_costs';return{name:i,table:i,deletes:!1,list:()=>E(b.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:C(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>P(e,t),apply:(t,i)=>b.setState(n=>w(n,e,t,i)),subscribe:t=>b.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i.cardCosts===n.cardCosts)||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),r=(e=a)&&e.__esModule?e:{default:e},d=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,t,i,n,s,a=0,r=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:a,allergens:r}),m=e=>new Date(Date.now()-864e5*e).toISOString(),S={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},k=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...h('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...h('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(S[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:m(7*(i.length-t))}))})),y=(e,t,i,n,s,a,r,d="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:a,status:r,description:d,allergens:[]}),I=[y('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),y('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),y('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),y('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),y('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),y('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function O(e){const t=e=>I.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),a=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),r=e=>{const t=k.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},d=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(d).forEach(e=>e.lines.forEach(e=>a.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>a.has(e.id)||!r(e)),cardCosts:d}}const b=(0,d.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:k,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),a=n.ingredients.map(e=>e.id===t.id?t:e);let r=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,a,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(d(t)-d(s))/d(s)*100;i.length&&(r=[{id:f('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...r].slice(0,20))}const d=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:d?a.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):a,alerts:r})},addPricePaid:(e,t,n)=>{const s=i(),a=s.ingredients.find(t=>t.id===e);if(!(a&&t>0))return;const r=[...a.prices?.length?a.prices:[{p:a.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),d={...a,prices:r};i().saveIngredient({...d,packPrice:(0,o.costingPrice)(d,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=f('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)}))}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>r.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...O({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&b.persist.rehydrate()});const v='1970-01-01T00:00:00.000Z',C=e=>JSON.parse(JSON.stringify(e));function E(e,t){const i=O(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??v,doc:C({...e,updatedAt:e.updatedAt??v})})):Object.entries(i.cardCosts).map(([e,t])=>({id:e,updatedAt:t.updatedAt??v,doc:C({...t,updatedAt:t.updatedAt??v})})),s=new Set(n.map(e=>e.id)),a=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...a]}function P(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('card'!==e||Array.isArray(s.lines))?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function w(e,t,i,n){const s={...e.gone??{}},a=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e.cardCosts??{})),r=[];for(const e of i){const i=`${t}:${e.id}`,n=a.get(e.id),d=n?n.updatedAt??v:void 0,c=s[i];if(e.deletedAt){if(n&&d>e.deletedAt)continue;a.delete(e.id),(!c||ce.updatedAt)continue;if(n&&d>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?a.set(e.id,o):r.push([e.id,o]),delete s[i]}for(const e of n)a.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...a.values(),...r.map(([,e])=>e)],gone:s}}return{cardCosts:Object.fromEntries([...a.entries(),...r]),gone:s}}},986,[806,34,807,5,808,815,818,987,832,839]); __d(function(_g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return i}}),e.priceStats=c,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return o}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return l}}),e.convert=function(t,n,i){const c=u[n],o=u[i];return c&&o&&c.dim===o.dim?t*c.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return d}}),e.perBaseUnit=function(t){const n=u[t.packUnit];if(!(n&&t.packSize>0))return null;const i=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/i*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/i*1e3,per:'litre'}:{pence:t.packPrice/i,per:'item'}},Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return g}}),e.lineCost=m,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return p}}),e.suggestAllergens=function t(n,i,c=[],o=0){const s=new Set;for(const u of n.lines)if(u.ingId.startsWith('dish:')){const n=c.find(t=>t.id===u.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>s.add(t)),t(n,i,c,o+1).forEach(t=>s.add(t)))}else i.find(t=>t.id===u.ingId)?.allergens?.forEach(t=>s.add(t));return[...s]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:h(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return S}}),e.suggestForMultiple=function(t,n,i,c,o){const s=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?b(Math.ceil(s)):Math.ceil(s)},e.amountLabel=k,e.cardCostSummary=function(t,n,i,c){const o=(t?.lines??[]).map(t=>{const i=n.find(n=>n.id===t.ingId);return{line:t,name:i?.name??'Removed ingredient',cost:m(t,n),label:k(t,i)}}),s=o.reduce((t,n)=>t+n.cost,0),u=Math.max(1,t?.portions||1),a=s/u,l=t?.target??i.defaultTarget??70,f=a>0?y(a,l,i.vatPct,i.pricePoints):null,d=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,g=d??(c&&c>0?c:f),p=g&&a>0?P(a,g,i.vatPct):null;return{lines:o,batch:s,perPortion:a,target:l,suggested:f,price:g,priceIsSuggested:!(d||c&&c>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,l):null,missing:o.filter(t=>t.cost<=0).length}};var t=r(_d[0]);const n=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],i=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function c(t,n=5){const c=i(t),o=c.slice(-Math.max(1,n)),s=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:s,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",i=5)=>'average'===n?c(t,i).avg:c(t,i).latest;const s={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},u={kg:{dim:'mass',f:s.kg},g:{dim:'mass',f:s.g},oz:{dim:'mass',f:s.oz},lb:{dim:'mass',f:s.lb},stone:{dim:'mass',f:s.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=['kg','g','stone','lb','oz','L','ml','each'],l=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const f=(t,n)=>[...'mass'===u[t].dim?['g','kg','oz','lb']:'vol'===u[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],d=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;const g=(t,n)=>{const i=(t?.servingName||'serving').trim().toLowerCase();return 1===n?i:/(s|sh|ch|x)$/.test(i)?`${i}es`:`${i}s`};function m(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?p(o,n,i,c+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=d(o);return null==n?0:t.qty*n}const s=u[o.packUnit],a=u[t.unit];if(!a||s.dim!==a.dim)return 0;const l=o.packPrice/(o.packSize*s.f),f=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*a.f*l/(1-f/100)}const p=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+m(o,n,i,c),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,i){const c=h(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}}function b(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}function y(t,n,i,c){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+i/100);return c?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const S=t=>`${t.toFixed(1)}x`;function k(t,n){const i=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${i} ${g(n,t.qty)}`:'each'===t.unit?`${i} ${1===t.qty?'item':'items'}`:`${i} ${l(t.unit,t.qty)}`}},987,[982]); __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 f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});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:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},988,[]); @@ -1088,7 +1088,7 @@ __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1006,[975]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1007,[1003,975,1008]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1009,[]); __d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return v}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class v{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=c(t),this.saveKnown())})}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=s.get(e);if(!this.pending(e)){if(f){const t=c(f);if(this.rev(f)===this.rev(h)){this.known[e]=l,t!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(h),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,h.length>l&&!f)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||e.syncable(s)&&e.writable()&&this.known[n]!==t&&!this.pending(n)&&this.write(s)}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1010,[1005,931,1003,975,1007]); __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 b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);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??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`: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}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},1011,[829,808,839,815,818,827,1012,1013]); @@ -1122,7 +1122,7 @@ __d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},1038,[1039]); __d(function(g,r,i,a,m,e,d){function n(n,t){const o=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o,s){const u=()=>r.importAll(t,s);{const l=o?.[String(t)];if(Array.isArray(l)){const c=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(c?.isReady?.(l))return u();const f=n(t,o);if(null!=f)return f.then(u);throw new Error(`Cannot import module ${s??t}: the async bundle loader is unavailable. Load the initial Expo bundle before importing these chunks: ${l.join(', ')}`)}try{return u()}catch(s){const l=n(t,o);if(null!=l)return l.then(u);throw s}}const l=n(t,o);return null!=l?l.then(u):u()}function o(n,o,s){const u=t(n,o,s),l=Promise.resolve(u);return l._result=u,l}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},1039,[]); __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)},1040,[34]); __d(function(_g,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,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return p}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[w,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(p,Math.ceil(f.w)+4),j=e&&l>0&&l-2*vu(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.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 t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const w=()=>f(e=>e.layers.some(e=>e.own)),p=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1041,[34,236,402,102,815,840,794,1040,25]); -__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.120'},1042,[]); +__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.121'},1042,[]); __d(function(_g,_r,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'},1043,[796,991,34,379,402,102,794,840,1021,1022,865,1025,1026,1027,992,1044,985,1045,994,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1044,[]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1045,[1046,931,985,846]); @@ -1179,7 +1179,7 @@ __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return z}}),_e.useTableNames=B,_e.resetTableLive=N,_e.seatBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'seated'),N(e,t.table)},_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=M,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return F}}),_e.TablePicker=A,_e.WalkInSheet=R,_e.AssignTableSheet=W,_e.undoNotice=E,_e.NewBookingSheet=_,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[n,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,O.jsxs)(O.Fragment,{children:[s?(0,O.jsx)(R,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:E}):null,l?(0,O.jsx)(_,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,i.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,O.jsx)(W,{booking:n.b,combine:n.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),O=_r(_d[27]);const z=Array.from({length:12},(e,t)=>String(t+1));function B(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function N(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function M(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=B(e),a=(0,S.useFloor)(t=>t.live[e])??{},n=(0,S.usePlan)(e),i=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(i,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[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,S.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,x.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 F=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function A({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=n?6:8,y=n?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(i??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,O.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],i=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!i,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,O.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:i?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,O.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,O.jsx)(T.T,{weight:"bold",size:22,colour:i?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,O.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,O.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,O.jsx)(T.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const L=[1,2,3,4,5,6,7,8];function R({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:y,r:w,now:C}=(0,p.useCtx)(15e3),D=M(y,C),[I,$]=(0,r.useState)(2),[P,z]=(0,r.useState)(!1),[B,F]=(0,r.useState)(i??null),R=(0,S.usePlan)(y),W=(0,f.useBookings)(y),E=(0,v.useBlocks)(e=>e.blocks),_=(0,v.closedAreasAt)(E,y,(0,x.ymd)(C),(0,x.hm)(C)),H=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(D).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(R,W.filter(e=>e.date===(0,x.ymd)(C)),e,I,C,(0,k.turnFor)(I,w.settings.turnMins),90,void 0,{closed:_})?.table??null},[R,W,D,I,_.size,C.getTime()]);(0,r.useEffect)(()=>{B&&(0,S.tablesOf)(B).some(e=>'Closed'===D[e]?.label)&&F(null)},[B,_.size]);const[U,q]=(0,r.useState)(!1),[V,Y]=(0,r.useState)(''),G=(e,t=String(e),s=()=>{z(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,O.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,O.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},K=(0,O.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),Q=(0,O.jsxs)(b.default,{style:{gap:8,width:n?256:void 0},children:[(0,O.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,O.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[L.map(e=>G(e)),G(9,'9+',()=>{z(!0),$(e=>e>=9?e:9)})]}),P?K:null]}),[X,J]=(0,r.useState)(!1),Z=async(t=B)=>{if(!X){J(!0);try{const s=await f.repo.bookings.seatWalkIn(y,I,t??void 0,V);N(y,t??void 0),a(s),e()}finally{J(!1)}}},ee=(0,O.jsxs)(b.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,O.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,O.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),B?(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>F(null)}):null]}),(0,O.jsx)(A,{use:D,value:B,onPick:e=>{D[e]&&!D[e].busy?Z(e):F(B===e?null:e)},big:n,dense:n,best:H,bestSet:(0,u.bestTables)(R)}),(0,O.jsxs)(T.Muted,{children:["Tap a free table to seat them there",H&&!B?` (suggested for ${I}: ${(0,l.tableNumbers)(H)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(C)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,O.jsx)(T.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${B?` \xb7 ${(0,l.tableNumbers)(B)}`:''}`,disabled:X,onPress:()=>{Z()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,O.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[Q,ee]}):(0,O.jsxs)(O.Fragment,{children:[Q,ee]}),(0,O.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[U?(0,O.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>q(!0)}),(0,O.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,O.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function W({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,p.useCtx)(15e3),i=M(o,n),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(n)),t,e.partySize,n,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,n.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),B=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&N(o,l),t()},R=C?(0,O.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,O.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,O.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,O.jsx)(b.default,{testID:"combine-short",children:(0,O.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,O.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>L(I)}),(0,O.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,O.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${F(e)}`,testID:"assign-table-sheet",footer:R,children:[v&&!C?(0,O.jsx)(b.default,{testID:"assign-suggested",children:(0,O.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,O.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,O.jsx)(A,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await L([e])}})]})}function E(e){(0,i.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${F(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function _({date:e,onClose:t,wide:i,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:B}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,F]=(0,r.useState)(ee.blocks),[R,W]=(0,r.useState)(!1),[E,_]=(0,r.useState)(''),[H,U]=(0,r.useState)(2),[q,V]=(0,r.useState)(null),[Y,G]=(0,r.useState)(''),[K,Q]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ne=(0,S.usePlan)(u),ie=(0,P.dogSetUp)(ne),re=!0===te.dog&&ie,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(H,c.settings.turnMins),be=A.filter(e=>e.date===M),ge=e=>(0,k.freeTablesAt)(ne,be,H,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(L,u,M,e)}),he=re&&q?ge(q):[];(0,r.useEffect)(()=>{ae(null)},[re,q,H]);const pe=(0,y.bookingSlots)(c,ue,e=>A.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),H,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0)),me=(0,w.ukPhone)(K),[fe,ye]=(0,r.useState)(!1),ke=q?pe.find(e=>e.time===q):void 0,xe=ke&&ke.left=2&&!!q&&(!xe||fe)&&(0,o.validParty)(H)&&me.ok&&(0,w.emailOk)(X)&&(!je||we&&R)&&(!re||he.length>0)&&!Te,ve=te.wheelchair>0||te.stepFree;return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:i?760:void 0,testID:"booking-sheet",children:[(0,O.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:H,audience:"staff"}),te.dog&&!ie?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(F(e),V(null),W(!1))}}),(0,O.jsxs)(T.Row,{gap:6,children:[(0,O.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,O.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,O.jsx)(T.Field,{label:"Name",value:E,onChangeText:_,placeholder:"e.g. Reid",testID:"nb-name"}),(0,O.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:K,onChangeText:Q,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&K?(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,O.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,O.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(T.T,{center:!0,children:"Covers"}),(0,O.jsx)(s.PartySizeInput,{value:H,onChange:e=>{U(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!ge(e.time).length||!(0,D.dogTimeOk)(c,A,M,e.time,de);return(0,O.jsx)(T.Chip,{label:e.time,sub:(0,v.blockAt)(L,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':e.left>0?`${e.left} left`:'Full',disabled:(e.past??!e.available)||t,selected:q===e.time,onPress:()=>{V(e.time),W(!1),ye(!1)}},e.time)})}),xe?(0,O.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(H,xe.left,xe.time)}),(0,O.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&q?(0,O.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,O.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,O.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ne.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),he.length?(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:he.slice(0,10).map((e,t)=>(0,O.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${ve&&(0,P.accessibleSetUp)(ne)&&!(0,P.isAccessible)(ne,e.table)?' \xb7 not step-free':''}`,selected:(le??he[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",H," at ",q,". Try another time."]})]}):null,je?(0,O.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",je.from,"\u2013",je.to,je.reason?` (${je.reason})`:'']}),we?(0,O.jsx)(T.Chip,{label:R?'Manager override on':'Override and book anyway',selected:R,onPress:()=>W(e=>!e)}):(0,O.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,O.jsx)(b.default,{testID:"nb-closed",children:(0,O.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,O.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:H,date:M,time:q,today:(0,x.ymd)(h),bookings:A,audience:"staff",showTables:!1!==c.settings.tableRequests}),ve&&!(0,P.accessibleSetUp)(ne)?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(T.Field,{label:"Notes (optional)",value:Y,onChangeText:G,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,n.depositDue)((0,n.depositOf)(c.settings),H)?(0,O.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(c.settings),H))," (",(0,a.gbp)((0,n.depositOf)(c.settings).perPersonPence)," per person for ",(0,n.depositOf)(c.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,O.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),Te?(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",q,". Try another time: dogs are very welcome then."]}):null,(0,O.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Se,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||he.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:H,date:M,time:q,notes:Y.trim(),security:(0,n.depositDue)((0,n.depositOf)(c.settings),H)?'deposit':'none',depositPaid:0,...(0,n.depositDue)((0,n.depositOf)(c.settings),H)?{depositDue:(0,n.depositDue)((0,n.depositOf)(c.settings),H),depositPolicy:(0,n.depositWords)((0,n.depositOf)(c.settings),H,c.name).join(' '),depositRefundable:(0,n.depositOf)(c.settings).refundable,depositCutoffHours:(0,n.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??he[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,B)).catch(()=>{}),d?.({date:M,time:q,name:E.trim()}),t()}})]})}},1096,[796,1097,1098,829,836,14,1099,34,828,402,102,846,1100,848,1104,1079,827,840,833,794,1014,1011,1105,1106,1111,1081,1075,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1097,[34,402,412,102,1098,840,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const f=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(f)?f:u))},f=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),b=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`},1098,[]); -__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{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]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); +__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); __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 c.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return c.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return D}}),_e.useShiftManager=b,_e.useSignedIn=h,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(w),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),c=h(),m=o||'staff'===s.APP_VARIANT,y=(0,t.useContext)(D),O=b(),S=m?y&&O?'manager':'staff':c?p(i,l(c)):i,M=(0,r.useOwner)(e=>e.staff),A=(0,n.useRestaurant)(u),P=(0,n.useNow)(e),I=c?c.id:m&&f?f:d[S],R=M.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:A,now:P,role:S,me:R,meId:I,today:(0,a.venueYmd)(P),signedIn:!!c}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return S}}),_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()-O(n));const c=(0,a.ymd)(f),d=(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===O(t)&&e.date>=c&&e.date<=d&&!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,c=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,...c})})}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 M}}),_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()-O(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=h(),t=(0,r.useOwner)(e=>e.hourly);return e?t:A};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]),c=_r(_d[10]);const d={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=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,p=(e,t)=>m[e]>m[t]?t:e,w=(0,t.createContext)(!1),y=()=>(0,t.useContext)(w),D=(0,t.createContext)(!1);function b(){const e=(0,t.useContext)(w)||'staff'===s.APP_VARIANT,n=h(),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 h(){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 O=e=>(e.getDay()+6)%7,S=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const M=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const A={}},1100,[806,34,848,865,827,846,985,1101,997,15,1103]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); __d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[1103]); @@ -1222,7 +1222,7 @@ __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1139,[931,974,985,975]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1140,[1129,982,34,379,102,794,865,988,836,840,1100,1124,1018,1141,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1141,[796,804,982,34,379,236,402,102,794,1016,981,983,836,1017,840,1124,25]); -__d(function(g,_r,_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:u,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),f=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,o.useLiveState)();if('ready'!==$)return(0,p.jsx)(o.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,p.jsxs)(n.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface,padding:u?10:12,gap:6},b],children:[(0,p.jsxs)(r.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:u?1:void 0},children:[(0,p.jsxs)(i.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:["LIVE \xb7 ",I]}),(0,p.jsx)(i.T,{size:12,colour:c.colours.muted,children:"Tap to update \u203a"})]}),(0,p.jsx)(i.Row,{gap:u?14:18,style:{flex:u?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,p.jsx)(i.T,{size:u?42:34,weight:"bold",colour:s<=0?c.colours.red:o?c.colours.amber:c.colours.text,style:{lineHeight:u?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,p.jsxs)(i.T,{size:13,colour:o?c.colours.amber:c.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!u&&L.length?(0,p.jsxs)(n.default,{testID:"shellfish-low",style:{backgroundColor:c.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,p.jsxs)(i.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.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,p.jsx)(i.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,u||L.length||!h?null:(0,p.jsx)(r.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,p.jsx)(i.T,{size:13,colour:c.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,p.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:u=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,f]=(0,s.useState)(!1);if(!h.items.length)return null;const x=u>=80,w=Math.max(28,Math.min(52,Math.round(.6*u))),C=Math.max(22,Math.min(34,Math.round(.42*u)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.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:()=>f(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:u,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,r=b[t.key]??0,d=Math.max(0,o-r),y=d<=0,f=y||h.isLow(t.key);return(0,p.jsxs)(n.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:f?'rgba(255,107,94,0.07)':'transparent',...l.look.web(f?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,p.jsx)(i.T,{size:C,children:t.icon}),(0,p.jsx)(i.T,{size:w,weight:"bold",colour:f?'#FF8E82':c.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,p.jsxs)(n.default,{style:{gap:0},children:[(0,p.jsx)(i.T,{size:x?15:13,weight:"semibold",colour:f?'#FFB3AA':c.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),f&&u>=60?(0,p.jsx)(i.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,p.jsxs)(i.T,{size:x?14:12,weight:"semibold",colour:r?c.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,r)]})]})]},t.key)})}),y?(0,p.jsx)(j,{rid:e,by:t,app:o,onClose:()=>f(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=w,_e.SundayRoastChip=function(e){return(0,p.jsx)(w,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_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]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]);const f=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,u.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:r,onOrder:u,group:h}){const b=(0,d.useShellfish)(e,o,l,h),y='roast'===h,[k,j]=(0,s.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,k[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):k,[C,S]=(0,s.useState)(null),$=x(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&j(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=k[e.key]&&k[e.key]!==Math.round(b.counts[e.key]??0));return(0,p.jsxs)(i.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,p.jsx)(i.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,p.jsxs)(n.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface2},children:[(0,p.jsxs)(i.T,{center:!0,size:13,colour:c.colours.muted,children:[s.icon," ",s.plural]}),(0,p.jsx)(i.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?c.colours.amber:c.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,p.jsx)(i.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,p.jsx)(i.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,p.jsx)(n.default,{style:{minHeight:52}})]},s.key)})}),(0,p.jsx)(i.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,a.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,a.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,p.jsx)(i.Banner,{kind:"success",title:C}):null,(0,p.jsxs)(n.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:c.colours.gold,backgroundColor:c.colours.goldTint},children:[(0,p.jsx)(i.T,{weight:"semibold",colour:c.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,p.jsxs)(i.Row,{gap:10,children:[(0,p.jsxs)(i.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,p.jsx)(i.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,w[s.key]||0)}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,p.jsx)(i.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=k[e.key]&&b.recount(e.key,Math.max(0,Math.round(k[e.key])))}),j({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,p.jsx)(i.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),j({})},style:{minHeight:54}})]}),u?(0,p.jsx)(i.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:u}):null,(0,p.jsxs)(n.default,{style:{gap:2},children:[(0,p.jsx)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,p.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(i.T,{size:13,style:{flex:1},children:(0,a.describe)(e,b.itemOf(e.kind))}),(0,p.jsxs)(i.Muted,{children:[f(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,p.jsx)(i.Row,{wrap:!0,gap:6,children:b.synced?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"ok",label:"Shared live"}),(0,p.jsx)(i.Muted,{children:"Every paired device sees the same count."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"neutral",label:"Saved on this device"}),(0,p.jsx)(i.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function w({rid:e,by:t,app:o,size:u="m",group:b}){const y=(0,d.useShellfish)(e,t,o,b),f=k(e),[x,w]=(0,s.useState)(!1),C=(0,h.useNow)(3e4);if(!y.items.length)return null;if('roast'===b&&!(0,a.isSundayIn)(C))return null;const S='m'===u?20:17,$='xs'!==u;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.default,{testID:'roast'===b?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===b?'Sunday roast: ':''}${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(y.counts[t.key]??0)-(f[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>w(!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:y.items.map((t,s)=>{const o=y.counts[t.key]??0,l=f[t.key]??0,r=Math.max(0,o-l),d=r<=0,u=d||y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,r)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:u?'rgba(255,107,94,0.10)':'transparent'},children:[(0,p.jsx)(i.T,{size:S-2,children:t.icon}),(0,p.jsx)(i.T,{size:S,weight:"bold",colour:d?c.colours.red:u?c.colours.amber:c.colours.text,style:{lineHeight:S+4},children:(0,a.fmtStockCount)(e,t,r)}),$&&(l||d||u)?(0,p.jsx)(i.T,{size:10,weight:"semibold",colour:d||u?'#FFB3AA':c.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),x?(0,p.jsx)(j,{rid:e,by:t,app:o,group:b,onClose:()=>w(!1)}):null]})}},1142,[982,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); +__d(function(g,_r,_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=x,_e.ShellfishTile=function({rid:e,by:t,app:s,big:r,onOrder:c,style:b}){const y=(0,u.useShellfish)(e,t,s),p=x(e),[k,C]=(0,o.useState)(!1),S=j(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,l.useLiveState)();if('ready'!==$)return(0,f.jsx)(l.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(i.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface,padding:r?10:12,gap:6},b],children:[(0,f.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:r?1:void 0},children:[(0,f.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:["LIVE \xb7 ",I]}),(0,f.jsx)(a.T,{size:12,colour:h.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(a.Row,{gap:r?14:18,style:{flex:r?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)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(a.T,{size:r?42:34,weight:"bold",colour:s<=0?h.colours.red:o?h.colours.amber:h.colours.text,style:{lineHeight:r?50:42},children:(0,d.fmtStockCount)(e,t,s)}),(0,f.jsxs)(a.T,{size:13,colour:o?h.colours.amber:h.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.goldLight,children:["Reserved: ",(0,d.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,d.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!r&&L.length?(0,f.jsxs)(i.default,{testID:"shellfish-low",style:{backgroundColor:h.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.map(t=>`${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,d.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),c?(0,f.jsx)(a.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:c}):null]}):null,r||L.length||!c?null:(0,f.jsx)(n.default,{accessibilityRole:"button",onPress:c,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(a.T,{size:13,colour:h.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),k?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>C(!1),onOrder:c?()=>{C(!1),c()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:l=76}){const c=(0,u.useShellfish)(e,t,s),b=x(e),[y,p]=(0,o.useState)(!1);if(!c.items.length)return null;const k=l>=80,j=Math.max(28,Math.min(52,Math.round(.6*l))),C=Math.max(22,Math.min(34,Math.round(.42*l)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${c.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,c.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:l,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...r.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:c.items.map((t,s)=>{const o=c.counts[t.key]??0,n=b[t.key]??0,u=Math.max(0,o-n),y=u<=0,p=y||c.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,u)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:k?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...r.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)(a.T,{size:C,children:t.icon}),(0,f.jsx)(a.T,{size:j,weight:"bold",colour:p?'#FF8E82':h.colours.text,style:{lineHeight:Math.round(1.15*j),letterSpacing:-.5,minWidth:Math.round(.85*j),textAlign:'center'},children:(0,d.fmtStockCount)(e,t,u)}),(0,f.jsxs)(i.default,{style:{gap:0},children:[(0,f.jsx)(a.T,{size:k?15:13,weight:"semibold",colour:p?'#FFB3AA':h.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&l>=60?(0,f.jsx)(a.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,d.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(a.T,{size:k?14:12,weight:"semibold",colour:n?h.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,d.fmtStockCount)(e,t,n)]})]})]},t.key)})}),y?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=w,_e.ShellfishChip=C,_e.SundayRoastChip=function(e){return(0,f.jsx)(C,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),r=_r(_d[4]),n=e(_r(_d[5])),i=e(_r(_d[6])),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]),f=_r(_d[15]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function x(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.ymd)((0,b.useNow)(6e4));return(0,y.reservedOn)(t,o,(0,y.reservablesOf)(s))}function j(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function w({rid:e,by:s,app:l,onClose:r,onOrder:n,group:c}){const b=(0,u.useShellfish)(e,s,l,c),y='roast'===c,[p,x]=(0,o.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,p[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):p,[C,S]=(0,o.useState)(null),$=j(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&x(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=p[e.key]&&p[e.key]!==Math.round(b.counts[e.key]??0));return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,f.jsx)(a.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,f.jsxs)(i.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(a.T,{center:!0,size:13,colour:h.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(a.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?h.colours.amber:h.colours.text,style:{lineHeight:56},children:(0,d.fmtStockCount)(e,s,o)}),(0,f.jsx)(a.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(a.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(i.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(a.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,d.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,d.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,f.jsx)(a.Banner,{kind:"success",title:C}):null,(0,f.jsxs)(i.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,f.jsx)(a.T,{weight:"semibold",colour:h.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsxs)(a.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(a.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,d.fmtStockCount)(e,s,w[s.key]||0)}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,f.jsx)(a.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=p[e.key]&&b.recount(e.key,Math.max(0,Math.round(p[e.key])))}),x({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,f.jsx)(a.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,d.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),x({})},style:{minHeight:54}})]}),n?(0,f.jsx)(a.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:n}):null,(0,f.jsxs)(i.default,{style:{gap:2},children:[(0,f.jsx)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,style:{flex:1},children:(0,d.describe)(e,b.itemOf(e.kind))}),(0,f.jsxs)(a.Muted,{children:[k(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:b.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(a.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(a.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function C({rid:e,by:t,app:l,size:c="m",group:y}){const p=(0,u.useShellfish)(e,t,l,y),k=x(e),[j,C]=(0,o.useState)(!1),S=(0,b.useNow)(3e4);if(!p.items.length)return null;if('roast'===y&&!(0,d.isSundayIn)(S))return null;const $='m'===c?20:17,L='xs'!==c;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:'roast'===y?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===y?'Sunday roast: ':''}${p.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,Math.max(0,(p.counts[t.key]??0)-(k[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>C(!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)',...r.look.web({cursor:'pointer'})}),children:p.items.map((t,o)=>{const l=p.counts[t.key]??0,r=k[t.key]??0,n=Math.max(0,l-r),u=n<=0,c=u||p.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,n)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(a.T,{size:$-2,children:t.icon}),(0,f.jsx)(a.T,{size:$,weight:"bold",colour:u?h.colours.red:c?h.colours.amber:h.colours.text,style:{lineHeight:$+4},children:(0,d.fmtStockCount)(e,t,n)}),!L||!(r||u||c)||u&&s.IS_CAR?null:(0,f.jsx)(a.T,{size:10,weight:"semibold",colour:u||c?'#FFB3AA':h.colours.goldLight,children:u?'none left':r?`${(0,d.fmtStockCount)(e,t,r)} res`:'low'})]},t.key)})}),j?(0,f.jsx)(w,{rid:e,by:t,app:l,group:y,onClose:()=>C(!1)}):null]})}},1142,[982,846,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); __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}},1143,[5,797,841,798,236,844]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,x.jsxs)(r.default,{style:{gap:12},children:[(0,x.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,x.jsx)(y,{}):'take'===t?(0,x.jsx)(j,{}):(0,x.jsx)(f,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]);function y(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[y,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===y?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,x.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,x.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,x.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,x.jsx)(p.Seg,{value:y,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,x.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,x.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,x.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,x.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,x.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,x.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,x.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function j(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[y,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=y[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,x.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,x.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,x.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,x.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,x.jsx)(o.T,{size:16,children:e.name}),(0,x.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,x.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:y[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(y[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:y[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,x.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,x.jsx)(o.Muted,{children:"\u2014"}):(0,x.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,x.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,x.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,x.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function f(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,x.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,x.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,x.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,x.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,x.jsx)(v,{id:e.id,me:t}):null]},e.id)})]})}function v({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[y,j]=(0,l.useState)(b.lines.map(e=>({...e}))),f=(e,t)=>j(i=>i.map(i=>i.ing===e?{...i,...t}:i)),v='expected'!==b.status,k=(0,l.useMemo)(()=>y.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),w=k.filter(e=>Math.abs(e.pct)>=.5),$=y.reduce((e,t)=>e+t.received*t.price,0);return(0,x.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[k.map(({l:e,i:i,short:l,pct:d})=>(0,x.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,x.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,x.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,x.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>f(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!v?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>f(e.ing,{price:100*(Number(t.replace(',','.'))||0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,x.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,x.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round($))]}),S.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[S.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,w.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[w.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,v?(0,x.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,x.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,y,i,[S.length?`${S.length} short`:'',w.length?`${w.length} price changes`:''].filter(Boolean).join(', '))})]})}},1144,[796,1016,1129,982,34,402,102,794,865,836,840,1124,1018,25]); __d(function(g,_r,_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,100][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:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,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))]})}},1145,[796,1146,34,402,102,426,794,865,836,827,840,1147,1100,1050,25]); @@ -1235,302 +1235,303 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1152,[34,402,102,1153,840,794,25]); __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])},1153,[34,900,25]); __d(function(g,_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 M}}),_e.allocate=O,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:T,now:C,today:S,role:k,meId:v,me:D}=(0,x.useCtx)(6e4),B=(0,u.useOwner)(e=>e.staff),F=(0,u.useOwner)(e=>e.attendance),N=(0,u.useOwner)(e=>e.shifts),R=(0,u.useOwner)(e=>e.tronc),E=(0,u.useOwner)(e=>e.troncCash),L=(0,u.useOwner)(e=>e.troncHistory),z=(0,u.useOwner)(e=>e.troncLog),_=(0,c.useOrders)(T),V=(0,j.useVenuePay)(T).pay,[q,H]=(0,i.useState)(-1),[U,W]=(0,i.useState)(''),[Y,K]=(0,i.useState)(!1),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(R.text),[Z,ee]=(0,i.useState)(null),te='staff'!==k,se='owner'===k,{s:oe,e:ie,key:ne}=(0,j.venueRange)(V,'tips',q,C),re=`${(0,h.niceDate)(oe)} \u2013 ${(0,h.niceDate)(ie)} ${ie.getFullYear()}`,le=L.find(e=>e.key===ne),ae=e=>u.useOwner.getState().setOwner({tronc:{...R,...e}}),de=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ce=Math.round((ie.getTime()-oe.getTime())/864e5)+1,ue=(0,i.useMemo)(()=>{let e=_.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(oe)&&e.createdAt.slice(0,10)<=(0,h.ymd)(ie)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!de)for(let t=0;tC)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ne,_.length,de]),pe=E[ne]??0,he=le?le.pot:ue+pe,me=(0,i.useMemo)(()=>{const e={};for(let t=0;tS)break;const o=(0,h.ymd)(s);B.forEach(t=>{const s=F.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ne,F.length,N.length,B.length]),fe=B.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&R.includeManagers||'owner'===e.role&&R.includeOwner)),ye=(0,i.useMemo)(()=>{if(le)return le.rows;const e=fe.map(e=>{const t=(me[e.id]?.paid??0)/60,s=R.points[M(e)]??1;return'hours'===R.method?t:'points'===R.method?t*s:'equal'===R.method?t>0?1:0:R.custom[e.id]??0}),{amounts:t}=O(he,e),s=e.reduce((e,t)=>e+t,0);return fe.map((o,i)=>({staffId:o.id,hours:(me[o.id]?.paid??0)/60,points:R.points[M(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[le,fe.map(e=>e.id).join(),me,R,he]),ge=ye.reduce((e,t)=>e+t.amount,0),xe=le?0:(()=>{const e=ye.map(e=>e.pct);return O(he,e).remainder})(),je=Object.entries(R.custom).filter(([e])=>fe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),be='custom'===R.method&&Math.abs(je-100)>.01,we=new Date(ie.getFullYear(),ie.getMonth()+2,0),Te=[...L].sort((e,t)=>t.end.localeCompare(e.end))[0],Ce=0!==L.length&&(0,h.parseYmd)(Te.end)<(0,h.addMins)(C,-89280),Se=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return`${I(t.name)},${M(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return te?(0,P.jsxs)(l.default,{style:{gap:10},children:[(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,P.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>H(q-1)}),(0,P.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,P.jsx)(d.T,{weight:"semibold",children:re}),le?(0,P.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${le.lockedAt}`}):q>=0?(0,P.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,P.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:q>=0,onPress:()=>H(q+1)})]}),(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Card tips on orders"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.card:ue)})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Cash tips"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.cash:pe)})]}),le?null:(0,P.jsxs)(d.Row,{gap:6,children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:U,onChangeText:W,style:[d.styles.input,{flex:1}]}),(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(U)>=0)||''===U.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...E,[ne]:Math.round(100*Number(U))}}),W('')}})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,P.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(he)})]}),(0,P.jsx)(d.Muted,{children:de?'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).'})]}),le?(0,P.jsxs)(d.Muted,{children:["Locked with method: ",$[le.method],"."]}):(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,P.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,P.jsx)(d.Chip,{label:$[e],selected:R.method===e,onPress:()=>se&&ae({method:e})},e))}),se?null:(0,P.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===R.method?Object.entries(R.points).map(([e,t])=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:e}),(0,P.jsx)(d.Row,{gap:6,children:(0,P.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>se&&ae({points:{...R.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===R.method?(0,P.jsxs)(P.Fragment,{children:[fe.map(e=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,P.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(R.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ae({custom:{...R.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ae({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,P.jsxs)(d.T,{size:13,colour:be?m.colours.red:m.colours.ok,children:["Total ",je.toFixed(1),"%",be?' (must be 100%)':' \u2713']})]}):null,(0,P.jsx)(d.Toggle,{label:"Include managers",value:R.includeManagers,onChange:e=>se&&ae({includeManagers:e})}),(0,P.jsx)(d.Toggle,{label:"Include owner",value:R.includeOwner,onChange:e=>se&&ae({includeOwner:e})}),R.includeOwner?(0,P.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,P.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,P.jsxs)(d.T,{center:!0,children:["Points: ",'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013']}),(0,P.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,P.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,P.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(ge)]})]}):(0,P.jsx)(r.default,{horizontal:!0,children:(0,P.jsxs)(l.default,{children:[(0,P.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,P.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,P.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,P.jsx)(d.T,{size:13,style:{width:54},children:'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013'}),(0,P.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,P.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,P.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,P.jsx)(d.T,{size:13,weight:"bold",colour:ge===he?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(ge)})]})]})}),(0,P.jsxs)(d.Muted,{children:[ge===he?`\u2713 Total equals the pot (${(0,p.gbp)(he)}).`:'\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."]}),le?null:(0,P.jsx)(d.Button,{label:"Approve & lock period",disabled:!se||q>=0||be||ge!==he||he<=0,onPress:()=>{const e=`${(0,h.niceDate)(C)} ${C.toTimeString().slice(0,5)}`,t={id:`tp-${ne}`,key:ne,label:re,end:(0,h.ymd)(ie),pot:he,card:ue,cash:pe,method:R.method,rows:ye,lockedAt:e,by:D};u.useOwner.getState().setOwner({troncHistory:[t,...L],troncLog:[{id:`tl-${Date.now()}`,at:C.toISOString(),text:`${D} approved & locked tips for ${re}: ${(0,p.gbp)(he)} split ${$[R.method].toLowerCase()} between ${ye.filter(e=>e.amount>0).length} staff`},...z]})}}),!le&&q>=0?(0,P.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,se||le?null:(0,P.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),le?(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:le.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!le.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${re} approved: ${(0,p.gbp)(le.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:L.map(e=>e.id===le.id?{...e,shared:(0,h.niceDate)(C)}:e)}),ee('Posted to All staff chat.')}}):null]}),Z?(0,P.jsx)(d.Banner,{kind:"info",title:Z}):null,(0,P.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,P.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(he)} = allocated ${(0,p.gbp)(ge)}`],[R.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Ce,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(we)} ${we.getFullYear()}`],[!0,'Tip records kept for 3 years',`${L.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,P.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,P.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,P.jsxs)(l.default,{style:{flex:1},children:[(0,P.jsx)(d.T,{size:14,children:t}),(0,P.jsx)(d.Muted,{children:s})]})]},String(t))),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{X(R.text),Q(!0)}})]}),(0,P.jsx)(y.SectionHead,{title:"Tip history & audit log"}),L.map(e=>(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"semibold",children:e.label}),(0,P.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,P.jsxs)(d.Muted,{children:[$[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,P.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),L.length||z.length?null:(0,P.jsx)(d.Muted,{children:"No approved periods yet."}),(0,P.jsxs)(d.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,P.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,P.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Se.map((e,t)=>(0,P.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,P.jsxs)(d.Muted,{children:[re," \xb7 ",$[le?.method??R.method]]})]}),(0,P.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tipping policy",children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:se,value:J,onChangeText:X,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),se?(0,P.jsx)(d.Button,{label:"Save policy",onPress:()=>{ae({text:J}),Q(!1)}}):null,(0,P.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,P.jsx)(A,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||B()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${D(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${D(i)}`;return(0,P.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(R,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,P.jsx)(R,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=A;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},M=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',I=e=>(e??'').replace(' (example)','');function O(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const D=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function B(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const F={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,k.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),B()?{pot:F.pot,today:F.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function R({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${D(s)}`;return(0,P.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,P.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,P.jsx)(d.Muted,{center:!0,children:o}):(0,P.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:D(s)})]})}function A(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,P.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,P.jsx)(R,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,P.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,P.jsx)(R,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1154,[798,796,806,34,402,295,102,426,794,848,865,836,827,840,1135,1147,1100,1050,1119,985,1024,1048,13,1049,2,25]); -__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,D.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,D.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),w=(0,f.useOwner)(e=>e.swaps),[v,$]=(0,l.useState)(0),[M,O]=(0,l.useState)(null),[R,P]=(0,l.useState)(null),[z,A]=(0,l.useState)('week'),[N,F]=(0,l.useState)(''),[K,U]=(0,l.useState)(''),[G,X]=(0,l.useState)(''),J='staff'!==t,Q=(0,y.addMins)(_(e),7*v*1440);Q.setHours(0,0,0,0);const Z=q(Q),ee=Z.sales,te='none'===Z.mode,se=Array.from({length:7},(e,t)=>{const s=new Date(Q);return s.setDate(Q.getDate()+t),(0,y.ymd)(s)}),ne=(0,f.visibleShifts)(i,J).filter(e=>e.date>=se[0]&&e.date<=se[6]),ae=(()=>{const e=new Date(Q);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),oe=ne.filter(e=>!e.published||e.changed).length,ie=i.filter(e=>e.date>=ae&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),re=se.map(e=>ne.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(h[s.staffId]??0);var s},0)),de=re.reduce((e,t)=>e+t,0),ce=ee.reduce((e,t)=>e+t,0),ue=(e,t)=>t?Math.round(e/t*100):0,he=J?o:o.filter(e=>e.id===n),fe=(0,a.useNarrow)(),me=Math.max(0,se.indexOf((0,y.ymd)(e))),[pe,xe]=(0,l.useState)(null),ge=pe??me,je=(e,t)=>!fe||t===ge,be=fe?150:74;return(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(u.Chip,{label:`Swaps & leave (${w.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(u.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(v-1),O(null)}}),(0,H.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(Q)]}),(0,H.jsxs)(u.Muted,{children:[0===v?'This week':1===v?'Next week':-1===v?'Last week':v>0?`In ${v} weeks`:-v+" weeks ago",J?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(v+1),O(null)}})]}),J?(0,H.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ie?` (${ie})`:''),disabled:!ie,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(ae,se[0]);O(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,H.jsx)(u.Button,{small:!0,kind:"success",label:oe?`Publish ${oe} ${1===oe?'change':'changes'}`:'Week published',disabled:!oe,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(se[0]);O(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),oe?(0,H.jsx)(u.Badge,{kind:"amber",label:`${oe} unpublished`}):ne.length?(0,H.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,M?(0,H.jsx)(u.Banner,{kind:"success",title:M}):null,fe?(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(u.Chip,{label:`${e} ${(0,y.parseYmd)(se[t]).getDate()}`,selected:t===ge,onPress:()=>xe(t)},e))}):null,(0,H.jsx)(d.default,{horizontal:!fe,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(c.default,{style:{gap:4},children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsxs)(u.T,{size:12,weight:"semibold",colour:se[s]===(0,y.ymd)(e)?S.colours.gold:S.colours.text,children:[t," ",(0,y.parseYmd)(se[s]).getDate()]})},t)).filter(je)]}),he.map(e=>(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(ne,e.id,se[s]),a=(m[e.id]??[]).includes(s),o=le(e.id,se[s]);return(0,H.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!J,onPress:()=>P({staffId:e.id,date:se[s],shift:n}),style:{width:be,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?S.colours.gold:S.colours.amber:S.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:o?'Leave':a?'Unavail.':J?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(u.T,{size:9,colour:S.colours.red,children:o?'on leave!':'unavailable'}):n&&J&&(!n.published||n.changed)?(0,H.jsx)(u.T,{size:9,colour:S.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(je)]},e.id)),J?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour"})}),re.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:'example'===Z.mode?'Fcst sales (ex.)':'Fcst sales'})}),ee.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour %"})}),re.map((e,t)=>{const s=ue(e,ee[t]);return(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,weight:"semibold",colour:ee[t]?s>32?S.colours.red:s>26?S.colours.amber:S.colours.ok:S.colours.muted,children:ee[t]?`${s}%`:'\u2013'})},t)}).filter(je)]})]}):null]})}),!J&&n?(0,H.jsx)(c.default,{testID:"rota-team-on",children:(0,H.jsx)(u.Card,{children:se.map((e,t)=>(0,H.jsx)(x.TeamOnDay,{date:e,meId:n,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(je)})}):null,J&&te?(0,H.jsx)(u.Card,{children:(0,H.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(c.default,{testID:"labour-week-cost",children:(0,H.jsx)(u.T,{weight:"semibold",children:(0,k.gbp)(de)})})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===Z.weeks?'1 week':`${Z.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),Z.booked?(0,H.jsx)(c.default,{testID:"labour-booked",children:(0,H.jsxs)(u.T,{children:["Booked so far: ",Z.booked," Covers this week"]})}):null]})}):null,J&&!te?(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(u.Row,{gap:6,children:['example'===Z.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(u.Badge,{kind:ue(de,ce)>30?'red':'ok',label:`${ue(de,ce)}% this week`})]})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(ce)," forecast sales. Target 25\u201330%. ",'example'===Z.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=ue(re[5],ee[5]);return e&&e<24?(0,H.jsxs)(u.T,{size:14,colour:S.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,J?(0,H.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>J||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,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(e=>L(s,e)).map(t=>(0,H.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,H.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,I.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),J?null:(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(u.Muted,{testID:"swap-dept-note",children:(0,j.isAnchorageVenue)(b.VENUE_RID)?j.ANCHORAGE_SWAP_NOTE:Y(o.find(e=>e.id===n))?j.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ne.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,I.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>L(o.find(e=>e.id===n),e)).map(t=>(0,H.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)}),ne.some(e=>e.staffId===n)?null:(0,H.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(C.SectionHead,{title:"Holiday & leave"}),p.filter(e=>J||e.staffId===n).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,H.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)((0,y.parseYmd)(e.from))," \u2013 ",(0,y.niceDate)((0,y.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Request leave",J?' (as yourself)':'']}),(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:N,onChangeText:F,style:[u.styles.input,{flex:1}]}),(0,H.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:K,onChangeText:U,style:[u.styles.input,{flex:1}]})]}),(0,H.jsx)(u.Field,{label:"Reason",value:G,onChangeText:X}),(0,H.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(N)||!/^\d{4}-\d{2}-\d{2}$/.test(K)||K{f.useOwner.getState().addLeave({staffId:n,from:N,to:K,reason:G.trim()||'Holiday'}),F(''),U(''),X('')}})]})]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",J?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),he.filter(e=>'owner'!==e.role||!J).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{gap:8,children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(u.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,H.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,D.useCtx)(5e3),x=((0,v.useClockArea)(e=>e.areas[m]),(0,v.areaOf)(m));const j=(0,$.privateClockVenue)(m),[b,w]=(0,l.useState)(!1),k=(0,f.useOwner)(e=>e.consent[a]),C=(0,f.useOwner)(e=>e.attendance),I=(0,f.useOwner)(e=>e.shifts),[B,z]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,N]=(0,l.useState)(null),[F,E]=(0,l.useState)(void 0),[W,_]=(0,l.useState)(null),[q,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=C.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)(I,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,M.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),N(null),E(void 0);const l=await(0,O.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(_(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&_(null),!0):(N(l.message),E(l.fix),(0,R.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 k?(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(T.StaffAvatar,{id:a,size:48}),(0,H.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,H.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(c.default,{testID:"clock-area-line",children:(0,H.jsx)(u.T,{size:14,colour:S.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,H.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(c.default,{testID:"on-break",children:(0,H.jsxs)(u.T,{size:15,weight:"semibold",colour:S.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.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,H.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,H.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'):(N(null),z(!0))}})]}):(0,H.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(c.default,{testID:"clock-message",children:(0,H.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===F?(0,H.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===F?(0,H.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===F?(0,H.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,M.areaSet)(x)?(0,H.jsx)(c.default,{testID:"clock-area-warning",children:(0,H.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,H.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(u.T,{size:14,colour:S.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.T,{weight:"semibold",colour:S.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(u.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.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,H.jsx)(u.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(c.default,{style:{gap:12},children:[(0,H.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,H.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,H.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:()=>{w(!1),ae('in')}}),(0,H.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:m,today:t,now:e}):null,G?(0,H.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,H.jsx)(u.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,M.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.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,H.jsx)(c.default,{style:{gap:10},children:(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.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,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.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,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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]),S=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),v=_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]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const Y=e=>(0,j.deptKey)(e?.dept),L=(e,t)=>(0,j.canSwapWith)(e,t,b.VENUE_RID),N=2650,F=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,z.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,w.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*N+t.restOfDay.takeaway*F:0})}},[s,a,o,i,r,(0,y.ymd)(e)])}function V({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,H.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,H.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,H.jsx)(u.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{children:"Start"}),(0,H.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:"End"}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:i,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.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,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:D.fmtH,label:"Break time"}),(0,H.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,H.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,H.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,H.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,H.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({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,D.useSignedIn)(),{me:i,meId:r}=(0,D.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),w=s=>{if(!d)return;const a=(0,O.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,R.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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,b]=(0,l.useState)(h?Math.round(60*h.start):720),[w,k]=(0,l.useState)(h?Math.round(60*h.end):1200),[C,I]=(0,l.useState)(''),[T,v]=(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&&w<=j,P=(e,t)=>(0,H.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return T?(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.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,H.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,D.fmtH)(h.start)}\u2013${(0,D.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,y.hm)(new Date(c.in))}\u2013${c.out?(0,y.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,O?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(u.Field,{label:"Note for your manager (optional)",value:C,onChangeText:I,placeholder:"e.g. phone died",maxLength:200}),(0,H.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,w):void 0,note:C.trim(),at:t.toISOString()}),v(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.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,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(c.default,{children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(u.T,{size:28,weight:"bold",colour:S.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(u.T,{size:18,weight:"semibold",colour:w?S.colours.amber:S.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.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,H.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(C.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsxs)(u.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.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,H.jsx)(C.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,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(u.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.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,H.jsxs)(u.T,{size:13,colour:S.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,H.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,D.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,j]=(0,l.useState)(s),[b,w]=(0,l.useState)(null),[I,v]=(0,l.useState)(!1),$=!!(0,D.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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),B=P.filter(f.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),Y=B.reduce((t,s)=>t+(0,D.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(B.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,D.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,D.fmtH)(a.start)}-${(0,D.fmtH)(a.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.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,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(u.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(u.T,{size:13,colour:S.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(u.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(a.WideTable,{children:(0,H.jsxs)(c.default,{style:{gap:2},children:[(0,H.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:S.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(u.T,{size:12,weight:"semibold",colour:S.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,D.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(T.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:l?`${(0,D.fmtH)(l.start)}\u2013${(0,D.fmtH)(l.end)}`:'\u2013'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?S.colours.ok:'open'===(0,f.attStatus)(t)?S.colours.blue:S.colours.amber,children:(0,m.statusLabel)(t)}),(0,H.jsx)(u.T,{size:11,style:{width:140},colour:c.length?S.colours.amber:S.colours.ok,children:c.join(', ')||'OK'}),(0,H.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(u.T,{size:12,colour:S.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?S.colours.muted:S.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,H.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>v(!0)}),(0,H.jsx)(C.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(u.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(m.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(u.Sheet,{visible:I,onClose:()=>v(!1),title:"Payroll export",children:[(0,H.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(u.T,{size:10,colour:t?S.colours.text:S.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,796,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); +__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:s}=(0,D.useCtx)(6e4),a=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,h.useOwner)(e=>e.shifts),u=(0,D.useHourly)(),f=(0,h.useOwner)(e=>e.availability),m=(0,h.useOwner)(e=>e.leave),w=(0,h.useOwner)(e=>e.swaps),[T,$]=(0,i.useState)(0),[O,M]=(0,i.useState)(null),[R,P]=(0,i.useState)(null),[z,A]=(0,i.useState)('week'),[F,Y]=(0,i.useState)(!1),K=(0,D.useSignedIn)()?.name??'',U='staff'!==t,G=(0,y.addMins)(_(e),7*T*1440);G.setHours(0,0,0,0);const X=q(G),J=X.sales,Q='none'===X.mode,Z=Array.from({length:7},(e,t)=>{const s=new Date(G);return s.setDate(G.getDate()+t),(0,y.ymd)(s)}),ee=(0,h.visibleShifts)(o,U).filter(e=>e.date>=Z[0]&&e.date<=Z[6]),te=(()=>{const e=new Date(G);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),se=ee.filter(e=>!e.published||e.changed).length,ne=o.filter(e=>e.date>=te&&e.date!!(0,h.leaveOn)(m,e,t),oe=Z.map(e=>ee.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(u[s.staffId]??0);var s},0)),ie=oe.reduce((e,t)=>e+t,0),le=J.reduce((e,t)=>e+t,0),re=(e,t)=>t?Math.round(e/t*100):0,de=U?a:a.filter(e=>e.id===s),ce=(0,n.useNarrow)(),ue=Math.max(0,Z.indexOf((0,y.ymd)(e))),[he,fe]=(0,i.useState)(null),me=he??ue,pe=(e,t)=>!ce||t===me,xe=ce?150:74;return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(c.Chip,{label:`Swaps & time off (${w.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(c.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[!U&&s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-time-off"}):null,(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(T-1),M(null)}}),(0,H.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(c.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(G)]}),(0,H.jsxs)(c.Muted,{children:[0===T?'This week':1===T?'Next week':-1===T?'Last week':T>0?`In ${T} weeks`:-T+" weeks ago",U?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(T+1),M(null)}})]}),U?(0,H.jsxs)(c.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ne?` (${ne})`:''),disabled:!ne,testID:"rota-copy",onPress:()=>{const e=h.useOwner.getState().copyWeek(te,Z[0]);M(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,H.jsx)(c.Button,{small:!0,kind:"success",label:se?`Publish ${se} ${1===se?'change':'changes'}`:'Week published',disabled:!se,testID:"rota-publish",onPress:()=>{const e=h.useOwner.getState().publishWeek(Z[0]);M(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),se?(0,H.jsx)(c.Badge,{kind:"amber",label:`${se} unpublished`}):ee.length?(0,H.jsx)(c.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,O?(0,H.jsx)(c.Banner,{kind:"success",title:O}):null,ce?(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(c.Chip,{label:`${e} ${(0,y.parseYmd)(Z[t]).getDate()}`,selected:t===me,onPress:()=>fe(t)},e))}):null,(0,H.jsx)(r.default,{horizontal:!ce,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(d.default,{style:{gap:4},children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsxs)(c.T,{size:12,weight:"semibold",colour:Z[s]===(0,y.ymd)(e)?I.colours.gold:I.colours.text,children:[t," ",(0,y.parseYmd)(Z[s]).getDate()]})},t)).filter(pe)]}),de.map(e=>(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsxs)(c.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(c.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,h.shiftOf)(ee,e.id,Z[s]),a=(f[e.id]??[]).includes(s),o=ae(e.id,Z[s]);return(0,H.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!U,onPress:()=>P({staffId:e.id,date:Z[s],shift:n}),style:{width:xe,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?I.colours.gold:I.colours.amber:I.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(c.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:o?'Off':a?'Unavail.':U?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(c.T,{size:9,colour:I.colours.red,children:o?'on leave!':'unavailable'}):n&&U&&(!n.published||n.changed)?(0,H.jsx)(c.T,{size:9,colour:I.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(pe)]},e.id)),U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour"})}),oe.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:'example'===X.mode?'Fcst sales (ex.)':'Fcst sales'})}),J.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour %"})}),oe.map((e,t)=>{const s=re(e,J[t]);return(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,weight:"semibold",colour:J[t]?s>32?I.colours.red:s>26?I.colours.amber:I.colours.ok:I.colours.muted,children:J[t]?`${s}%`:'\u2013'})},t)}).filter(pe)]})]}):null]})}),!U&&s?(0,H.jsx)(d.default,{testID:"rota-team-on",children:(0,H.jsx)(c.Card,{children:Z.map((e,t)=>(0,H.jsx)(p.TeamOnDay,{date:e,meId:s,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(pe)})}):null,U&&Q?(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(d.default,{testID:"labour-week-cost",children:(0,H.jsx)(c.T,{weight:"semibold",children:(0,k.gbp)(ie)})})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(c.Muted,{children:`Forecasts start once CoverCharge has ${1===X.weeks?'1 week':`${X.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),X.booked?(0,H.jsx)(d.default,{testID:"labour-booked",children:(0,H.jsxs)(c.T,{children:["Booked so far: ",X.booked," Covers this week"]})}):null]})}):null,U&&!Q?(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(c.Row,{gap:6,children:['example'===X.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(c.Badge,{kind:re(ie,le)>30?'red':'ok',label:`${re(ie,le)}% this week`})]})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(le)," forecast sales. Target 25\u201330%. ",'example'===X.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=re(oe[5],J[5]);return e&&e<24?(0,H.jsxs)(c.T,{size:14,colour:I.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,U?(0,H.jsx)(c.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>U||e.fromId===s||e.toId===s).map(e=>{const t=o.find(t=>t.id===e.shiftId),s=a.find(t=>t.id===e.fromId),n=a.find(t=>t.id===e.toId);return(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(c.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:a.filter(e=>L(s,e)).map(t=>(0,H.jsx)(c.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{h.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,H.jsx)(c.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{h.useOwner.getState().setSwap(e.id,'approved');const s=e=>(a.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,C.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),U?null:(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(c.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(c.Muted,{testID:"swap-dept-note",children:(0,x.isAnchorageVenue)(j.VENUE_RID)?x.ANCHORAGE_SWAP_NOTE:N(a.find(e=>e.id===s))?x.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ee.filter(e=>e.staffId===s).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(d.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(c.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Ask for cover",onPress:()=>{h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,kind:'cover',note:'Can anyone cover?'}),(0,C.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(a.find(e=>e.id===s)?.name??'').replace(' (example)','')})`)}}),a.filter(e=>L(a.find(e=>e.id===s),e)).map(t=>(0,H.jsx)(c.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),ee.some(e=>e.staffId===s)?null:(0,H.jsx)(c.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(S.SectionHead,{title:"Holiday & time off"}),U?(0,H.jsx)(c.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>Y(!0)}):s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-requests-time-off"}):null,m.filter(e=>U||e.staffId===s).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,H.jsx)(c.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,H.jsxs)(c.Muted,{children:[(0,b.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,style:{justifyContent:'center'},children:[(0,H.jsx)(c.Button,{small:!0,label:"Approve",onPress:()=>h.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),U&&s?(0,H.jsx)(b.TimeOffSheet,{visible:F,onClose:()=>Y(!1),meId:s,me:K,manager:!0}):null]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Muted,{children:["Days each person can\u2019t work. ",U?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),de.filter(e=>'owner'!==e.role||!U).map(e=>(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{gap:8,children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(c.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(c.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(f[e.id]??[]).includes(s);return(0,H.jsx)(c.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>h.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:n,meId:r,me:u,r:f,rid:p}=(0,D.useCtx)(5e3),x=((0,T.useClockArea)(e=>e.areas[p]),(0,T.areaOf)(p));const j=(0,$.privateClockVenue)(p),[b,w]=(0,i.useState)(!1),k=(0,h.useOwner)(e=>e.consent[r]),S=(0,h.useOwner)(e=>e.attendance),C=(0,h.useOwner)(e=>e.shifts),[B,z]=(0,i.useState)(!1),[A,N]=(0,i.useState)(null),[L,F]=(0,i.useState)(null),[Y,E]=(0,i.useState)(void 0),[W,_]=(0,i.useState)(null),[q,V]=(0,i.useState)(!1),[G,X]=(0,i.useState)(null),J=S.filter(t=>t.staffId===r&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,h.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,h.visibleShifts)(C,'staff'!==n).find(e=>e.staffId===r&&e.date===t),ee='staff'!==n,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,O.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{N(s),F(null),E(void 0);const i=await(0,M.clockAction)(s,{rid:p,staffId:r,date:t,at:new Date(e.getTime()).toISOString(),...n});return N(null),i.ok?('out'===s&&i.att&&(_(i.att),(0,o.hrSettingsOf)(f.settings?.hr).on&&!a.useHr.getState().hasAnswered(p,i.att.id)&&X(i.att)),'in'===s&&_(null),!0):(F(i.message),E(i.fix),(0,R.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:i.message.split('. ')[0]+'.',body:i.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(v.StaffAvatar,{id:r,size:48}),(0,H.jsx)(c.T,{weight:"semibold",style:{flex:1},children:u})]}),(0,H.jsx)(c.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(c.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(d.default,{testID:"clock-area-line",children:(0,H.jsx)(c.T,{size:14,colour:I.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${f.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${f.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,H.jsxs)(c.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(c.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(d.default,{testID:"on-break",children:(0,H.jsxs)(c.T,{size:15,weight:"semibold",colour:I.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,h.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.jsx)(c.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,H.jsx)(c.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,H.jsx)(c.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),z(!0))}})]}):(0,H.jsx)(c.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(c.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,h.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(d.default,{testID:"clock-message",children:(0,H.jsx)(c.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===Y?(0,H.jsx)(c.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,O.areaSet)(x)?(0,H.jsx)(d.default,{testID:"clock-area-warning",children:(0,H.jsx)(c.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,H.jsx)(l.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(c.T,{size:14,colour:I.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(m.BreakRoomCard,{staffId:r,name:u,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.T,{weight:"semibold",colour:I.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(c.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.jsx)(c.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,H.jsx)(c.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(d.default,{style:{gap:12},children:[(0,H.jsxs)(c.T,{children:["We check once that you are at ",f.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,H.jsx)(c.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,H.jsx)(c.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{w(!1),ae('in')}}),(0,H.jsx)(c.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:p,today:t,now:e}):null,G?(0,H.jsx)(s.ShiftCheckout,{rid:p,shiftKey:G.id,day:G.date,meId:r,onClose:()=>X(null)}):null,(0,H.jsx)(c.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(d.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(c.Chip,{testID:`forgot-break-${e}`,label:(0,O.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.jsx)(c.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,H.jsx)(d.default,{style:{gap:10},children:(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",f.name,", within about ",x.radius," m."]}),(0,H.jsx)(c.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(c.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.jsx)(c.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 ",f.name," (within about ",x.radius," m)."]}),(0,H.jsx)(c.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.jsx)(c.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,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.jsx)(c.Button,{label:"I understand \u2014 continue",onPress:()=>h.useOwner.getState().giveConsent(r,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),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]),I=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const N=e=>(0,x.deptKey)(e?.dept),L=(e,t)=>(0,x.canSwapWith)(e,t,j.VENUE_RID),F=2650,Y=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,u.useBookings)(t),o=(0,u.useOrders)(t),l=(0,u.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,i.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),i=(0,z.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:i,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:i,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:i,booked:n,sales:t.map(e=>{const t=(0,w.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*F+t.restOfDay.takeaway*Y:0})}},[s,a,o,l,r,(0,y.ymd)(e)])}function V({init:e,onClose:t}){const s=(0,h.useOwner)(e=>e.staff),[n,a]=(0,i.useState)(e.shift?.start??12),[o,l]=(0,i.useState)(e.shift?.end??20),[r,u]=(0,i.useState)(e.shift?.breakAt),f=void 0===r||r>n&&rt.id===e.staffId),p=(0,h.leaveOn)((0,h.useOwner)(e=>e.leave),e.staffId,e.date);return(0,H.jsxs)(c.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[p?(0,H.jsx)(c.Banner,{kind:"warn",title:`${(m?.name??'').replace(' (example)','')} has time off: ${(0,b.rangeLabel)(p.from,p.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,H.jsx)(c.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,H.jsx)(c.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),l(s)}},e))}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{children:"Start"}),(0,H.jsx)(c.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:"End"}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:l,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(c.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(c.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.jsx)(c.Chip,{label:"Set a break time",onPress:()=>u(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,H.jsxs)(c.Row,{gap:6,children:[(0,H.jsx)(c.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:u,format:D.fmtH,label:"Break time"}),(0,H.jsx)(c.Chip,{label:"No set time",onPress:()=>u(void 0)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=h.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:f?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&f?{breakAt:r}:{}}),t()}}),(0,H.jsx)(c.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,H.jsx)(c.Button,{kind:"danger",label:"Remove shift",onPress:()=>{h.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({rid:e,today:t,now:s}){const n=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,h.useOwner)(e=>e.attendance),o=(0,D.useSignedIn)(),{me:l,meId:r}=(0,D.useCtx)(3e4),[d,u]=(0,i.useState)(null),[f,m]=(0,i.useState)(''),[p,x]=(0,i.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,h.isOnBreak)(j),w=s=>{if(!d)return;const a=(0,M.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??l},f);if(!a.ok)return void x(a.message);const i=n.find(e=>e.id===d)?.name??'them';(0,R.notify)({id:'mgr-clock',title:`Recorded for ${i}`,body:`Reason kept with the record: ${f.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Record it for someone"}),(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(c.Chip,{label:e.name,selected:d===e.id,onPress:()=>u(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Field,{label:"Reason (kept with the record)",value:f,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(c.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,h.useOwner)(e=>e.attendance),o=(0,h.useOwner)(e=>e.shifts),l=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),[r,d]=(0,i.useState)(s),u=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],m=(0,h.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,i.useState)(u&&!u.out?'out':'in'),[j,b]=(0,i.useState)(m?Math.round(60*m.start):720),[w,k]=(0,i.useState)(m?Math.round(60*m.end):1200),[S,C]=(0,i.useState)(''),[v,T]=(0,i.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,O='out'!==p,M='in'!==p,R=O&&M&&w<=j,P=(e,t)=>(0,H.jsx)(c.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return v?(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.jsx)(c.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,H.jsx)(c.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(c.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(c.Muted,{children:[m?`Your rota that day: ${(0,D.fmtH)(m.start)}\u2013${(0,D.fmtH)(m.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,y.hm)(new Date(u.in))}\u2013${u.out?(0,y.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(c.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(c.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),O?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,M?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(c.Field,{label:"Note for your manager (optional)",value:S,onChangeText:C,placeholder:"e.g. phone died",maxLength:200}),(0,H.jsx)(c.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{h.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:u?.id,kind:p,suggestedIn:O?(0,f.isoAt)(r,j):void 0,suggestedOut:M?(0,f.isoAt)(r,w):void 0,note:S.trim(),at:t.toISOString()}),T(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.useCtx)(3e4),n=(0,h.useOwner)(e=>e.attendance),a=(0,h.useOwner)(e=>e.shifts),o=(0,h.useOwner)(e=>e.timeRequests),[l,r]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),p=(0,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(h.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(d.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(d.default,{children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(c.T,{size:28,weight:"bold",colour:I.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(c.T,{size:18,weight:"semibold",colour:w?I.colours.amber:I.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(S.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsxs)(c.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(c.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,H.jsx)(S.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,h.shiftOf)((0,h.visibleShifts)(a,!1),t.staffId,t.date),n=(0,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(c.Card,{onPress:()=>m(u===t.id?null:t.id),children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(c.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.jsx)(c.Badge,{kind:(0,f.statusKind)(t),label:'awaiting'===(0,h.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,f.statusLabel)(t)})]}),o?(0,H.jsxs)(c.T,{size:13,colour:I.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(c.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,u===t.id?(0,H.jsx)(f.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(c.Muted,{children:"No clocked shifts yet."}),l?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const a=(0,h.useOwner)(e=>e.staff),o=(0,h.useOwner)(e=>e.shifts),r=(0,D.useHourly)(),u=(0,h.useOwner)(e=>e.attendance),m=(0,h.useOwner)(e=>e.timeRequests),p=(0,h.useOwner)(e=>e.attLog),[x,j]=(0,i.useState)(s),[b,w]=(0,i.useState)(null),[C,T]=(0,i.useState)(!1),$=!!(0,D.useSignedIn)(),O=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),M=u.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!M.some(t=>t.staffId===e.staffId)),P=u.filter(e=>O.includes(e.date)&&e.out),B=P.filter(h.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),N=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(B.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=a.find(e=>e.id===t.staffId),n=(0,h.shiftOf)(o,t.staffId,t.date),i=(0,D.paidMins)(t,e),l=r[t.staffId]??0;return`${s?.name},${t.date},${n?`${(0,D.fmtH)(n.start)}-${(0,D.fmtH)(n.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.hm)(new Date(t.out))},${i.brk},${(i.paid/60).toFixed(2)},${(l/100).toFixed(2)},${(i.paid/60*l/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:O.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(c.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(c.T,{size:13,colour:I.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(c.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(N))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(n.WideTable,{children:(0,H.jsxs)(d.default,{style:{gap:2},children:[(0,H.jsx)(n.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:I.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(c.T,{size:12,weight:"semibold",colour:I.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),M.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,h.shiftOf)(o,t.staffId,x),d=(0,D.paidMins)(t,e),u=(0,f.flagsFor)(t,r,e,s,m).map(e=>e.label);return(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(c.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(v.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(c.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:r?`${(0,D.fmtH)(r.start)}\u2013${(0,D.fmtH)(r.end)}`:'\u2013'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(c.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(c.T,{size:11,style:{width:120},colour:'confirmed'===(0,h.attStatus)(t)?I.colours.ok:'open'===(0,h.attStatus)(t)?I.colours.blue:I.colours.amber,children:(0,f.statusLabel)(t)}),(0,H.jsx)(c.T,{size:11,style:{width:140},colour:u.length?I.colours.amber:I.colours.ok,children:u.join(', ')||'OK'}),(0,H.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(c.T,{size:12,colour:I.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(c.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(c.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?I.colours.muted:I.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),M.length||R.length?null:(0,H.jsx)(c.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(c.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,H.jsx)(S.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(c.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(c.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(f.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(c.Sheet,{visible:C,onClose:()=>T(!1),title:"Payroll export",children:[(0,H.jsxs)(c.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(d.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(c.T,{size:10,colour:t?I.colours.text:I.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(c.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(c.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1159,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); __d(function(g,_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)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1156,[796,34,402,102,794,840,865,800,850,998,999,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),H=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),N=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(N.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),N.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(N.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:H.length?`Confirm all unflagged (${H.length})`:'Nothing unflagged to confirm',disabled:!H.length,onPress:()=>Y(H.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[H,N]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[H,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:H===e,onPress:()=>N(H===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:H?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),N=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),H=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(H.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),H.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(H.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:N.length?`Confirm all unflagged (${N.length})`:'Nothing unflagged to confirm',disabled:!N.length,onPress:()=>Y(N.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[N,H]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[N,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:N===e,onPress:()=>H(N===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:N?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:p}){const b=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.staff),f=(0,s.useMemo)(()=>(0,c.teamOnDay)(b,j,e,t),[b,j,e,t]);return(0,h.jsxs)(l.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(p,f),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",p]}),f.length?f.map(e=>(0,h.jsxs)(l.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,h.jsxs)(n.T,{size:13,center:!0,children:[e.name,e.job?(0,h.jsxs)(n.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,h.jsx)(n.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6])},1158,[34,102,794,865,1102,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1159,[34,102,794,865,840,1100,1103,1158,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1160,[34,102,1100,840,794,25]); -__d(function(g,r,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]})}},1161,[796,34,402,102,794,1019,840,928,25]); -__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1162,[796,1163,804,865,34,336,402,102,794,1019,1020,840,899,928,1164,1167,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1163,[34,1019,865,804]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1164,[798,796,1163,804,865,34,336,402,102,900,794,899,1019,1020,1165,840,928,1166,25]); -__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1165,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1166,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1167,[34,379,236,102,794,865,1019,1166,1020,1168,840,928,1163,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1168,[1020]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1169,[34,402,102,794,989,830,990,840,928,1170,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1170,[798,34,336,395,402,295,102,1171,794,989,830,990,827,840,1034,25,1173]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1171,[34,1172,102,830,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1172,[2,985]); -__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1173,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1174,[829,34,236,402,102,900,848,840,794,1175,1099,1176,25]); -__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1175,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); -__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1176,[1177,1178,1180,1179,1181,1033,1182]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1177,[]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1178,[808,5,815,818,846,1033,1179]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1179,[829,236,846,1177]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1180,[34,848,830,838,836,1178,1177]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1181,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1182,[34,1178,985,931]); -__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1183,[34,402,102,426,848,830,840,794,1174,1099,1184,25]); -__d(function(g,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}},1184,[34,102,426,848,830,1176,1033,840,794,1099,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1185,[34,236,402,102,853,794,840,994,1186,1187,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1186,[846,6,931,974,994,1176,1187]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1187,[808,1188,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1188,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1189,[34,846,1186]); -__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1190,[796,1163,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1191,[34,402,346,102,426,840,1153,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1192,[30,34,792,846,25]); -__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1193,[829,1097,851,30,34,1194,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); -__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])},1194,[796,34,236,102,25]); -__d(function(_g,_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"})]})]})}},1195,[30,34,336,102,1171,1196,794,830,836,848,856,840,25]); -__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])},1196,[30,34,402,848,840,794,25]); -__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1197,[30,34,794,1198,848,1185,25]); -__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])},1198,[34,402,840,794,25]); -__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1199,[806,30,34,1200,794,836,848,840,1201,1205,25]); -__d(function(_g,r,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])},1200,[34,385,102,848,836,840,794,25]); -__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}},1201,[34,102,794,836,1202,1203,1204,840,25]); -__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})},1202,[]); -__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})},1203,[]); -__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()})},1204,[931,985,1203]); -__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}},1205,[815,931,974,985,2,1202]); -__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1206,[1207,1216,5,1217,1218,1219,1222,829,30,34,236,402,102,1171,1196,794,830,836,852,848,840,1223,1185,846,865,1170,989,990,997,1224,1205,25]); -__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1207,[34,379,794,847,1208,1209,1215,848,5,6,25]); -__d(function(g,r,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])},1208,[34,379,102,794,991,992,1044,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1209,[6,34,931,794,1210,25]); -__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]})]})}},1210,[6,1211,1212,1213,34,102,796,794,840,11,1214,25]); -__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1212,[4,11]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1213,[11]); -__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.'}},1214,[6,931]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1215,[34,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1216,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1217,[34,102,794,1210,25]); -__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1218,[34,379,931,794,847,1208,1210,4,25]); -__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1219,[34,379,794,1208,847,1209,8,1220,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1220,[34,102,794,1221,25]); -__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1221,[]); -__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1222,[34,794,847,1208,1209,848,9,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1223,[34,402,102,426,794,840,1153,25]); -__d(function(g,_r,_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)})]})}},1224,[34,102,1225,794,848,997,1202,1205,840,25]); -__d(function(g,r,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])},1225,[34,102,1226,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1226,[1227]); -__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1227,[34,900,1228,1257,1258,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1228,[1229]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1229,[1230,1231,1254,1256]); -__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1230,[]); -__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1231,[1232,1233,1234,1235,1236,1237,1238,1239,1240,1243,1247,1244,1248]); -__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1232,[]); -__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1233,[]); -__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1234,[]); -__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1235,[]); -__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1240,[1241]); -__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1244,[1245,1246]); -__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1245,[]); -__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1246,[]); -__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1249,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1250,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1252,[1244,1232]); -__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1253,[]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1254,[1255]); -__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1256,[1255]); -__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1257,[]); -__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1258,[34,900,1259,25]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1259,[]); -__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1260,[30,34,794,848,865,25]); -__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1261,[806,30,34,102,1225,794,836,848,840,1224,1205,25]); -__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1262,[806,30,34,102,1200,794,848,865,836,827,840,1201,1205,25]); -__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1263,[806,30,34,794,848,865,827,840,1224,1205,25]); -__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1264,[806,30,34,794,848,865,840,1224,1205,25]); -__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1265,[30,34,794,827,1120,1266,848,840,25]); -__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}},1266,[]); -__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1267,[30,1075,34,402,102,794,827,848,840,25]); -__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1268,[829,30,34,1194,995,102,1200,794,830,836,1104,827,848,800,840,833,25]); -__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1269,[30,34,102,1196,794,830,852,848,840,1223,5,25]); -__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)}})]})}},1270,[829,30,34,102,1200,1198,794,830,836,827,848,840,25]); -__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1271,[829,1205,30,34,102,794,830,836,827,848,853,25]); -__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]})}},1272,[30,34,846,25]); -__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}},1273,[806,30,34,794,848,5,1205,25]); -__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."})})}},1274,[30,34,794,1275,1131,1205,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1275,[796,829,34,102,794,830,836,1131,1276,848,840,25]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1276,[931,985,1131]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1277,[30,34,846,1278,1333,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"})]}),qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1278,[1121,5,6,1279,798,822,1094,829,1120,1280,1281,1282,1091,1115,1283,1284,1286,1287,1288,1130,977,1099,1289,34,1073,1148,1033,1087,1116,1290,380,402,295,102,426,36,794,1185,1189,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1291,1107,1292,1295,1297,1300,1303,1299,1304,1306,1307,1112,1093,1095,852,1309,1174,1310,1184,1176,1011,1315,1323,1325,1076,1114,1327,1328,1329,1143,1330,1142,1136,838,1331,1332,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1280,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1281,[1012,1100]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1282,[34,102,1079,794,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1283,[829,34,102,794,848,1131,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1284,[34,395,402,426,102,1225,794,1143,1014,1285,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1285,[]); -__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}))},1286,[815]); -__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1287,[798,34,379,395,402,102,794,1143,840,25]); -__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return v}}),_e.SoldOutStrip=function({rid:e,now:k,by:w,onOpen:F}){const I=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[C,_]=(0,n.useState)(0),[A,H]=(0,n.useState)(!1),L=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{O()},[]);const D=k??(0,p.nowFrom)(z),W=(0,S.activeSoldOut)(I,e,D);if(!W.length)return null;const E=W.map(e=>(0,x.withReason)(e.name,L.reason(e.itemId))),M=(0,S.stripText)(E),P=C>0&&(0,S.stripNeedsTicker)(E,C,v),R=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=R);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>F?F():H(!0),onLayout:e=>_(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:b.colours.accentBorder},children:[(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:b.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,j.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,j.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&T?{whiteSpace:'nowrap'}:{},fontFamily:b.fonts.medium,fontSize:v,lineHeight:20,color:b.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!T?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:12,color:b.colours.muted},children:"Tap for all"}):null]}),F?null:(0,j.jsxs)(c.Sheet,{visible:A,onClose:()=>H(!1),title:(0,S.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[w?(0,j.jsx)(u.SoldOutList,{rid:e,by:w,hideLinks:!0}):(0,j.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,j.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:b.colours.border},children:[(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.semibold,fontSize:17,color:b.colours.text},children:e.name}),L.reason(e.itemId)?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.medium,fontSize:14,color:b.colours.amber},children:L.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted},children:["Since ",$(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${$(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const T='undefined'!=typeof document,k=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let w=!1;function O(){if(!T||w)return;w=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=k,document.head.appendChild(e)}const $=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},v=15},1288,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,978,840,25]); -__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])},1289,[798,34,102,840,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1290,[34,102,900,840,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1291,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1292,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1293,1294,1014,865,1107,25]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1293,[798,829,34,1294,102,828,840,794,1108,25]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1294,[828]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1295,[34,236,402,102,840,794,1143,1296,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1296,[]); -__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1297,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1298,840,794,1299,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1298,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1299,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1300,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1286,1301,2,1302,1303,848,827,25]); -__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1301,[236]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1303,[34,815,931,985,1302]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1304,[829,14,1014,1305]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1305,[830]); -__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1306,[34,102,900,840,25]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1307,[829,1014,34,102,794,1096,848,1308,1304,1095,1093,1112,1113,1114,840,1281,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1308,[1014,1079]); -__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1309,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1299,848,1014,830,1089,1079,1266,840,1281,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1310,[796,34,236,402,102,794,848,1014,1311,840,1312,1314,25]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1311,[]); -__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1312,[815,848,1014,1311,1313,1314]); -__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1313,[829]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1314,[236,1313]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1315,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1316,1319,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1316,[1317,839,829,34,281,395,402,295,102,848,1011,1014,1318,827,840,1041,794,1319,1320,985,1281,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1317,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1318,[852,827,851]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1319,[5,1014,931,985]); -__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})},1320,[815,931,985,1321,2,1322]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1321,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1322,[15]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1323,[34,102,900,794,1143,827,840,798,1324,1325,1326,25]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1324,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1325,[]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1326,[1079]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1327,[829,1305]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1328,[34,402,102,794,1327,840,1290,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1329,[34,102,899,794,1143,827,840,25]); -__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1330,[34,1143,402,102,426,794,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1331,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1320,985,25]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1332,[34,1021,865,1001,800,1022,994,1320,1070]); -__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1333,[5,798,847,34,236,402,102,426,985,840,794,1286,1334,25]); -__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}})()},1334,[]); -__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]})}},1335,[30,34,846,25]); +__d(function(g,_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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1159,[34,402,102,794,865,827,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1160,[34,102,794,865,840,1100,1103,1158,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1161,[34,102,1100,840,794,25]); +__d(function(g,r,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]})}},1162,[796,34,402,102,794,1019,840,928,25]); +__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1163,[796,1164,804,865,34,336,402,102,794,1019,1020,840,899,928,1165,1168,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1164,[34,1019,865,804]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1165,[798,796,1164,804,865,34,336,402,102,900,794,899,1019,1020,1166,840,928,1167,25]); +__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1166,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1167,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1168,[34,379,236,102,794,865,1019,1167,1020,1169,840,928,1164,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1169,[1020]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1170,[34,402,102,794,989,830,990,840,928,1171,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1171,[798,34,336,395,402,295,102,1172,794,989,830,990,827,840,1034,25,1174]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1172,[34,1173,102,830,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1173,[2,985]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1174,[]); +__d(function(g,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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1175,[829,34,236,402,102,900,848,840,794,1176,1099,1177,25]); +__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1176,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); +__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1177,[1178,1179,1181,1180,1182,1033,1183]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1178,[]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1179,[808,5,815,818,846,1033,1180]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1180,[829,236,846,1178]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1181,[34,848,830,838,836,1179,1178]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1182,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1183,[34,1179,985,931]); +__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1184,[34,402,102,426,848,830,840,794,1175,1099,1185,25]); +__d(function(g,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}},1185,[34,102,426,848,830,1177,1033,840,794,1099,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1186,[34,236,402,102,853,794,840,994,1187,1188,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1187,[846,6,931,974,994,1177,1188]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1188,[808,1189,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1189,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1190,[34,846,1187]); +__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1191,[796,1164,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1192,[34,402,346,102,426,840,1153,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1193,[30,34,792,846,25]); +__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1194,[829,1097,851,30,34,1195,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); +__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])},1195,[796,34,236,102,25]); +__d(function(_g,_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"})]})]})}},1196,[30,34,336,102,1172,1197,794,830,836,848,856,840,25]); +__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])},1197,[30,34,402,848,840,794,25]); +__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1198,[30,34,794,1199,848,1186,25]); +__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])},1199,[34,402,840,794,25]); +__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1200,[806,30,34,1201,794,836,848,840,1202,1206,25]); +__d(function(_g,r,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])},1201,[34,385,102,848,836,840,794,25]); +__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}},1202,[34,102,794,836,1203,1204,1205,840,25]); +__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})},1203,[]); +__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})},1204,[]); +__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()})},1205,[931,985,1204]); +__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}},1206,[815,931,974,985,2,1203]); +__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1207,[1208,1217,5,1218,1219,1220,1223,829,30,34,236,402,102,1172,1197,794,830,836,852,848,840,1224,1186,846,865,1171,989,990,997,1225,1206,25]); +__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1208,[34,379,794,847,1209,1210,1216,848,5,6,25]); +__d(function(g,r,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])},1209,[34,379,102,794,991,992,1044,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1210,[6,34,931,794,1211,25]); +__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]})]})}},1211,[6,1212,1213,1214,34,102,796,794,840,11,1215,25]); +__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1213,[4,11]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1214,[11]); +__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.'}},1215,[6,931]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1216,[34,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1217,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1218,[34,102,794,1211,25]); +__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1219,[34,379,931,794,847,1209,1211,4,25]); +__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1220,[34,379,794,1209,847,1210,8,1221,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1221,[34,102,794,1222,25]); +__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1222,[]); +__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1223,[34,794,847,1209,1210,848,9,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1224,[34,402,102,426,794,840,1153,25]); +__d(function(g,_r,_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)})]})}},1225,[34,102,1226,794,848,997,1203,1206,840,25]); +__d(function(g,r,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])},1226,[34,102,1227,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1227,[1228]); +__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1228,[34,900,1229,1258,1259,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1229,[1230]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1230,[1231,1232,1255,1257]); +__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1231,[]); +__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1232,[1233,1234,1235,1236,1237,1238,1239,1240,1241,1244,1248,1245,1249]); +__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1233,[]); +__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1234,[]); +__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1235,[]); +__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1236,[]); +__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1241,[1242]); +__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1245,[1246,1247]); +__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1246,[]); +__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1247,[]); +__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1250,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1251,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1253,[1245,1233]); +__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1254,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1255,[1256]); +__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1257,[1256]); +__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1258,[]); +__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1259,[34,900,1260,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1260,[]); +__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1261,[30,34,794,848,865,25]); +__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1262,[806,30,34,102,1226,794,836,848,840,1225,1206,25]); +__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1263,[806,30,34,102,1201,794,848,865,836,827,840,1202,1206,25]); +__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1264,[806,30,34,794,848,865,827,840,1225,1206,25]); +__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1265,[806,30,34,794,848,865,840,1225,1206,25]); +__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1266,[30,34,794,827,1120,1267,848,840,25]); +__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}},1267,[]); +__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1268,[30,1075,34,402,102,794,827,848,840,25]); +__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1269,[829,30,34,1195,995,102,1201,794,830,836,1104,827,848,800,840,833,25]); +__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1270,[30,34,102,1197,794,830,852,848,840,1224,5,25]); +__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)}})]})}},1271,[829,30,34,102,1201,1199,794,830,836,827,848,840,25]); +__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1272,[829,1206,30,34,102,794,830,836,827,848,853,25]); +__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]})}},1273,[30,34,846,25]); +__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}},1274,[806,30,34,794,848,5,1206,25]); +__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."})})}},1275,[30,34,794,1276,1131,1206,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1276,[796,829,34,102,794,830,836,1131,1277,848,840,25]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1277,[931,985,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1278,[30,34,846,1279,1334,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"}),G]}),Le,qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1279,[1121,5,6,1280,798,822,1094,829,1120,1281,1282,1283,1091,1115,1284,1285,1287,1288,1289,1130,977,1099,1290,34,1073,1148,1033,1087,1116,1291,380,402,295,102,426,36,794,1186,1190,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1292,1107,1293,1296,1298,1301,1304,1300,1305,1307,1308,1112,1093,1095,852,1310,1175,1311,1185,1177,1011,1316,1324,1326,1076,1114,1328,1329,1330,1143,1331,1142,1136,838,1332,1333,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1281,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1282,[1012,1100]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1283,[34,102,1079,794,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1284,[829,34,102,794,848,1131,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1285,[34,395,402,426,102,1226,794,1143,1014,1286,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1286,[]); +__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}))},1287,[815]); +__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1288,[798,34,379,395,402,102,794,1143,840,25]); +__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return F}}),_e.SoldOutStrip=function({rid:e,now:w,by:O,onOpen:I}){const C=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[_,A]=(0,n.useState)(0),[H,L]=(0,n.useState)(!1),D=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{$()},[]);const R=w??(0,p.nowFrom)(z),W=(0,b.activeSoldOut)(C,e,R);if(!W.length)return null;const E=W.map(e=>{const t=D.reason(e.itemId);return(0,x.withReason)(e.name,S.IS_CAR&&'none left'===t?'':t)}),M=(0,b.stripText)(E),P=_>0&&(0,b.stripNeedsTicker)(E,_,F),B=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=B);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>I?I():L(!0),onLayout:e=>A(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:j.colours.accentBorder},children:[(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:j.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,T.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,T.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&k?{whiteSpace:'nowrap'}:{},fontFamily:j.fonts.medium,fontSize:F,lineHeight:20,color:j.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!k?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:12,color:j.colours.muted},children:"Tap for all"}):null]}),I?null:(0,T.jsxs)(c.Sheet,{visible:H,onClose:()=>L(!1),title:(0,b.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[O?(0,T.jsx)(u.SoldOutList,{rid:e,by:O,hideLinks:!0}):(0,T.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,T.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.colours.border},children:[(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.semibold,fontSize:17,color:j.colours.text},children:e.name}),D.reason(e.itemId)?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.medium,fontSize:14,color:j.colours.amber},children:D.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted},children:["Since ",v(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${v(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]),T=r(_d[17]);const k='undefined'!=typeof document,w=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let O=!1;function $(){if(!k||O)return;O=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=w,document.head.appendChild(e)}const v=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},F=15},1289,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,846,978,840,25]); +__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])},1290,[798,34,102,840,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1291,[34,102,900,840,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1292,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1293,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1294,1295,1014,865,1107,25]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1294,[798,829,34,1295,102,828,840,794,1108,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1295,[828]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1296,[34,236,402,102,840,794,1143,1297,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1298,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1299,840,794,1300,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1299,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1300,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1301,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1287,1302,2,1303,1304,848,827,25]); +__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1302,[236]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1304,[34,815,931,985,1303]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1305,[829,14,1014,1306]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1306,[830]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1307,[34,102,900,840,25]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1308,[829,1014,34,102,794,1096,848,1309,1305,1095,1093,1112,1113,1114,840,1282,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1309,[1014,1079]); +__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1310,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1300,848,1014,830,1089,1079,1267,840,1282,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1311,[796,34,236,402,102,794,848,1014,1312,840,1313,1315,25]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1312,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1313,[815,848,1014,1312,1314,1315]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1314,[829]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1315,[236,1314]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1316,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1317,1320,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1317,[1318,839,829,34,281,395,402,295,102,848,1011,1014,1319,827,840,1041,794,1320,1321,985,1282,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1318,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1319,[852,827,851]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1320,[5,1014,931,985]); +__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})},1321,[815,931,985,1322,2,1323]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1322,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1323,[15]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1324,[34,102,900,794,1143,827,840,798,1325,1326,1327,25]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1325,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1326,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1327,[1079]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1328,[829,1306]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1329,[34,402,102,794,1328,840,1291,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1330,[34,102,899,794,1143,827,840,25]); +__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1331,[34,1143,402,102,426,794,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1332,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1321,985,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1333,[34,1021,865,1001,800,1022,994,1321,1070]); +__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1334,[5,798,847,34,236,402,102,426,985,840,794,1287,1335,25]); +__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}})()},1335,[]); __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]})}},1336,[30,34,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1337,[30,34,1338,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1338,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1339,[30,34,846,1340,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1340,[1341,1345,798,991,1073,1346,1160,1040,1041,1347,1349,1352,1130,977,1042,2,1047,1048,1354,993,34,1132,1185,1189,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1355,1070,1085,1086,1082,1043,1025,1100,1362,1363,1364,1372,1373,997,236,1191,1145,1151,1369,1155,1154,1380,1148,15,1161,1162,899,793,985,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1341,[796,34,1033,395,102,1107,1108,1292,1315,794,1011,1014,827,840,1100,1015,1342,1343,1035,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1342,[796,34,402,102,794,840,1014,5,1015,846,985,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1343,[34,102,794,1014,1344,828,840,1060,931,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1344,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1345,[34,102,794,1100,985,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1346,[829,34,102,794,830,836,1131,848,838,840,25]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1347,[985,34,281,236,102,1225,794,1202,1205,840,1348,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1348,[34,236,102,794,1202,25]); -__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1349,[34,102,794,830,1202,1350,1351,840,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1350,[830]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1351,[985,1350,1205]); -__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1352,[5,1353,34,102,794,836,1202,1203,1204,985,1205,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1353,[34,794,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1354,[34,102,794,840,993,1037,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1355,[5,1353,11,1356,796,806,1112,1113,1091,1115,1114,1327,1328,1100,1281,1012,1089,14,1357,1185,1358,1315,1081,1075,1090,34,102,794,1290,848,830,836,827,1266,840,1147,1096,1014,1359,1360,1136,1361,1176,985,1149,1323,852,25]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1356,[6,34,102,794,985,1214,25]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1357,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1358,[34,402,1143,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1359,[34,102,848,1014,794,840,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1360,[34,402,102,794,840,25]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1361,[34,102,853,848,833,840,794,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1362,[34,1316,1100,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1363,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1364,[804,982,1365,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1365,[796,1120,985,900,1174,1176,34,281,379,236,402,102,426,853,794,848,1185,865,836,827,840,1147,1100,838,1366,1135,1369,1370,1119,1126,1125,1024,13,1123,1371,1166,25]); -__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1366,[925,800,798,806,852,1061,1367,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1166,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1367,[499,1368]); -__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 t}});var t={}},1368,[]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1369,[796,34,1172,1041,839,379,402,102,794,865,836,827,840,1147,1100,1166,25]); -__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1370,[1042,34,402,102,794,865,840,1100,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1371,[798,34,283,364,236,102,426,900,794,796,840,1324,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1372,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); -__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1373,[5,1374,1375,1376,1377,1378,34,236,41,102,846,997,840,1379,794,985,2,1072,996,865,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1374,[34,102,847,794,5,6,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1375,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1376,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1377,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1378,[34,102,847,794,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1379,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const v=(0,m.useInStaffApp)(),{now:L,meId:N,me:A,r:z,today:H}=(0,m.useCtx)(3e4),O=(0,s.useTravelDay)('staff',H),P=(0,c.useOwner)(e=>e.shifts),R=(0,c.useOwner)(e=>e.attendance),F=(0,c.useOwner)(e=>e.staffCanViewSuppliers),_=(0,c.useOwner)(e=>e.quickLinks),E=(0,c.useOwner)(e=>e.chat),W=(0,c.useOwner)(e=>e.swaps),V=(0,c.useOwner)(e=>e.leave),q=P.filter(e=>e.staffId===N&&e.published&&e.date>=H).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),G=q.find(e=>e.date===H),U=R.filter(e=>e.staffId===N&&e.in&&!e.out&&L.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Y=(0,x.usePay)(N,0),Q=(0,b.useOrders)(z.id),K=(0,b.useBookings)(z.id),J=Q.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,K))),X=K.filter(e=>e.date===H&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,Q.filter(T.LIVE))),Z=K.filter(e=>(0,S.undoKind)(e,H)||e.walkIn&&'cancelled'===e.status&&e.date===H).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),ee=E.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],se=W.filter(e=>e.fromId===N&&'open'===e.status).length+V.filter(e=>e.staffId===N&&'pending'===e.status).length,te=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & leave',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...F?[['Suppliers',()=>e('more','suppliers')]]:[]];return!v&&O?(0,$.jsxs)(o.default,{style:{gap:10},children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(s.DayView,{rid:z.id,day:O,today:H,app:"staff"})]}):(0,$.jsxs)(o.default,{style:{gap:10},children:[v?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(t.CoversToday,{rid:z.id})]}),(0,$.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,$.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,$.jsx)(C.StaffAvatar,{id:N,size:52})}),(0,$.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",A.replace(' (example)','').split(' ')[0]]})]}),(0,$.jsx)(r.Badge,{kind:"gold",label:v?z.name:'Staff app preview'})]}),(0,$.jsx)(r.Muted,{children:v?`${L.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,$.jsx)(M.StaffTipsTile,{rid:z.id,today:H,onPress:()=>e('more','mytips')}),(0,$.jsxs)(r.Card,{highlight:U?u.colours.ok:void 0,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{weight:"semibold",children:U?`On shift since ${(0,h.hm)(new Date(U.in))}`:'Not clocked in'}),U?(0,$.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((L.getTime()-new Date(U.in).getTime())/6e4)))}):null]}),G?(0,$.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(G.start),"\u2013",(0,m.fmtH)(G.end)]}):q[0]?(0,$.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[q[0].day]," ",Number(q[0].date.slice(8))," ",(0,m.fmtH)(q[0].start),"\u2013",(0,m.fmtH)(q[0].end)]}):(0,$.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,$.jsx)(r.Button,{small:!0,kind:U?'secondary':'success',label:U?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),(0,$.jsx)(p.ShellfishTile,{rid:z.id,by:A.replace(' (example)',''),app:"staff"}),Z.length?(0,$.jsx)(r.Card,{children:(0,$.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",Z.length,")"]}),(0,$.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),Z.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,$.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,$.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,$.jsxs)(r.Muted,{children:[e.table?(0,D.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,$.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(z.id,e)}):null,e.walkIn?(0,$.jsx)(a.CancelWalkInButton,{rid:z.id,b:e,small:!0}):null,e.walkIn?(0,$.jsx)(a.ReinstateWalkInButton,{rid:z.id,b:e,today:H,small:!0}):null,(0,$.jsx)(S.BookingUndo,{b:e,rid:z.id,today:H,who:s})]})]},e.id)})]})}):null,J.length+X.length?(0,$.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",J.length+X.length,")"]}),(0,$.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),J.map(e=>(0,$.jsx)(j.AllergyChain,{o:e,me:A},e.id)),X.map(e=>(0,$.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,I.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,$.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsx)(j.BookingAllergyChain,{b:e,me:A}),(0,$.jsx)(o.default,{style:{flexDirection:'row'},children:(0,$.jsx)(w.WhatsAppGuest,{b:e,rid:z.id,kind:"auto"})})]},e.id))]}):null,ee?(0,$.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,$.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,$.jsx)(r.T,{size:14,children:ee.text})]}):null,(0,$.jsxs)(r.Card,{children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,$.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Y.paid)," paid hours"]})]}),se?(0,$.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,$.jsxs)(r.T,{size:14,children:["You have ",se," request",se>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(_,'staff').length?(0,$.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,$.jsx)(y.QuickLinksRow,{compact:!0})]}):null,v?null:(0,$.jsx)(o.default,{style:{gap:6},children:te.map(([e,s])=>(0,$.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),D=_r(d[23]),I=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27])},1380,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1366,1136,850,1149,838,1147,899,1359,1014,829,1096,1154,25]); -__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]})}},1381,[30,34,846,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1382,[1383,985,795,1334,1385,1011,30,1412,496,34,385,336,236,41,102,5,847,846,1414,36,848,1014,865,840,1373,997,1010,1417,1418,1419,1420,1099,2,1024,1440,1303,25,1441,1442,1443,1444]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1383,[2,796,34,236,383,102,794,1384,985,840,1151,997,865,988,25]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1384,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1385,[1386,1409,1411]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1386,[215,1387,1390,1404,1405,1406,1407,1408]); -__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1387,[215,1388]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1388,[1389]); -__d(function(g,r,i,a,m,e,d){},1389,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1390,[1391,215,1387,1404,1405]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1391,[1392,1393,1403]); -__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1392,[1393,1397,1402]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1393,[215,372,1394,1398,1399,1400,1401,1397,1402]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1394,[215,1395,339,280,1396,1397]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1395,[504]); -__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1396,[215,339]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1397,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1398,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1399,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1400,[1398]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1401,[]); -__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1402,[372,1396]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1403,[34,1393]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1404,[1391,215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1405,[1391,1404]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1406,[1387]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1407,[215,1387,1390,1388]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1408,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1409,[215,54,1410]); -__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1410,[215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1411,[34,1386]); -__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]}})})},1412,[1413]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1413,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1414,[34,41,102,426,794,847,997,985,2,5,840,1415,1416,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),e.railSizes=function(s,o){const l=s>=1600?168:s>=1200?136:120,t=Math.floor((o-44)/12),n=Math.max(44,Math.min(72,t-18));return{railW:l,per:t,circle:n,label:t>=80?13:t>=66?11:10,icon:Math.round(.46*n)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return o}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}];const o=s=>s.split('').join(' ')},1415,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1416,[34,102,794,840,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1417,[986,857,856,985]); -__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1418,[798,796,34,1342,1015,402,102,846,985,1007,1014,5,840,794,1286,974,2,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1419,[796,34,236,402,102,840,985,1045,2,25]); -__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1420,[5,796,34,385,283,364,380,236,402,295,426,102,1421,1116,2,900,1100,15,865,794,840,1422,930,1436,1432,1433,1437,1117,1438,929,1439,1435,25,277]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"useAssistantUi",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AssistantFab",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AssistantSheet",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"AssistantPage",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AssistantSettings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"AssistantPlanCard",{enumerable:!0,get:function(){return c}});const t=!1,n={getState:()=>({open:!1,setOpen:t=>{}})},u=()=>null,s=()=>null,l=()=>null,o=()=>null,c=()=>null},1421,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${O[t.risk]}${$(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if($(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(c.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const c=(0,l.searchHelp)(p.HELP,e,3);return c.length?{kind:'help',ids:c.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,O={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},$=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);return e.staffId&&e.date&&a>t?(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`):'That shift isn\u2019t complete.'}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...u.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1422,[1423,1098,829,1426,1427,865,848,1014,1431,1432,1433,1429,1428,1434,1435,1012,1013]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1423,[1424,1425,1038]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1424,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1425,[34,846,1424,827,985,931]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1426,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1427,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1428,1426]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1428,[804,1098,829,1120,1205,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1429,1430]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1429,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1430,[808,815,818]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1431,[798,34,283,364,236,402,102,815,794,840,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1432,[]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1433,[]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1434,[800,865,989,836,1428,1032]); -__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1435,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1436,[865,800,1014]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1437,[815]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1438,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1439,[815]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=f(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),A=[],k=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);i.includes(c)||(A.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0}),d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:u(d,23.5)}:void 0}):d===y&&e<=m&&k.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:u(d,e-.05),inSite:!0}))}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!A.some(e=>e.staffId===t.staffId&&e.date===t.date)),...A],attendance:[...S.attendance,...k]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:u(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:u((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',f=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,u=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1440,[848,800,865,1024,15,997,846]); -__d(function(e,o,s,p,t,a,n){"use strict";t.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1441,[]); -__d(function(e,o,s,p,c,t,d){"use strict";c.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1442,[]); -__d(function(o,e,s,p,f,t,d){"use strict";f.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1443,[]); -__d(function(o,s,e,p,d,t,n){"use strict";d.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1444,[]); -__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]})}},1445,[30,34,846,25]); -__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1446,[1447]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1447,[25,1448,591]); -__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1448,[34,172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1449,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1450,[25,499,34,270,651]); +__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]})}},1337,[30,34,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1338,[30,34,1339,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1339,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1340,[30,34,846,1341,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1341,[1342,1346,798,991,1073,1347,1161,1040,1041,1348,1350,1353,1130,977,1042,2,1047,1048,1355,993,34,1132,1186,1190,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1356,1070,1085,1086,1082,1043,1025,1100,1363,1364,1365,1373,1374,997,236,1192,1145,1151,1370,1155,1154,1381,1148,15,1162,1163,899,793,985,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1342,[796,34,1033,395,102,1107,1108,1293,1316,794,1011,1014,827,840,1100,1015,1343,1344,1035,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1343,[796,34,402,102,794,840,1014,5,1015,846,985,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1344,[34,102,794,1014,1345,828,840,1060,931,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1345,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1346,[34,102,794,1100,985,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1347,[829,34,102,794,830,836,1131,848,838,840,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1348,[985,34,281,236,102,1226,794,1203,1206,840,1349,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1349,[34,236,102,794,1203,25]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1350,[34,102,794,830,1203,1351,1352,840,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1351,[830]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1352,[985,1351,1206]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1353,[5,1354,34,102,794,836,1203,1204,1205,985,1206,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1354,[34,794,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1355,[34,102,794,840,993,1037,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1356,[5,1354,11,1357,796,806,1112,1113,1091,1115,1114,1328,1329,1100,1282,1012,1089,14,1358,1186,1359,1316,1081,1075,1090,34,102,794,1291,848,830,836,827,1267,840,1147,1096,1014,1360,1361,1136,1362,1177,985,1149,1324,852,25]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1357,[6,34,102,794,985,1215,25]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1358,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1359,[34,402,1143,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1360,[34,102,848,1014,794,840,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1361,[34,402,102,794,840,25]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1362,[34,102,853,848,833,840,794,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1363,[34,1317,1100,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1364,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1365,[804,982,1366,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1366,[796,1120,985,900,1175,1177,34,281,379,236,402,102,426,853,794,848,1186,865,836,827,840,1147,1100,838,1367,1135,1370,1371,1119,1126,1125,1024,13,1123,1372,1167,25]); +__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1367,[925,800,798,806,852,1061,1368,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1167,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1368,[499,1369]); +__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 t}});var t={}},1369,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1370,[796,34,1173,1041,839,379,402,102,794,865,836,827,840,1147,1100,1167,25]); +__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1371,[1042,34,402,102,794,865,840,1100,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1372,[798,34,283,364,236,102,426,900,794,796,840,1325,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1373,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); +__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1374,[5,1375,1376,1377,1378,1379,34,236,41,102,846,997,840,1380,794,985,2,1072,996,865,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1375,[34,102,847,794,5,6,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1376,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1377,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1378,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1379,[34,102,847,794,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1380,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const L=(0,m.useInStaffApp)(),{now:N,meId:A,me:O,r:R,today:z}=(0,m.useCtx)(3e4),H=(0,s.useTravelDay)('staff',z),P=(0,h.useOwner)(e=>e.shifts),F=(0,h.useOwner)(e=>e.attendance),_=(0,h.useOwner)(e=>e.staffCanViewSuppliers),E=(0,h.useOwner)(e=>e.quickLinks),W=(0,h.useOwner)(e=>e.chat),q=(0,h.useOwner)(e=>e.swaps),V=(0,h.useOwner)(e=>e.leave),G=P.filter(e=>e.staffId===A&&e.published&&e.date>=z).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),U=G.find(e=>e.date===z),Y=F.filter(e=>e.staffId===A&&e.in&&!e.out&&N.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Q=(0,x.usePay)(A,0),K=(0,b.useOrders)(R.id),J=(0,b.useBookings)(R.id),X=K.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,J))),Z=J.filter(e=>e.date===z&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,K.filter(T.LIVE))),ee=J.filter(e=>(0,S.undoKind)(e,z)||e.walkIn&&'cancelled'===e.status&&e.date===z).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),se=W.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],te=q.filter(e=>e.fromId===A&&'open'===e.status).length+V.filter(e=>e.staffId===A&&'pending'===e.status).length,ie=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],..._?[['Suppliers',()=>e('more','suppliers')]]:[]];return!L&&H?(0,v.jsxs)(o.default,{style:{gap:10},children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(s.DayView,{rid:R.id,day:H,today:z,app:"staff"})]}):(0,v.jsxs)(o.default,{style:{gap:10},children:[L?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(t.CoversToday,{rid:R.id})]}),(0,v.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,v.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,v.jsx)(C.StaffAvatar,{id:A,size:52})}),(0,v.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",O.replace(' (example)','').split(' ')[0]]})]}),(0,v.jsx)(r.Badge,{kind:"gold",label:L?R.name:'Staff app preview'})]}),(0,v.jsx)(r.Muted,{children:L?`${N.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,v.jsx)(M.StaffTipsTile,{rid:R.id,today:z,onPress:()=>e('more','mytips')}),(0,v.jsxs)(r.Card,{highlight:Y?u.colours.ok:void 0,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{weight:"semibold",children:Y?`On shift since ${(0,c.hm)(new Date(Y.in))}`:'Not clocked in'}),Y?(0,v.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((N.getTime()-new Date(Y.in).getTime())/6e4)))}):null]}),U?(0,v.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(U.start),"\u2013",(0,m.fmtH)(U.end)]}):G[0]?(0,v.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[G[0].day]," ",Number(G[0].date.slice(8))," ",(0,m.fmtH)(G[0].start),"\u2013",(0,m.fmtH)(G[0].end)]}):(0,v.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,v.jsx)(r.Button,{small:!0,kind:Y?'secondary':'success',label:Y?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),A?(0,v.jsx)($.RequestTimeOff,{meId:A,me:O,testID:"staff-home-time-off"}):null,(0,v.jsx)(p.ShellfishTile,{rid:R.id,by:O.replace(' (example)',''),app:"staff"}),ee.length?(0,v.jsx)(r.Card,{children:(0,v.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ee.length,")"]}),(0,v.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),ee.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,v.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,v.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,v.jsxs)(r.Muted,{children:[e.table?(0,I.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,v.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(R.id,e)}):null,e.walkIn?(0,v.jsx)(a.CancelWalkInButton,{rid:R.id,b:e,small:!0}):null,e.walkIn?(0,v.jsx)(a.ReinstateWalkInButton,{rid:R.id,b:e,today:z,small:!0}):null,(0,v.jsx)(S.BookingUndo,{b:e,rid:R.id,today:z,who:s})]})]},e.id)})]})}):null,X.length+Z.length?(0,v.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",X.length+Z.length,")"]}),(0,v.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),X.map(e=>(0,v.jsx)(j.AllergyChain,{o:e,me:O},e.id)),Z.map(e=>(0,v.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,D.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,v.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,I.tablesLabel)(e.table)}`:'']}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsx)(j.BookingAllergyChain,{b:e,me:O}),(0,v.jsx)(o.default,{style:{flexDirection:'row'},children:(0,v.jsx)(w.WhatsAppGuest,{b:e,rid:R.id,kind:"auto"})})]},e.id))]}):null,se?(0,v.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,v.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,v.jsx)(r.T,{size:14,children:se.text})]}):null,(0,v.jsxs)(r.Card,{children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,v.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Q.paid)," paid hours"]})]}),te?(0,v.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,v.jsxs)(r.T,{size:14,children:["You have ",te," request",te>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(E,'staff').length?(0,v.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,v.jsx)(y.QuickLinksRow,{compact:!0})]}):null,L?null:(0,v.jsx)(o.default,{style:{gap:6},children:ie.map(([e,s])=>(0,v.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27]),v=_r(d[28])},1381,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1367,1136,850,1149,838,1147,899,1360,1014,829,1096,1154,1159,25]); +__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]})}},1382,[30,34,846,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1383,[1384,985,795,1335,1386,1011,30,1413,496,34,385,336,236,41,102,5,847,846,1415,36,848,1014,865,840,1374,997,1010,1418,1419,1420,1421,1099,2,1024,1441,1304,25,1442,1443,1444,1445]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1384,[2,796,34,236,383,102,794,1385,985,840,1151,997,865,988,25]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1385,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1386,[1387,1410,1412]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1387,[215,1388,1391,1405,1406,1407,1408,1409]); +__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1388,[215,1389]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1389,[1390]); +__d(function(g,r,i,a,m,e,d){},1390,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1391,[1392,215,1388,1405,1406]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1392,[1393,1394,1404]); +__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1393,[1394,1398,1403]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1394,[215,372,1395,1399,1400,1401,1402,1398,1403]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1395,[215,1396,339,280,1397,1398]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1396,[504]); +__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1397,[215,339]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1398,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1399,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1400,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1401,[1399]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1402,[]); +__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1403,[372,1397]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1404,[34,1394]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1405,[1392,215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1406,[1392,1405]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1407,[1388]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1408,[215,1388,1391,1389]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1409,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1410,[215,54,1411]); +__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1411,[215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1412,[34,1387]); +__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]}})})},1413,[1414]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1414,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1415,[34,41,102,426,794,847,997,985,2,5,840,1416,1417,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"RAIL_TITLE",{enumerable:!0,get:function(){return o}}),e.railSizes=function(s,l){const t=l>=1e3?13:11,n=Math.round(1.45*t),c=48+n+8,b=Math.floor((l-o-12)/12)>=c?1:2,h=12/b,p=Math.floor((l-o-12)/h),u=1===b?s>=1600?168:s>=1200?136:120:s>=1600?128:s>=1100?100:88,f=Math.max(44,Math.min(1===b?72:64,p-n-12,u-24));return{railW:u*b,colW:u,cols:b,per:p,circle:f,label:t,lineH:n,icon:Math.round(.46*f)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return l}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}],o=32;const l=s=>s.split('').join(' ')},1416,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1417,[34,102,794,840,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1418,[986,857,856,985]); +__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1419,[798,796,34,1343,1015,402,102,846,985,1007,1014,5,840,794,1287,974,2,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1420,[796,34,236,402,102,840,985,1045,2,25]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1421,[5,796,34,385,283,364,380,236,402,295,426,102,1422,1116,2,900,1100,15,865,794,840,1423,930,1437,1433,1434,1438,1117,1439,929,1440,1436,25,277]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"useAssistantUi",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AssistantFab",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AssistantSheet",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"AssistantPage",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AssistantSettings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"AssistantPlanCard",{enumerable:!0,get:function(){return c}});const t=!1,n={getState:()=>({open:!1,setOpen:t=>{}})},u=()=>null,s=()=>null,l=()=>null,o=()=>null,c=()=>null},1422,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${$[t.risk]}${O(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if(O(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(u.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const u=(0,l.searchHelp)(p.HELP,e,3);return u.length?{kind:'help',ids:u.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,$={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},O=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);if(!(e.staffId&&e.date&&a>t))return'That shift isn\u2019t complete.';const s=(0,n.leaveOn)(n.useOwner.getState().leave,String(e.staffId),String(e.date));return s?`${_(e.staffId)} has time off then (${N(s.from)} to ${N(s.to)}). Add the shift on the Rota yourself if they\u2019ve agreed to work.`:(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`)}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...c.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1423,[1424,1098,829,1427,1428,865,848,1014,1432,1433,1434,1430,1429,1435,1436,1012,1013]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1424,[1425,1426,1038]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1425,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1426,[34,846,1425,827,985,931]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1427,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1428,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1429,1427]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1429,[804,1098,829,1120,1206,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1430,1431]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1430,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1431,[808,815,818]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1432,[798,34,283,364,236,402,102,815,794,840,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1433,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1434,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1435,[800,865,989,836,1429,1032]); +__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1436,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1437,[865,800,1014]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1438,[815]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1439,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1440,[815]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=u(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),k=[],A=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);if(i.includes(c))continue;k.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0});const u='st-jack'===t?{auto:'rota'}:{};d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:f(d,23.5)}:void 0,...u}):d===y&&e<=m&&A.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:f(d,u.auto?e:e-.05),inSite:!0,...u})}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!k.some(e=>e.staffId===t.staffId&&e.date===t.date)),...k],attendance:[...S.attendance,...A]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:f(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:f((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,f=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1441,[848,800,865,1024,15,997,846]); +__d(function(e,o,s,p,t,a,n){"use strict";t.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1442,[]); +__d(function(e,o,s,p,c,t,d){"use strict";c.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1443,[]); +__d(function(o,e,s,p,f,t,d){"use strict";f.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1444,[]); +__d(function(o,s,e,p,d,t,n){"use strict";d.exports="/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1445,[]); +__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]})}},1446,[30,34,846,25]); +__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1447,[1448]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1448,[25,1449,591]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1449,[34,172]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1450,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1451,[25,499,34,270,651]); __r(501); __r(21); __r(0); \ No newline at end of file diff --git a/chef-app/admin.html b/chef-app/admin.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/admin.html +++ b/chef-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer.html b/chef-app/customer.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer.html +++ b/chef-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage.html b/chef-app/customer/anchorage.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage.html +++ b/chef-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/book.html b/chef-app/customer/anchorage/book.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/book.html +++ b/chef-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/feedback.html b/chef-app/customer/anchorage/feedback.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/feedback.html +++ b/chef-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/gift.html b/chef-app/customer/anchorage/gift.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/gift.html +++ b/chef-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/lost.html b/chef-app/customer/anchorage/lost.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/lost.html +++ b/chef-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/loyalty.html b/chef-app/customer/anchorage/loyalty.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/loyalty.html +++ b/chef-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/merch.html b/chef-app/customer/anchorage/merch.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/merch.html +++ b/chef-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/offers.html b/chef-app/customer/anchorage/offers.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/offers.html +++ b/chef-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/refer.html b/chef-app/customer/anchorage/refer.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/refer.html +++ b/chef-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/waitlist.html b/chef-app/customer/anchorage/waitlist.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/waitlist.html +++ b/chef-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/anchorage/whatson.html b/chef-app/customer/anchorage/whatson.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/anchorage/whatson.html +++ b/chef-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/basket.html b/chef-app/customer/basket.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/basket.html +++ b/chef-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/customer/profile.html b/chef-app/customer/profile.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/customer/profile.html +++ b/chef-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/demo.html b/chef-app/demo.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/demo.html +++ b/chef-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/display.html b/chef-app/display.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/display.html +++ b/chef-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/index.html b/chef-app/index.html index 667bef2e3e58bc4c21472e33f56843e42696b91e..0ea2cbcc5d6b6b7cb3131602c9c5e97c7c86ba7b 100644 --- a/chef-app/index.html +++ b/chef-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/kitchen.html b/chef-app/kitchen.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/kitchen.html +++ b/chef-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/owner.html b/chef-app/owner.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/owner.html +++ b/chef-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/staff.html b/chef-app/staff.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/staff.html +++ b/chef-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/chef-app/sw.js b/chef-app/sw.js index 06b3865291686d43e3f2b138a770c332bb4ea1c4..4be08b23b23a14693c4d1be5710c984c7e9d3597 100644 --- a/chef-app/sw.js +++ b/chef-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Head Chef service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-chef-178aec417b"; +const V = "cc-chef-37f427335f"; const BASE = "/chef-app/"; -const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=178aec417bef5873346c6b08dbef5ff7958946aef63aafb0293b89f80b10fb51"]; +const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=37f427335fe81e73a36a24a5f4e3081821a7fc2d25e9e4bdefb2ee1cdc6e2715"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/chef-app/team.html b/chef-app/team.html index 1221cb5c71bf718e99e532e2538c69432f7b3291..a3aa44e0dbdc491d4596b71fa12014a16668aac7 100644 --- a/chef-app/team.html +++ b/chef-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/_expo/static/js/web/bundle.js b/customer-app/_expo/static/js/web/bundle.js index fbccd1ee6a193c25692646132da7fd2b3b89a1df..55be8a015a37f42703ae8e1f153f860bccaa54a2 100644 --- a/customer-app/_expo/static/js/web/bundle.js +++ b/customer-app/_expo/static/js/web/bundle.js @@ -23,11 +23,11 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_VENUE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PITCH_TEAM",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_TEXT",{enumerable:!0,get:function(){return o}}),e.pitchText=function(a){let n=a;for(const[a,t]of o)a.test(n)?(a.lastIndex=0,n=n.replace(a,t)):a.lastIndex=0;return n};const a={name:'The Harbour Kitchen',tagline:'Harbourside seafood & seasonal plates',location:'12 Quay Street, Portmorran',phone:'01632 960 123',website:'harbourkitchen.example'},n={'st-tracy':{name:'Morgan',job:'Owner',hourlyPence:null,salaried:!0},'st-gordon':{name:'Alex',job:'General Manager',dept:'Management',hourlyPence:null,salaried:!0},'st-bisto':{name:'Ravi',job:'Head Chef',hourlyPence:null,salaried:!0},'st-agate':{name:'Priya',job:'Front of house supervisor',hourlyPence:1450},'st-lenny':{name:'Tom',job:'Commis Chef',hourlyPence:1325},'st-finn':{name:'Lewis',job:'Bar staff',hourlyPence:1290},'st-eilidh':{name:'Chloe',job:'Front of house',hourlyPence:1271},'st-emily':{name:'Ellie',job:'Front of house',hourlyPence:1271},'st-lillie':{name:'Jordan',job:'Kitchen porter (KP)',hourlyPence:1271},'st-jack':{name:'Sam',job:'Kitchen porter (KP)',hourlyPence:1271}},o=[['Harbour View, Dunure, South Ayrshire',a.location],['Harbour View, Dunure',a.location],['Harbour View mug','Harbour Kitchen mug'],['Harbour View','Quay Street'],['anchoragedunure.com',a.website],['01292 502826',a.phone],['Mini Anchors','Little Crew'],['The Anchorage',a.name],['Anchorage','Harbour Kitchen'],['ANCHORAGE','HARBOUR KITCHEN'],['South Ayrshire','the Firth coast'],['Ayrshire','the Firth coast'],['Dunure','Portmorran'],['Kittyfisher boat (Big Sean)','Coastal Fish Co'],['Kittyfisher','Coastal Fish Co'],['Big Sean','Coastal Fish Co'],['Example Fish Co.','Coastal Fish Co'],['Sample Dairy Ltd','Hillside Dairy'],['Sample Fruit & Veg','Fieldfare Veg'],['Mills milk','Hillside Dairy milk'],['Mills','Hillside Dairy'],['J. Pieroni & Sons','Fieldfare Veg'],["Pieroni's",'Fieldfare Veg'],['Pieroni','Fieldfare Veg'],['Alsons (drinks)','Drinks wholesaler'],['Alsons','the drinks wholesaler'],['Spes Bona','the deli wholesaler'],['Tarelgin','the butcher'],['Reids','the bakery'],['Reeds','the bakery'],['Example Butchers Ltd','Quayside Butchers'],['Example Dry Goods Wholesale','Dry goods wholesaler'],['Sample Brewing Co.','Harbourside Brewing'],['Example Cleaning Supplies','Cleaning supplies'],['Sample Packaging Ltd','Packaging supplier'],['Example Kitchen Repairs','Kitchen repairs'],['Preston','Ravi'],['Bisto','Ravi'],['Tracy','Morgan'],['James','Morgan'],['Gordon','Alex'],['Agate','Priya'],['Lenny','Tom'],['Finn','Lewis'],['Eilidh','Chloe'],['Emily','Ellie'],['Gabrielle','Ellie'],['Cameron Mc','Sam'],['Cameron','Sam'],['Lillie','Jordan'],['Lily','Jordan'],['Mia','Jordan'],['Jack','Sam'],['Harvey','Jordan'],['Anna','the supplier'],['(preview)',''],[' (example)','']].map(([a,n])=>[new RegExp(`${/^[A-Za-z]/.test(a)?'(?g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`](_),globalThis.__webpack_require__=o=>{const t=ErrorUtils.reportFatalError;_&&(ErrorUtils.reportFatalError=_=>{throw _});try{return g[`${__METRO_GLOBAL_PREFIX__}__r`](o)}finally{_&&(ErrorUtils.reportFatalError=t)}}},23,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1423,1426]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1424,1427]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},25,[26]); __d(function(g,r,i,a,m,e,d){ /** @@ -41,7 +41,7 @@ __d(function(g,r,i,a,m,e,d){ */ "use strict";var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(t,o,f){var l=null;if(void 0!==f&&(l=""+f),void 0!==o.key&&(l=""+o.key),"key"in o)for(var y in f={},o)"key"!==y&&(f[y]=o[y]);else f=o;return o=f.ref,{$$typeof:n,type:t,key:l,ref:void 0!==o?o:null,props:f}}e.Fragment=t,e.jsx=o,e.jsxs=o},26,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ctx",{enumerable:!0,get:function(){return t}});const t=r(d[0])},27,[28]); -__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1183,1184,1186,1190,1192,1199,1255,1256,1257,1258,1259,1260,1262,1263,1264,1265,1266,1267,1268,1269,1272,1330,1331,1332,1334,1377,1378,1422]); +__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1184,1185,1187,1191,1193,1200,1256,1257,1258,1259,1260,1261,1263,1264,1265,1266,1267,1268,1269,1270,1273,1331,1332,1333,1335,1378,1379,1423]); __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]})}},29,[30,34,792,846,988,25]); __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)},30,[31,32,782,783,785]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},31,[]); @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1159,1160,899,997,1161,1133,1162,1163,1164,1173,1166,1132,1175,1179,1156,848,1180,1130,985,1182,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1160,1161,899,997,1162,1133,1163,1164,1165,1174,1167,1132,1176,1180,1156,848,1181,1130,985,1183,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,899,927,924,840,928,25]); __d(function(g,_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 C.webLine}}),_e.T=R,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return T}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:l=!0,right:o,maxWidth:n=640,footer:s,scroll:c=!0}){const h=(0,S.jsxs)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===k.APP_VARIANT?(0,S.jsx)(D,{}):null]});return(0,S.jsxs)(x.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,S.jsx)(A,{title:t,subtitle:r,back:l,right:o})}),c?(0,S.jsx)(u.default,{contentContainerStyle:{paddingBottom:40},children:h}):(0,S.jsx)(f.default,{style:{flex:1},children:h}),s?(0,S.jsx)(f.default,{style:O.footer,children:(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=z,_e.Card=v,_e.Badge=function({label:e,kind:t="neutral"}){const r={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,S.jsx)(f.default,{style:[O.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:I?'center':'flex-start'}],children:(0,S.jsx)(R,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return E}}),_e.Row=V,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return $}}),_e.Field=function({label:e,...r}){return(0,S.jsxs)(f.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,S.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...r,style:[O.input,r.multiline&&{minHeight:70,textAlignVertical:'top'},r.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:l,sub:o,testID:n,accessibilityLabel:s}){return(0,S.jsxs)(c.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${s??e}${!s&&o?`, ${o}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:r,style:[O.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e.trim()}),o?(0,S.jsx)(R,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:o}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:l,disabled:o,a11y:n}){return(0,S.jsxs)(V,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,S.jsx)(R,{style:{flex:1,flexShrink:1},children:r}),(0,S.jsx)(b.default,{testID:l,disabled:o,accessibilityLabel:n??r,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:r=1,max:l=20,label:o,step:n=1,format:s,testID:u}){const h=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,S.jsxs)(V,{gap:10,children:[(0,S.jsx)(c.default,{testID:u?`${u}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${o??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[O.stepBtn,e<=r?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,S.jsx)(f.default,{testID:u?`${u}-value`:void 0,accessibilityLabel:o?`${o}: ${h}`:h,children:(0,S.jsx)(R,{weight:"semibold",size:p.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:h})}),(0,S.jsx)(c.default,{testID:u?`${u}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${o??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,b(e+n))),style:[O.stepBtn,e>=l?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:r,children:l,maxWidth:n,testID:h,footer:b}){const{height:j}=(0,y.default)(),C=o.default.useContext(x.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},w=Math.max(320,j-C.top-C.bottom-24);return(0,S.jsx)(s.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,S.jsx)(f.default,{style:[O.overlay,{padding:12,paddingTop:12+C.top,paddingBottom:12+C.bottom}],children:(0,S.jsxs)(f.default,{style:[O.sheet,{maxHeight:w},n?{maxWidth:n}:null],testID:h,children:[(0,S.jsxs)(V,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,S.jsx)(P,{style:{flex:1},children:r}),(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:B?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,S.jsx)(R,{size:B?18:24,colour:p.colours.text,children:B?'Close':'\u2715'})})]}),(0,S.jsx)(u.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:l}),b?(0,S.jsx)(f.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:h?`${h}-footer`:void 0,children:b}):null]})})})},_e.SectionTitle=function({children:e}){return(0,S.jsx)(R,{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 O}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),l=_r(d[3]),o=e(_r(d[4])),n=e(_r(d[5])),s=e(_r(d[6]));_r(d[7]);var c=e(_r(d[8])),u=e(_r(d[9])),h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=_r(d[14]),p=_r(d[15]),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),k=_r(d[19]),W=_r(d[20]),S=_r(d[21]);const B=['kirkton','abbotsford'].includes(w.VENUE_RID),I='display'!==k.APP_VARIANT;function R({children:e,style:r,size:l=p.font.body,weight:o="regular",colour:n=p.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:b,accessibilityLabel:f}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,w=h.default.flatten(r)||{},k=1===w.flex||1===w.flexGrow||'number'==typeof w.width||'left'===w.textAlign,W=c??(I&&('semibold'===o||'bold'===o)&&!k);return(0,S.jsx)(t.Text,{testID:u??(y?'cc-url':void 0),...W?{dataSet:{centre:'heading'}}:{},accessibilityRole:b,accessibilityLabel:f,numberOfLines:s,style:[{minWidth:0,fontFamily:p.fonts[o],fontSize:l,color:n,lineHeight:(0,j.lineFor)(l)},W&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},r,x,(0,C.webLine)(r,l),W&&'left'!==w.textAlign?{textAlign:'center'}:null],children:e})}const L=e=>(0,S.jsx)(R,{size:p.font.title,weight:"semibold",center:!0,...e}),P=e=>(0,S.jsx)(R,{size:p.font.large,weight:"semibold",center:!0,...e}),T=e=>(0,S.jsx)(R,{colour:p.colours.muted,size:p.font.small,...e,center:e.center??I});function A({title:e,back:t=!0,right:l,subtitle:o}){return(0,S.jsxs)(f.default,{style:O.brandBar,children:[(0,S.jsxs)(f.default,{style:O.row,children:[(0,S.jsx)(f.default,{style:O.brandSide,children:t?(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>r.router.canGoBack()?r.router.back():r.router.replace(k.ENTRY[k.APP_VARIANT]),style:O.backBtn,hitSlop:10,children:(0,S.jsx)(R,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,S.jsx)(c.default,{onPress:()=>r.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:O.brandCenter,children:(0,S.jsx)(W.RestaurantBrand,{size:W.HEADER_LOGO})}),(0,S.jsx)(f.default,{style:[O.brandSide,{alignItems:'flex-end'}],children:l?(0,S.jsx)(f.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,S.jsx)(L,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,S.jsx)(T,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function D(){const e=(0,r.useLocalSearchParams)().rid??w.VENUE_RID,t=(0,l.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,S.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{n.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,S.jsx)(R,{center:!0,size:14,colour:p.colours.gold,children:t})}):null}function z({label:e,sub:t,onPress:r,kind:l="primary",disabled:o,small:n,style:s,accessibilityLabel:u,accessibilityHint:h,testID:b}){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],x={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,S.jsxs)(c.default,{testID:b,accessibilityRole:"button",accessibilityLabel:u??e,accessibilityHint:h,accessibilityState:{disabled:!!o},disabled:o,onPress:r,style:({pressed:e})=>[O.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:x,opacity:o?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:j.control.min,minWidth:44},s],children:[(0,S.jsx)(R,{weight:"semibold",size:n?p.font.small:p.font.body,colour:y,center:!0,children:e.trim()}),t?(0,S.jsx)(R,{size:n?p.font.small-2:p.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function v({children:e,style:t,onPress:r,highlight:l}){const o=l===p.colours.gold||l===p.colours.accentBorder,n=(0,S.jsx)(f.default,{testID:"cc-card",style:[O.card,{alignItems:'stretch'},l?{borderColor:o?p.colours.accentBorder:l,borderWidth:o?1:2}:null,t],children:e});return r?(0,S.jsx)(c.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function F({kind:e="info",title:t,children:r}){const l={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,S.jsxs)(f.default,{accessibilityRole:"summary",style:[O.banner,{backgroundColor:l[0],borderLeftColor:l[1]}],children:[t?(0,S.jsx)(R,{weight:"semibold",colour:l[2],center:!0,children:t}):null,o.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,S.jsx)(R,{size:p.font.small,colour:l[2],center:!0,children:r}):r]})}T.statusLine=!0,z.centreRow=!0;const H=()=>(0,S.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."}),E=()=>(0,S.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function V({children:e,style:t,gap:r=8,wrap:l}){const n=o.default.Children.map(e,e=>{if(!o.default.isValidElement(e))return e;const t=e,r=h.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:o.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===v?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),s=h.default.flatten(t)||{},c=o.default.Children.toArray(n).filter(o.default.isValidElement),u=e=>e.type;if(I&&'space-between'===s.justifyContent&&1!==s.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,S.jsx)(f.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const b=I&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==s.justifyContent&&'space-between'!==s.justifyContent;return(0,S.jsx)(f.default,{...b?{dataSet:{centre:'buttons'}}:{},style:[O.row,{gap:r},b&&{justifyContent:'center',flexWrap:'wrap'},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:n})}const $=()=>(0,S.jsx)(f.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const O=h.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},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:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:j.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:j.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',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,boxSizing:'border-box',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:{maxWidth:'100%',flexShrink:0,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:j.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}})},794,[795,796,30,800,34,379,395,236,402,295,41,410,102,426,36,840,844,845,5,846,847,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -945,7 +945,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/as __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},862,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},863,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},864,[]); -__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 h}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return g}}),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 S}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return v}}),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 D}}),_e.openShiftOf=T,_e.loggedBreakMins=$,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 U}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return x}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return F}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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',h=e=>!!e.out&&!!e.signOff,g={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},y=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return b(new Date(a,n-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),S=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),E=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],R=1271,v=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,D=[{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 T(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function $(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-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 B=()=>{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:{},chatRead:{},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:D.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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},U=(0,u.create)()((0,f.persist)((e,a)=>({...B(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:a,job:n,active:!0,level:q[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}: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,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}: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,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=y(t,e),o=y(n,e);i.shifts.filter(e=>e.date===a&&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 a=y(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,a)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??$({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=T(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:$({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),g.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,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>g.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};g.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(B()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=j().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,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=B();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}})),V=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,q={owner:'Owner',manager:'Manager',staff:'Staff'},x={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 K=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,a)=>a.indexOf(e)===t),W=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=K(e);return n.includes(a)||n.includes(a.split(' ')[0])},F=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return $}}),_e.openShiftOf=P,_e.loggedBreakMins=A,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return W}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return H}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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,t,a)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=a&&a<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,k={send:null},y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,I=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},w=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return y(new Date(a,n-1,i+t))},S=e=>w(e,-I(e)),E=(e,t)=>e.filter(e=>e.date===t),O=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),R=(e,t)=>t?e:e.filter(e=>e.published),v=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],_=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,$=[{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 P(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function A(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),M=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,N=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function C(){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,...B.includes(e.id)?{displayClock:!0}:{}}))}const B=['st-jack'];function U(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const V=()=>{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:{},chatRead:{},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:$.map(e=>({...e})),workEmail:'',staff:C(),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:U(),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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},q=(0,u.create)()((0,f.persist)((e,a)=>({...V(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:M('st'),name:t,role:a,job:n,active:!0,level:K[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:M('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:M('ph'),caption:t,tone:N[e.photos.length%N.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:M('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:M('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:M('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:M('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:M('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:I(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:I(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=w(t,e),o=w(n,e);i.shifts.filter(e=>e.date===a&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!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:I(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 a=w(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const a={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[a,...e.leave]})),a},setLeave:(t,n)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)}));const i=a().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:M('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??A({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:M('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=P(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:A({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:M('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),k.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:M('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:M('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};k.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(V()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=C().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,hourly:{...e.hourly,...U()},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=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=V();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=S(y(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:w(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}})),x=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,K={owner:'Owner',manager:'Manager',staff:'Staff'},W={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 F=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,a)=>a.indexOf(e)===t),G=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=F(e);return n.includes(a)||n.includes(a.split(' ')[0])},H=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},866,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},867,[]); __d(function(s,t,r,i,c,e,a){"use strict";c.exports={uri:"/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},868,[]); @@ -1065,7 +1065,7 @@ __d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModul __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},982,[804]); __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 u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).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 u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),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(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};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 u=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):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},983,[982]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return c.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const c=e.IS_CAR?b[n]:'nolink'===n&&'display'===e.APP_VARIANT?p:f[n];return(0,h.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${c}`,style:{borderRadius:16,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface,padding:14,gap:4},children:[(0,h.jsx)(u.T,{size:12,weight:"semibold",colour:l.colours.goldMuted,children:o.toUpperCase()}),(0,h.jsx)(u.T,{size:18,weight:"semibold",children:c})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]);const f={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},p="This Display isn't paired yet. Tap Not paired to pair it.",b={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when the car is back online.',nolink:'Not connected yet. Check the car has internet. If this stays, sign the car in again from Managers on your phone.'}},984,[846,34,102,985,2,840,794,25]); -__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return he}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),It(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=he.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Gt,i.readAccessLog=async function(){const e=he.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Qt}}),i.uploadOrderLogo=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Qt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=Jt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Qt).createSignedUrl(e,3600);if(t?.signedUrl)return Jt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Qt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return zt}}),i.claimInvite=ca,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(na,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ia,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=he.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=he.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(na),await T.kv.remove(ia),Se({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=he.getState().venueId;if(ae.PITCH||!s||'staff'!==he.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await ma('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'}}},i.claimInviteForSync=async function(e){const t=await ca(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return await ma('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return ma('staff_app_link_history',{p_venue:he.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await ma('revoke_staff_app_link',{p_venue:he.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=he.getState().venueId;if(!e||'staff'!==he.getState().kind)return{};try{const t=await ma('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return Number(await ma('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=he.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(sa,n),Sa(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(la,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:fa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(la,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(na,null);await T.kv.set(na,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||Sa()}return'revoked'!==i&&'unknown'!==i||await pa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await pa(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}Se({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await ma('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:fa(e)}}},i.carList=async function(){const e=he.getState().venueId;if(!e)return[];return(await ma('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await ma('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:fa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(sa),await ha();try{await _e().auth.signOut()}catch{}Se({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(na),await T.kv.remove(ia),await ha();try{await _e().auth.signOut()}catch{}Se({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Se({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ga,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return ma}}),i.mendSession=ya,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,wa=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,h.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,h.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Se({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 Ka(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void Se({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void Se({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];Se({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>Se({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>Se({mode:e?he.getState().venueId?'live':he.getState().mode:he.getState().venueId?'offline':he.getState().mode}))),await va()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ua}}),i.goLive=Ea,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ga}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Va.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Va.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),ma('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Ue(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Ue(a.from_time),to:Ue(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Va.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ga.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Va.get(a);e&&!e.ok&&Va.delete(a)}));const n=Va.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=he.getState().venueId;if(!n||'staff'!==he.getState().kind)throw new Error('Connect to your venue first.');const i=await ma('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),h=t(r[10]),S=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),D=t(r[21]),U=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),j=t(r[34]),B=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,U.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const he=(0,D.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Se=e=>he.setState(e),ye=e=>{const t=he.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=he.getState().mode;return'live'===e||'offline'===e||'connecting'===e};he.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),De=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Ue=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=De(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=De(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==he.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(j.useFloor.getState().plans[e]??(0,j.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:he.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&j.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>j.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>B.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>B.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>B.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>B.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(B.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==he.getState().kind&&('device'!==he.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>B.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>B.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(B.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={...B.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;B.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{B.useShellStore.getState().server[e]||B.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const je=new Set;function Be(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,h.isAnchorage)(e)&&(0,h.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,h.isAnchorage)(e)&&(s={...s,signOff:(0,h.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,h.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,h.isAnchorage)(e)&&(0,h.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,h.isAnchorage)(e)&&(0,h.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!je.has(e)){je.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){je.delete(e),Se({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,D.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==he.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,h.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${he.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=De(62),t=e=>ye('rota.manage')||e.staffId===he.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,S.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,S.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=De(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===he.getState().staffRef&&'open'===e.status,writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===he.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const gt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function mt(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function _t(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:j.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:gt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...St??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...St?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...St?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},St=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&j.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&mt(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=j.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,St=null;const yt=()=>new Date(Date.now()-2592e6).toISOString(),wt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},vt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},bt=()=>he.getState().perms.includes('*');function kt(){const e=()=>he.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!wt(t.ch)&&(t.from===e()||bt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('created_at',yt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=yt(),toRow:(e,t)=>{const a=wt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=vt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=vt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function It(e,t,a){const s=he.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':wt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Ot(e){const t=he.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':vt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function Rt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function At(e){const t=De(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===he.getState().staffRef,writable:()=>'staff'===he.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ut=e=>null==e||''===e?null:Number(e),Ct=e=>e.filter(e=>!e.startsWith('data:'));function Et(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',De(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Ct(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Tt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Ct(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Nt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function Mt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',De(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function xt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ut(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function Kt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function qt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Lt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function Pt(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===he.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:he.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function $t(e){const t=De(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,S.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Bt(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===he.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ft(e){const t=De(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=he.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===he.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Wt(e,t=!1){const a=De(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Ht(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Vt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Gt(){const e=he.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Qt='order-list-logos';const Jt=new Map;const zt=(0,D.create)(()=>({live:!1,known:!1}));async function Zt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const Xt=(e,t)=>Ee({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)}),ea='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function ta(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Xt(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function aa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ea).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Xt(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const sa='pair:v1',na='staff:v1',ia='staff:rejoin:v1';async function ra(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function oa(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ia,null);if(!e)return'none';try{await ua();const{data:t,error:a}=await ra(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ia),await T.kv.remove(na),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(na,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ia),'refused')}catch{return'offline'}}const da=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 ua(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}Se({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 ca(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ua();const{data:t,error:a}=await ra(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(na,n),await T.kv.set(ia,e),Re&&Sa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Se({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const la='car:request:v1',fa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function pa(){await T.kv.remove(na),await T.kv.remove(la),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ga(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ua(),!0}catch{return!1}}const ma=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let _a=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],_a&&(clearInterval(_a),_a=null)}async function Sa(){await ha(),await va()}async function ya(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ia,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await oa()&&(Sa(),!0)}catch{return!1}}(0,d.setSessionMender)(ya);let wa=o.VENUE_RID;async function va(){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 e=wa;try{if(Se({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Oa(e);const t=await T.kv.get(sa,null);let a=await T.kv.get(na,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await oa();if('offline'===t)return Se({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{wa===e&&Sa()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(na,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void Se({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await ma('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(sa):(await T.kv.remove(na),await T.kv.remove(ia)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))Se({mode:'offline'});else if(da(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await oa()&&setTimeout(()=>{wa===e&&Sa()},500)}i=he.getState().perms}Se({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await ka(n.venueId,e,n.kind)}catch(e){Se({mode:'local',lastError:String(e?.message??e)})}}const ba=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 ka(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ea(a),Oe.push(Ha(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[_t(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Wa()},onRemote:()=>{Wa()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[wa]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[wa],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&&V.useSetup.getState().patch(wa,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[wa]?.staffGrade!==a.sites[wa]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Be(a),La(a)];ye('wages.view')&&n.push(Pa(a)),'staff'===s&&(n.push(ut(),ct(),lt(),pt(a)),ft(e));const i='staff'===s&&await Yt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(kt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Vt('hr_questions')&&(n.push(ta(a)),ba.add('hr_questions'),aa(e,a)),'guest'!==s&&await Vt('sold_out_items')?(n.push(Wt(a,await Vt('sold_out_items','auto'))),ba.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Vt('sold_out_links')?(n.push(Ht(a)),ba.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Zt()&&(n.push(Rt(a)),'staff'===s&&n.push(At(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Vt('staff','nickname'),Ze=await Vt('staff','display_clock');const[e,t,s,i]=await Promise.all([Vt('scheduled_notifications'),Vt('order_lists'),Vt('venue_clock_area'),Vt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Bt(a),Ft(a)),ba.add('daily_tasks'),ba.add('daily_task_ticks')),e&&(n.push(qt(a)),Gt()),t&&n.push(Lt(a),Pt(a),$t(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ba.add(n)}if('guest'!==s&&await Vt('day_tips')){n.push(Mt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ba.add(e);await Vt('tips_pot_events')&&n.push(xt(a),Kt(a)),'staff'===s&&(n.push(Et(a),Tt(a),Nt(a)),ba.add('cash_ups'),ba.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Vt('scheduled_notifications')&&n.push(qt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Vt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ba.add('ingredient_prices'),await Vt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ba.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Vt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ba.add('specials_boards'));const c={onActivity:()=>Se({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Se({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Se({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await ma('whoami')??[]).some(t=>t.venue_id===e))return void(wa===a&&Sa());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await ma('whoami');if(!t?.some(t=>t.venue_id===e))return void(wa===a&&Sa())}catch(e){if(da(e)){const e=await oa();return void('ok'!==e&&'refused'!==e||wa===a&&Sa())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Ot(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(Se({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):Se({mode:'offline'}),!ye('wages.view')){const e=he.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ba.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const h=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);Se({lastSyncAt:(new Date).toISOString()})},e=>{Se({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(h)}),_a=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...he.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Ia='guest:sent:v1';async function Oa(e){Se({kind:'guest',venueSlug:e,perms:[]});try{const t=(await ma('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){Se({venueId:t.id,venueName:t.name}),await Ea(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),mt(e,t.app?.events)}await Ra(e),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Se({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Ra(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Aa(e)}async function Ra(e){const t=await ma('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Aa(e){let t=await T.kv.get(Ia,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ga())return;for(const a of n)try{const s=(await ma('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await ma('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Order: ${e?.message}`}))}await T.kv.set(Ia,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await ma('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Ia,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await ma('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Se({mode:(0,E.isOnline)()?he.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),_a=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ua={bridges:()=>Ie,restart:Sa},Ca='golive:v1:';async function Ea(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await Ka(e):(await T.kv.get(Ca+e,!1)||await Ka(e),await T.kv.get(Ma+e,!1)||(xa(e),await T.kv.set(Ma+e,!0)),await T.kv.get(Ta+e,!1)||(Na(),await T.kv.set(Ta+e,!0)))}const Ta='golive:v3:';function Na(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 Ma='golive:v2:';function xa(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 Ka(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,h.isDemoCard)(e)),log:m.log.filter(e=>!(0,h.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ca+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),j.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:[],swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ca+e,!0)}const qa=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function La(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(j.useFloor.getState().live[e]??{}).map(([e,t])=>qa(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===he.getState().kind||ye('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:he.getState().staffRef??ve}),fromRow:e=>qa(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>j.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>j.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Pa(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const $a='staff-avatars',ja=new Map;let Ba=!1;const Fa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Wa(){if(!Ba){Ba=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===he.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from($a).download(t);if(n||!s)continue;const i=await Fa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ba=!1}}}function Ha(e){const t=async()=>{const t=he.getState().staffRef,a=t?Ye.get(t)??he.getState().staffUuid:void 0;if(!t||!a||'staff'!==he.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from($a).remove([t]).catch(()=>{})};if(!s)return void(n&&(await ma('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Se({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 _e().storage.from($a).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await ma('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Se({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==he.getState().staffRef){const e=s[t].path;ja.set(t,null),ma('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from($a).remove([e])).catch(()=>{})}});return t(),s}const Va=new Map,Ga=(0,D.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),Ot(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=Se.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(Zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Qt,i.readAccessLog=async function(){const e=Se.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Jt}}),i.uploadOrderLogo=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Jt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=zt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Jt).createSignedUrl(e,3600);if(t?.signedUrl)return zt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Jt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return Zt}}),i.claimInvite=la,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(ia,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ra,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(ia),await T.kv.remove(ra),he({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Se.getState().venueId;if(ae.PITCH||!s||'staff'!==Se.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await _a('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'}}},i.claimInviteForSync=async function(e){const t=await la(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return _a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return await _a('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),_a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return _a('staff_app_link_history',{p_venue:Se.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await _a('revoke_staff_app_link',{p_venue:Se.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=Se.getState().venueId;if(!e||'staff'!==Se.getState().kind)return{};try{const t=await _a('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return Number(await _a('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=Se.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(na,n),ya(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(fa,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:pa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(fa,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(ia,null);await T.kv.set(ia,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||ya()}return'revoked'!==i&&'unknown'!==i||await ga(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await ga(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}he({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await _a('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:pa(e)}}},i.carList=async function(){const e=Se.getState().venueId;if(!e)return[];return(await _a('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await _a('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:pa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(na),await ha();try{await _e().auth.signOut()}catch{}he({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(ia),await T.kv.remove(ra),await ha();try{await _e().auth.signOut()}catch{}he({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}he({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ma,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return _a}}),i.mendSession=wa,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,va=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,S.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,S.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void he({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 qa(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void he({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void he({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];he({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>he({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>he({mode:e?Se.getState().venueId?'live':Se.getState().mode:Se.getState().venueId?'offline':Se.getState().mode}))),await ba()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ca}}),i.goLive=Ta,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Qa}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Ga.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Ga.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),_a('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:De(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:De(a.from_time),to:De(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Ga.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Qa.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ga.get(a);e&&!e.ok&&Ga.delete(a)}));const n=Ga.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Se.getState().venueId;if(!n||'staff'!==Se.getState().kind)throw new Error('Connect to your venue first.');const i=await _a('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),U=t(r[21]),D=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),B=t(r[34]),j=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,D.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const Se=(0,U.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),he=e=>Se.setState(e),ye=e=>{const t=Se.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=Se.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Se.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),Ue=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),De=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=Ue(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=Ue(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Se.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(B.useFloor.getState().plans[e]??(0,B.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:Se.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&B.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>B.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>j.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>j.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>j.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>j.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(j.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Se.getState().kind&&('device'!==Se.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>j.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>j.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(j.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={...j.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;j.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{j.useShellStore.getState().server[e]||j.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const Be=new Set;function je(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,S.isAnchorage)(e)&&(0,S.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,S.isAnchorage)(e)&&(s={...s,signOff:(0,S.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,S.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,S.isAnchorage)(e)&&(0,S.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,S.isAnchorage)(e)&&(0,S.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!Be.has(e)){Be.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Be.delete(e),he({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,U.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==Se.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,S.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${Se.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=Ue(62),t=e=>ye('rota.manage')||e.staffId===Se.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,h.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,h.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=Ue(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===Se.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.leaveRemote.decide=t=>!(!ye('rota.manage')||!(0,z.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(K.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),Oe.push(()=>{J.leaveRemote.decide=null})}function pt(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function gt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Se.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const mt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function _t(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function St(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:B.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...yt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...yt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...yt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},yt=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&B.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&_t(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=B.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,yt=null;const wt=()=>new Date(Date.now()-2592e6).toISOString(),vt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},bt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},kt=()=>Se.getState().perms.includes('*');function It(){const e=()=>Se.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!vt(t.ch)&&(t.from===e()||kt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('created_at',wt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=wt(),toRow:(e,t)=>{const a=vt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=bt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=bt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Ot(e,t,a){const s=Se.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':vt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Rt(e){const t=Se.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':bt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function At(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Ut(e){const t=Ue(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===Se.getState().staffRef,writable:()=>'staff'===Se.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ct=e=>null==e||''===e?null:Number(e),Et=e=>e.filter(e=>!e.startsWith('data:'));function Tt(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',Ue(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Et(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Nt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Et(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Mt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function xt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',Ue(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.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:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ct(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function qt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Lt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Pt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function $t(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Se.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Se.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Bt(e){const t=Ue(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,h.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Ft(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===Se.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Wt(e){const t=Ue(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Se.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===Se.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Ht(e,t=!1){const a=Ue(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Vt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Gt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Qt(){const e=Se.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();Zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Jt='order-list-logos';const zt=new Map;const Zt=(0,U.create)(()=>({live:!1,known:!1}));async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Xt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const ea=(e,t)=>Ee({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)}),ta='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function aa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ea(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function sa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ta).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ea(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const na='pair:v1',ia='staff:v1',ra='staff:rejoin:v1';async function oa(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function da(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ra,null);if(!e)return'none';try{await ca();const{data:t,error:a}=await oa(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ra),await T.kv.remove(ia),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(ia,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ra),'refused')}catch{return'offline'}}const ua=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 ca(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}he({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 la(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ca();const{data:t,error:a}=await oa(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(ia,n),await T.kv.set(ra,e),Re&&ya(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return he({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const fa='car:request:v1',pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function ga(){await T.kv.remove(ia),await T.kv.remove(fa),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ma(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ca(),!0}catch{return!1}}const _a=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let Sa=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],Sa&&(clearInterval(Sa),Sa=null)}async function ya(){await ha(),await ba()}async function wa(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ra,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await da()&&(ya(),!0)}catch{return!1}}(0,d.setSessionMender)(wa);let va=o.VENUE_RID;async function ba(){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 e=va;try{if(he({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Ra(e);const t=await T.kv.get(na,null);let a=await T.kv.get(ia,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await da();if('offline'===t)return he({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{va===e&&ya()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(ia,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void he({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await _a('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(na):(await T.kv.remove(ia),await T.kv.remove(ra)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))he({mode:'offline'});else if(ua(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await da()&&setTimeout(()=>{va===e&&ya()},500)}i=Se.getState().perms}he({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await Ia(n.venueId,e,n.kind)}catch(e){he({mode:'local',lastError:String(e?.message??e)})}}const ka=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 Ia(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ta(a),Oe.push(Va(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[St(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ha()},onRemote:()=>{Ha()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[va]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[va],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&&V.useSetup.getState().patch(va,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[va]?.staffGrade!==a.sites[va]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},je(a),Pa(a)];ye('wages.view')&&n.push($a(a)),'staff'===s&&(n.push(ut(),ct(),lt(),gt(a)),pt(e)),'staff'===s&&await Gt('staff_leave')&&(n.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Se.getState().staffRef&&'pending'===e.status||ye('rota.manage')),writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:Ee(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),ka.add('staff_leave'),ft(e));const i='staff'===s&&await Xt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(It(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Gt('hr_questions')&&(n.push(aa(a)),ka.add('hr_questions'),sa(e,a)),'guest'!==s&&await Gt('sold_out_items')?(n.push(Ht(a,await Gt('sold_out_items','auto'))),ka.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Gt('sold_out_links')?(n.push(Vt(a)),ka.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Yt()&&(n.push(At(a)),'staff'===s&&n.push(Ut(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Gt('staff','nickname'),Ze=await Gt('staff','display_clock');const[e,t,s,i]=await Promise.all([Gt('scheduled_notifications'),Gt('order_lists'),Gt('venue_clock_area'),Gt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Ft(a),Wt(a)),ka.add('daily_tasks'),ka.add('daily_task_ticks')),e&&(n.push(Lt(a)),Qt()),t&&n.push(Pt(a),$t(a),Bt(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ka.add(n)}if('guest'!==s&&await Gt('day_tips')){n.push(xt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ka.add(e);await Gt('tips_pot_events')&&n.push(Kt(a),qt(a)),'staff'===s&&(n.push(Tt(a),Nt(a),Mt(a)),ka.add('cash_ups'),ka.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Gt('scheduled_notifications')&&n.push(Lt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Gt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ka.add('ingredient_prices'),await Gt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ka.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Gt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ka.add('specials_boards'));const c={onActivity:()=>he({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>he({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{he({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await _a('whoami')??[]).some(t=>t.venue_id===e))return void(va===a&&ya());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await _a('whoami');if(!t?.some(t=>t.venue_id===e))return void(va===a&&ya())}catch(e){if(ua(e)){const e=await da();return void('ok'!==e&&'refused'!==e||va===a&&ya())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Rt(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(he({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):he({mode:'offline'}),!ye('wages.view')){const e=Se.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ka.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);he({lastSyncAt:(new Date).toISOString()})},e=>{he({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(S)}),Sa=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...Se.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Oa='guest:sent:v1';async function Ra(e){he({kind:'guest',venueSlug:e,perms:[]});try{const t=(await _a('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){he({venueId:t.id,venueName:t.name}),await Ta(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),_t(e,t.app?.events)}await Aa(e),he({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{he({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Aa(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Ua(e)}async function Aa(e){const t=await _a('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Ua(e){let t=await T.kv.get(Oa,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ma())return;for(const a of n)try{const s=(await _a('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await _a('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Order: ${e?.message}`}))}await T.kv.set(Oa,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await _a('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Oa,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await _a('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),he({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{he({mode:(0,E.isOnline)()?Se.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),Sa=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ca={bridges:()=>Ie,restart:ya},Ea='golive:v1:';async function Ta(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await qa(e):(await T.kv.get(Ea+e,!1)||await qa(e),await T.kv.get(xa+e,!1)||(Ka(e),await T.kv.set(xa+e,!0)),await T.kv.get(Na+e,!1)||(Ma(),await T.kv.set(Na+e,!0)))}const Na='golive:v3:';function Ma(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 xa='golive:v2:';function Ka(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 qa(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,S.isDemoCard)(e)),log:m.log.filter(e=>!(0,S.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ea+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),B.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:e.leave.filter(e=>(0,z.isUuid)(e.id)),swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ea+e,!0)}const La=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Pa(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(B.useFloor.getState().live[e]??{}).map(([e,t])=>La(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Se.getState().kind||ye('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:Se.getState().staffRef??ve}),fromRow:e=>La(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>B.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>B.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function $a(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ba='staff-avatars',ja=new Map;let Fa=!1;const Wa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ha(){if(!Fa){Fa=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Se.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from(Ba).download(t);if(n||!s)continue;const i=await Wa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Fa=!1}}}function Va(e){const t=async()=>{const t=Se.getState().staffRef,a=t?Ye.get(t)??Se.getState().staffUuid:void 0;if(!t||!a||'staff'!==Se.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from(Ba).remove([t]).catch(()=>{})};if(!s)return void(n&&(await _a('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void he({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 _e().storage.from(Ba).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await _a('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){he({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Se.getState().staffRef){const e=s[t].path;ja.set(t,null),_a('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from(Ba).remove([e])).catch(()=>{})}});return t(),s}const Ga=new Map,Qa=(0,U.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=O,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return b}}),_e.useGpCalcView=function(){const e=b();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...O(e)}:e,[e])},Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return v}}),_e.gpSyncItems=E,_e.gpSyncFromRow=P,_e.mergeGpItems=w,_e.gpSyncSpec=function(e,t){const i='ing'===e?'ingredient_prices':'card_costs';return{name:i,table:i,deletes:!1,list:()=>E(b.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:C(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>P(e,t),apply:(t,i)=>b.setState(n=>w(n,e,t,i)),subscribe:t=>b.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i.cardCosts===n.cardCosts)||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),r=(e=a)&&e.__esModule?e:{default:e},d=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,t,i,n,s,a=0,r=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:a,allergens:r}),m=e=>new Date(Date.now()-864e5*e).toISOString(),S={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},k=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...h('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...h('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(S[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:m(7*(i.length-t))}))})),y=(e,t,i,n,s,a,r,d="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:a,status:r,description:d,allergens:[]}),I=[y('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),y('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),y('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),y('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),y('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),y('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function O(e){const t=e=>I.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),a=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),r=e=>{const t=k.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},d=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(d).forEach(e=>e.lines.forEach(e=>a.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>a.has(e.id)||!r(e)),cardCosts:d}}const b=(0,d.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:k,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),a=n.ingredients.map(e=>e.id===t.id?t:e);let r=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,a,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(d(t)-d(s))/d(s)*100;i.length&&(r=[{id:f('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...r].slice(0,20))}const d=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:d?a.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):a,alerts:r})},addPricePaid:(e,t,n)=>{const s=i(),a=s.ingredients.find(t=>t.id===e);if(!(a&&t>0))return;const r=[...a.prices?.length?a.prices:[{p:a.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),d={...a,prices:r};i().saveIngredient({...d,packPrice:(0,o.costingPrice)(d,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=f('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)}))}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>r.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...O({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&b.persist.rehydrate()});const v='1970-01-01T00:00:00.000Z',C=e=>JSON.parse(JSON.stringify(e));function E(e,t){const i=O(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??v,doc:C({...e,updatedAt:e.updatedAt??v})})):Object.entries(i.cardCosts).map(([e,t])=>({id:e,updatedAt:t.updatedAt??v,doc:C({...t,updatedAt:t.updatedAt??v})})),s=new Set(n.map(e=>e.id)),a=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...a]}function P(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('card'!==e||Array.isArray(s.lines))?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function w(e,t,i,n){const s={...e.gone??{}},a=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e.cardCosts??{})),r=[];for(const e of i){const i=`${t}:${e.id}`,n=a.get(e.id),d=n?n.updatedAt??v:void 0,c=s[i];if(e.deletedAt){if(n&&d>e.deletedAt)continue;a.delete(e.id),(!c||ce.updatedAt)continue;if(n&&d>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?a.set(e.id,o):r.push([e.id,o]),delete s[i]}for(const e of n)a.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...a.values(),...r.map(([,e])=>e)],gone:s}}return{cardCosts:Object.fromEntries([...a.entries(),...r]),gone:s}}},986,[806,34,807,5,808,815,818,987,832,839]); __d(function(_g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return i}}),e.priceStats=c,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return o}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return l}}),e.convert=function(t,n,i){const c=u[n],o=u[i];return c&&o&&c.dim===o.dim?t*c.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return d}}),e.perBaseUnit=function(t){const n=u[t.packUnit];if(!(n&&t.packSize>0))return null;const i=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/i*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/i*1e3,per:'litre'}:{pence:t.packPrice/i,per:'item'}},Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return g}}),e.lineCost=m,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return p}}),e.suggestAllergens=function t(n,i,c=[],o=0){const s=new Set;for(const u of n.lines)if(u.ingId.startsWith('dish:')){const n=c.find(t=>t.id===u.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>s.add(t)),t(n,i,c,o+1).forEach(t=>s.add(t)))}else i.find(t=>t.id===u.ingId)?.allergens?.forEach(t=>s.add(t));return[...s]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:h(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return S}}),e.suggestForMultiple=function(t,n,i,c,o){const s=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?b(Math.ceil(s)):Math.ceil(s)},e.amountLabel=k,e.cardCostSummary=function(t,n,i,c){const o=(t?.lines??[]).map(t=>{const i=n.find(n=>n.id===t.ingId);return{line:t,name:i?.name??'Removed ingredient',cost:m(t,n),label:k(t,i)}}),s=o.reduce((t,n)=>t+n.cost,0),u=Math.max(1,t?.portions||1),a=s/u,l=t?.target??i.defaultTarget??70,f=a>0?y(a,l,i.vatPct,i.pricePoints):null,d=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,g=d??(c&&c>0?c:f),p=g&&a>0?P(a,g,i.vatPct):null;return{lines:o,batch:s,perPortion:a,target:l,suggested:f,price:g,priceIsSuggested:!(d||c&&c>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,l):null,missing:o.filter(t=>t.cost<=0).length}};var t=r(_d[0]);const n=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],i=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function c(t,n=5){const c=i(t),o=c.slice(-Math.max(1,n)),s=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:s,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",i=5)=>'average'===n?c(t,i).avg:c(t,i).latest;const s={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},u={kg:{dim:'mass',f:s.kg},g:{dim:'mass',f:s.g},oz:{dim:'mass',f:s.oz},lb:{dim:'mass',f:s.lb},stone:{dim:'mass',f:s.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=['kg','g','stone','lb','oz','L','ml','each'],l=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const f=(t,n)=>[...'mass'===u[t].dim?['g','kg','oz','lb']:'vol'===u[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],d=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;const g=(t,n)=>{const i=(t?.servingName||'serving').trim().toLowerCase();return 1===n?i:/(s|sh|ch|x)$/.test(i)?`${i}es`:`${i}s`};function m(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?p(o,n,i,c+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=d(o);return null==n?0:t.qty*n}const s=u[o.packUnit],a=u[t.unit];if(!a||s.dim!==a.dim)return 0;const l=o.packPrice/(o.packSize*s.f),f=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*a.f*l/(1-f/100)}const p=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+m(o,n,i,c),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,i){const c=h(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}}function b(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}function y(t,n,i,c){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+i/100);return c?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const S=t=>`${t.toFixed(1)}x`;function k(t,n){const i=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${i} ${g(n,t.qty)}`:'each'===t.unit?`${i} ${1===t.qty?'item':'items'}`:`${i} ${l(t.unit,t.qty)}`}},987,[982]); __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 f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});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:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},988,[]); @@ -1088,7 +1088,7 @@ __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1006,[975]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1007,[1003,975,1008]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1009,[]); __d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return v}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class v{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=c(t),this.saveKnown())})}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=s.get(e);if(!this.pending(e)){if(f){const t=c(f);if(this.rev(f)===this.rev(h)){this.known[e]=l,t!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(h),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,h.length>l&&!f)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||e.syncable(s)&&e.writable()&&this.known[n]!==t&&!this.pending(n)&&this.write(s)}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1010,[1005,931,1003,975,1007]); __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 b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);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??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`: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}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},1011,[829,808,839,815,818,827,1012,1013]); @@ -1122,7 +1122,7 @@ __d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},1038,[1039]); __d(function(g,r,i,a,m,e,d){function n(n,t){const o=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o,s){const u=()=>r.importAll(t,s);{const l=o?.[String(t)];if(Array.isArray(l)){const c=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(c?.isReady?.(l))return u();const f=n(t,o);if(null!=f)return f.then(u);throw new Error(`Cannot import module ${s??t}: the async bundle loader is unavailable. Load the initial Expo bundle before importing these chunks: ${l.join(', ')}`)}try{return u()}catch(s){const l=n(t,o);if(null!=l)return l.then(u);throw s}}const l=n(t,o);return null!=l?l.then(u):u()}function o(n,o,s){const u=t(n,o,s),l=Promise.resolve(u);return l._result=u,l}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},1039,[]); __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)},1040,[34]); __d(function(_g,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,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return p}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[w,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(p,Math.ceil(f.w)+4),j=e&&l>0&&l-2*vu(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.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 t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const w=()=>f(e=>e.layers.some(e=>e.own)),p=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1041,[34,236,402,102,815,840,794,1040,25]); -__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.120'},1042,[]); +__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.121'},1042,[]); __d(function(_g,_r,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'},1043,[796,991,34,379,402,102,794,840,1021,1022,865,1025,1026,1027,992,1044,985,1045,994,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1044,[]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1045,[1046,931,985,846]); @@ -1179,7 +1179,7 @@ __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return z}}),_e.useTableNames=B,_e.resetTableLive=N,_e.seatBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'seated'),N(e,t.table)},_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=M,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return F}}),_e.TablePicker=A,_e.WalkInSheet=R,_e.AssignTableSheet=W,_e.undoNotice=E,_e.NewBookingSheet=_,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[n,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,O.jsxs)(O.Fragment,{children:[s?(0,O.jsx)(R,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:E}):null,l?(0,O.jsx)(_,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,i.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,O.jsx)(W,{booking:n.b,combine:n.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),O=_r(_d[27]);const z=Array.from({length:12},(e,t)=>String(t+1));function B(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function N(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function M(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=B(e),a=(0,S.useFloor)(t=>t.live[e])??{},n=(0,S.usePlan)(e),i=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(i,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[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,S.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,x.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 F=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function A({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=n?6:8,y=n?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(i??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,O.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],i=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!i,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,O.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:i?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,O.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,O.jsx)(T.T,{weight:"bold",size:22,colour:i?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,O.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,O.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,O.jsx)(T.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const L=[1,2,3,4,5,6,7,8];function R({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:y,r:w,now:C}=(0,p.useCtx)(15e3),D=M(y,C),[I,$]=(0,r.useState)(2),[P,z]=(0,r.useState)(!1),[B,F]=(0,r.useState)(i??null),R=(0,S.usePlan)(y),W=(0,f.useBookings)(y),E=(0,v.useBlocks)(e=>e.blocks),_=(0,v.closedAreasAt)(E,y,(0,x.ymd)(C),(0,x.hm)(C)),H=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(D).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(R,W.filter(e=>e.date===(0,x.ymd)(C)),e,I,C,(0,k.turnFor)(I,w.settings.turnMins),90,void 0,{closed:_})?.table??null},[R,W,D,I,_.size,C.getTime()]);(0,r.useEffect)(()=>{B&&(0,S.tablesOf)(B).some(e=>'Closed'===D[e]?.label)&&F(null)},[B,_.size]);const[U,q]=(0,r.useState)(!1),[V,Y]=(0,r.useState)(''),G=(e,t=String(e),s=()=>{z(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,O.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,O.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},K=(0,O.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),Q=(0,O.jsxs)(b.default,{style:{gap:8,width:n?256:void 0},children:[(0,O.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,O.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[L.map(e=>G(e)),G(9,'9+',()=>{z(!0),$(e=>e>=9?e:9)})]}),P?K:null]}),[X,J]=(0,r.useState)(!1),Z=async(t=B)=>{if(!X){J(!0);try{const s=await f.repo.bookings.seatWalkIn(y,I,t??void 0,V);N(y,t??void 0),a(s),e()}finally{J(!1)}}},ee=(0,O.jsxs)(b.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,O.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,O.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),B?(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>F(null)}):null]}),(0,O.jsx)(A,{use:D,value:B,onPick:e=>{D[e]&&!D[e].busy?Z(e):F(B===e?null:e)},big:n,dense:n,best:H,bestSet:(0,u.bestTables)(R)}),(0,O.jsxs)(T.Muted,{children:["Tap a free table to seat them there",H&&!B?` (suggested for ${I}: ${(0,l.tableNumbers)(H)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(C)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,O.jsx)(T.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${B?` \xb7 ${(0,l.tableNumbers)(B)}`:''}`,disabled:X,onPress:()=>{Z()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,O.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[Q,ee]}):(0,O.jsxs)(O.Fragment,{children:[Q,ee]}),(0,O.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[U?(0,O.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>q(!0)}),(0,O.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,O.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function W({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,p.useCtx)(15e3),i=M(o,n),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(n)),t,e.partySize,n,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,n.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),B=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&N(o,l),t()},R=C?(0,O.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,O.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,O.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,O.jsx)(b.default,{testID:"combine-short",children:(0,O.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,O.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>L(I)}),(0,O.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,O.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${F(e)}`,testID:"assign-table-sheet",footer:R,children:[v&&!C?(0,O.jsx)(b.default,{testID:"assign-suggested",children:(0,O.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,O.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,O.jsx)(A,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await L([e])}})]})}function E(e){(0,i.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${F(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function _({date:e,onClose:t,wide:i,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:B}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,F]=(0,r.useState)(ee.blocks),[R,W]=(0,r.useState)(!1),[E,_]=(0,r.useState)(''),[H,U]=(0,r.useState)(2),[q,V]=(0,r.useState)(null),[Y,G]=(0,r.useState)(''),[K,Q]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ne=(0,S.usePlan)(u),ie=(0,P.dogSetUp)(ne),re=!0===te.dog&&ie,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(H,c.settings.turnMins),be=A.filter(e=>e.date===M),ge=e=>(0,k.freeTablesAt)(ne,be,H,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(L,u,M,e)}),he=re&&q?ge(q):[];(0,r.useEffect)(()=>{ae(null)},[re,q,H]);const pe=(0,y.bookingSlots)(c,ue,e=>A.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),H,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0)),me=(0,w.ukPhone)(K),[fe,ye]=(0,r.useState)(!1),ke=q?pe.find(e=>e.time===q):void 0,xe=ke&&ke.left=2&&!!q&&(!xe||fe)&&(0,o.validParty)(H)&&me.ok&&(0,w.emailOk)(X)&&(!je||we&&R)&&(!re||he.length>0)&&!Te,ve=te.wheelchair>0||te.stepFree;return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:i?760:void 0,testID:"booking-sheet",children:[(0,O.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:H,audience:"staff"}),te.dog&&!ie?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(F(e),V(null),W(!1))}}),(0,O.jsxs)(T.Row,{gap:6,children:[(0,O.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,O.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,O.jsx)(T.Field,{label:"Name",value:E,onChangeText:_,placeholder:"e.g. Reid",testID:"nb-name"}),(0,O.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:K,onChangeText:Q,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&K?(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,O.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,O.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(T.T,{center:!0,children:"Covers"}),(0,O.jsx)(s.PartySizeInput,{value:H,onChange:e=>{U(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!ge(e.time).length||!(0,D.dogTimeOk)(c,A,M,e.time,de);return(0,O.jsx)(T.Chip,{label:e.time,sub:(0,v.blockAt)(L,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':e.left>0?`${e.left} left`:'Full',disabled:(e.past??!e.available)||t,selected:q===e.time,onPress:()=>{V(e.time),W(!1),ye(!1)}},e.time)})}),xe?(0,O.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(H,xe.left,xe.time)}),(0,O.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&q?(0,O.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,O.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,O.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ne.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),he.length?(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:he.slice(0,10).map((e,t)=>(0,O.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${ve&&(0,P.accessibleSetUp)(ne)&&!(0,P.isAccessible)(ne,e.table)?' \xb7 not step-free':''}`,selected:(le??he[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",H," at ",q,". Try another time."]})]}):null,je?(0,O.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",je.from,"\u2013",je.to,je.reason?` (${je.reason})`:'']}),we?(0,O.jsx)(T.Chip,{label:R?'Manager override on':'Override and book anyway',selected:R,onPress:()=>W(e=>!e)}):(0,O.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,O.jsx)(b.default,{testID:"nb-closed",children:(0,O.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,O.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:H,date:M,time:q,today:(0,x.ymd)(h),bookings:A,audience:"staff",showTables:!1!==c.settings.tableRequests}),ve&&!(0,P.accessibleSetUp)(ne)?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(T.Field,{label:"Notes (optional)",value:Y,onChangeText:G,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,n.depositDue)((0,n.depositOf)(c.settings),H)?(0,O.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(c.settings),H))," (",(0,a.gbp)((0,n.depositOf)(c.settings).perPersonPence)," per person for ",(0,n.depositOf)(c.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,O.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),Te?(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",q,". Try another time: dogs are very welcome then."]}):null,(0,O.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Se,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||he.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:H,date:M,time:q,notes:Y.trim(),security:(0,n.depositDue)((0,n.depositOf)(c.settings),H)?'deposit':'none',depositPaid:0,...(0,n.depositDue)((0,n.depositOf)(c.settings),H)?{depositDue:(0,n.depositDue)((0,n.depositOf)(c.settings),H),depositPolicy:(0,n.depositWords)((0,n.depositOf)(c.settings),H,c.name).join(' '),depositRefundable:(0,n.depositOf)(c.settings).refundable,depositCutoffHours:(0,n.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??he[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,B)).catch(()=>{}),d?.({date:M,time:q,name:E.trim()}),t()}})]})}},1096,[796,1097,1098,829,836,14,1099,34,828,402,102,846,1100,848,1104,1079,827,840,833,794,1014,1011,1105,1106,1111,1081,1075,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1097,[34,402,412,102,1098,840,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const f=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(f)?f:u))},f=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),b=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`},1098,[]); -__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{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]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); +__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); __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 c.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return c.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return D}}),_e.useShiftManager=b,_e.useSignedIn=h,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(w),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),c=h(),m=o||'staff'===s.APP_VARIANT,y=(0,t.useContext)(D),O=b(),S=m?y&&O?'manager':'staff':c?p(i,l(c)):i,M=(0,r.useOwner)(e=>e.staff),A=(0,n.useRestaurant)(u),P=(0,n.useNow)(e),I=c?c.id:m&&f?f:d[S],R=M.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:A,now:P,role:S,me:R,meId:I,today:(0,a.venueYmd)(P),signedIn:!!c}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return S}}),_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()-O(n));const c=(0,a.ymd)(f),d=(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===O(t)&&e.date>=c&&e.date<=d&&!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,c=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,...c})})}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 M}}),_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()-O(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=h(),t=(0,r.useOwner)(e=>e.hourly);return e?t:A};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]),c=_r(_d[10]);const d={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=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,p=(e,t)=>m[e]>m[t]?t:e,w=(0,t.createContext)(!1),y=()=>(0,t.useContext)(w),D=(0,t.createContext)(!1);function b(){const e=(0,t.useContext)(w)||'staff'===s.APP_VARIANT,n=h(),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 h(){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 O=e=>(e.getDay()+6)%7,S=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const M=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const A={}},1100,[806,34,848,865,827,846,985,1101,997,15,1103]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); __d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[1103]); @@ -1222,7 +1222,7 @@ __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1139,[931,974,985,975]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1140,[1129,982,34,379,102,794,865,988,836,840,1100,1124,1018,1141,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1141,[796,804,982,34,379,236,402,102,794,1016,981,983,836,1017,840,1124,25]); -__d(function(g,_r,_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:u,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),f=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,o.useLiveState)();if('ready'!==$)return(0,p.jsx)(o.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,p.jsxs)(n.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface,padding:u?10:12,gap:6},b],children:[(0,p.jsxs)(r.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:u?1:void 0},children:[(0,p.jsxs)(i.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:["LIVE \xb7 ",I]}),(0,p.jsx)(i.T,{size:12,colour:c.colours.muted,children:"Tap to update \u203a"})]}),(0,p.jsx)(i.Row,{gap:u?14:18,style:{flex:u?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,p.jsx)(i.T,{size:u?42:34,weight:"bold",colour:s<=0?c.colours.red:o?c.colours.amber:c.colours.text,style:{lineHeight:u?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,p.jsxs)(i.T,{size:13,colour:o?c.colours.amber:c.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!u&&L.length?(0,p.jsxs)(n.default,{testID:"shellfish-low",style:{backgroundColor:c.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,p.jsxs)(i.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.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,p.jsx)(i.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,u||L.length||!h?null:(0,p.jsx)(r.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,p.jsx)(i.T,{size:13,colour:c.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,p.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:u=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,f]=(0,s.useState)(!1);if(!h.items.length)return null;const x=u>=80,w=Math.max(28,Math.min(52,Math.round(.6*u))),C=Math.max(22,Math.min(34,Math.round(.42*u)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.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:()=>f(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:u,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,r=b[t.key]??0,d=Math.max(0,o-r),y=d<=0,f=y||h.isLow(t.key);return(0,p.jsxs)(n.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:f?'rgba(255,107,94,0.07)':'transparent',...l.look.web(f?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,p.jsx)(i.T,{size:C,children:t.icon}),(0,p.jsx)(i.T,{size:w,weight:"bold",colour:f?'#FF8E82':c.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,p.jsxs)(n.default,{style:{gap:0},children:[(0,p.jsx)(i.T,{size:x?15:13,weight:"semibold",colour:f?'#FFB3AA':c.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),f&&u>=60?(0,p.jsx)(i.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,p.jsxs)(i.T,{size:x?14:12,weight:"semibold",colour:r?c.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,r)]})]})]},t.key)})}),y?(0,p.jsx)(j,{rid:e,by:t,app:o,onClose:()=>f(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=w,_e.SundayRoastChip=function(e){return(0,p.jsx)(w,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_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]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]);const f=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,u.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:r,onOrder:u,group:h}){const b=(0,d.useShellfish)(e,o,l,h),y='roast'===h,[k,j]=(0,s.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,k[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):k,[C,S]=(0,s.useState)(null),$=x(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&j(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=k[e.key]&&k[e.key]!==Math.round(b.counts[e.key]??0));return(0,p.jsxs)(i.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,p.jsx)(i.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,p.jsxs)(n.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface2},children:[(0,p.jsxs)(i.T,{center:!0,size:13,colour:c.colours.muted,children:[s.icon," ",s.plural]}),(0,p.jsx)(i.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?c.colours.amber:c.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,p.jsx)(i.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,p.jsx)(i.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,p.jsx)(n.default,{style:{minHeight:52}})]},s.key)})}),(0,p.jsx)(i.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,a.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,a.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,p.jsx)(i.Banner,{kind:"success",title:C}):null,(0,p.jsxs)(n.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:c.colours.gold,backgroundColor:c.colours.goldTint},children:[(0,p.jsx)(i.T,{weight:"semibold",colour:c.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,p.jsxs)(i.Row,{gap:10,children:[(0,p.jsxs)(i.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,p.jsx)(i.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,w[s.key]||0)}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,p.jsx)(i.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=k[e.key]&&b.recount(e.key,Math.max(0,Math.round(k[e.key])))}),j({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,p.jsx)(i.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),j({})},style:{minHeight:54}})]}),u?(0,p.jsx)(i.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:u}):null,(0,p.jsxs)(n.default,{style:{gap:2},children:[(0,p.jsx)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,p.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(i.T,{size:13,style:{flex:1},children:(0,a.describe)(e,b.itemOf(e.kind))}),(0,p.jsxs)(i.Muted,{children:[f(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,p.jsx)(i.Row,{wrap:!0,gap:6,children:b.synced?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"ok",label:"Shared live"}),(0,p.jsx)(i.Muted,{children:"Every paired device sees the same count."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"neutral",label:"Saved on this device"}),(0,p.jsx)(i.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function w({rid:e,by:t,app:o,size:u="m",group:b}){const y=(0,d.useShellfish)(e,t,o,b),f=k(e),[x,w]=(0,s.useState)(!1),C=(0,h.useNow)(3e4);if(!y.items.length)return null;if('roast'===b&&!(0,a.isSundayIn)(C))return null;const S='m'===u?20:17,$='xs'!==u;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.default,{testID:'roast'===b?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===b?'Sunday roast: ':''}${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(y.counts[t.key]??0)-(f[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>w(!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:y.items.map((t,s)=>{const o=y.counts[t.key]??0,l=f[t.key]??0,r=Math.max(0,o-l),d=r<=0,u=d||y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,r)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:u?'rgba(255,107,94,0.10)':'transparent'},children:[(0,p.jsx)(i.T,{size:S-2,children:t.icon}),(0,p.jsx)(i.T,{size:S,weight:"bold",colour:d?c.colours.red:u?c.colours.amber:c.colours.text,style:{lineHeight:S+4},children:(0,a.fmtStockCount)(e,t,r)}),$&&(l||d||u)?(0,p.jsx)(i.T,{size:10,weight:"semibold",colour:d||u?'#FFB3AA':c.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),x?(0,p.jsx)(j,{rid:e,by:t,app:o,group:b,onClose:()=>w(!1)}):null]})}},1142,[982,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); +__d(function(g,_r,_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=x,_e.ShellfishTile=function({rid:e,by:t,app:s,big:r,onOrder:c,style:b}){const y=(0,u.useShellfish)(e,t,s),p=x(e),[k,C]=(0,o.useState)(!1),S=j(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,l.useLiveState)();if('ready'!==$)return(0,f.jsx)(l.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(i.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface,padding:r?10:12,gap:6},b],children:[(0,f.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:r?1:void 0},children:[(0,f.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:["LIVE \xb7 ",I]}),(0,f.jsx)(a.T,{size:12,colour:h.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(a.Row,{gap:r?14:18,style:{flex:r?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)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(a.T,{size:r?42:34,weight:"bold",colour:s<=0?h.colours.red:o?h.colours.amber:h.colours.text,style:{lineHeight:r?50:42},children:(0,d.fmtStockCount)(e,t,s)}),(0,f.jsxs)(a.T,{size:13,colour:o?h.colours.amber:h.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.goldLight,children:["Reserved: ",(0,d.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,d.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!r&&L.length?(0,f.jsxs)(i.default,{testID:"shellfish-low",style:{backgroundColor:h.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.map(t=>`${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,d.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),c?(0,f.jsx)(a.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:c}):null]}):null,r||L.length||!c?null:(0,f.jsx)(n.default,{accessibilityRole:"button",onPress:c,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(a.T,{size:13,colour:h.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),k?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>C(!1),onOrder:c?()=>{C(!1),c()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:l=76}){const c=(0,u.useShellfish)(e,t,s),b=x(e),[y,p]=(0,o.useState)(!1);if(!c.items.length)return null;const k=l>=80,j=Math.max(28,Math.min(52,Math.round(.6*l))),C=Math.max(22,Math.min(34,Math.round(.42*l)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${c.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,c.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:l,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...r.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:c.items.map((t,s)=>{const o=c.counts[t.key]??0,n=b[t.key]??0,u=Math.max(0,o-n),y=u<=0,p=y||c.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,u)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:k?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...r.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)(a.T,{size:C,children:t.icon}),(0,f.jsx)(a.T,{size:j,weight:"bold",colour:p?'#FF8E82':h.colours.text,style:{lineHeight:Math.round(1.15*j),letterSpacing:-.5,minWidth:Math.round(.85*j),textAlign:'center'},children:(0,d.fmtStockCount)(e,t,u)}),(0,f.jsxs)(i.default,{style:{gap:0},children:[(0,f.jsx)(a.T,{size:k?15:13,weight:"semibold",colour:p?'#FFB3AA':h.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&l>=60?(0,f.jsx)(a.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,d.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(a.T,{size:k?14:12,weight:"semibold",colour:n?h.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,d.fmtStockCount)(e,t,n)]})]})]},t.key)})}),y?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=w,_e.ShellfishChip=C,_e.SundayRoastChip=function(e){return(0,f.jsx)(C,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),r=_r(_d[4]),n=e(_r(_d[5])),i=e(_r(_d[6])),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]),f=_r(_d[15]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function x(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.ymd)((0,b.useNow)(6e4));return(0,y.reservedOn)(t,o,(0,y.reservablesOf)(s))}function j(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function w({rid:e,by:s,app:l,onClose:r,onOrder:n,group:c}){const b=(0,u.useShellfish)(e,s,l,c),y='roast'===c,[p,x]=(0,o.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,p[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):p,[C,S]=(0,o.useState)(null),$=j(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&x(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=p[e.key]&&p[e.key]!==Math.round(b.counts[e.key]??0));return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,f.jsx)(a.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,f.jsxs)(i.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(a.T,{center:!0,size:13,colour:h.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(a.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?h.colours.amber:h.colours.text,style:{lineHeight:56},children:(0,d.fmtStockCount)(e,s,o)}),(0,f.jsx)(a.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(a.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(i.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(a.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,d.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,d.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,f.jsx)(a.Banner,{kind:"success",title:C}):null,(0,f.jsxs)(i.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,f.jsx)(a.T,{weight:"semibold",colour:h.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsxs)(a.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(a.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,d.fmtStockCount)(e,s,w[s.key]||0)}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,f.jsx)(a.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=p[e.key]&&b.recount(e.key,Math.max(0,Math.round(p[e.key])))}),x({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,f.jsx)(a.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,d.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),x({})},style:{minHeight:54}})]}),n?(0,f.jsx)(a.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:n}):null,(0,f.jsxs)(i.default,{style:{gap:2},children:[(0,f.jsx)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,style:{flex:1},children:(0,d.describe)(e,b.itemOf(e.kind))}),(0,f.jsxs)(a.Muted,{children:[k(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:b.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(a.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(a.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function C({rid:e,by:t,app:l,size:c="m",group:y}){const p=(0,u.useShellfish)(e,t,l,y),k=x(e),[j,C]=(0,o.useState)(!1),S=(0,b.useNow)(3e4);if(!p.items.length)return null;if('roast'===y&&!(0,d.isSundayIn)(S))return null;const $='m'===c?20:17,L='xs'!==c;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:'roast'===y?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===y?'Sunday roast: ':''}${p.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,Math.max(0,(p.counts[t.key]??0)-(k[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>C(!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)',...r.look.web({cursor:'pointer'})}),children:p.items.map((t,o)=>{const l=p.counts[t.key]??0,r=k[t.key]??0,n=Math.max(0,l-r),u=n<=0,c=u||p.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,n)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(a.T,{size:$-2,children:t.icon}),(0,f.jsx)(a.T,{size:$,weight:"bold",colour:u?h.colours.red:c?h.colours.amber:h.colours.text,style:{lineHeight:$+4},children:(0,d.fmtStockCount)(e,t,n)}),!L||!(r||u||c)||u&&s.IS_CAR?null:(0,f.jsx)(a.T,{size:10,weight:"semibold",colour:u||c?'#FFB3AA':h.colours.goldLight,children:u?'none left':r?`${(0,d.fmtStockCount)(e,t,r)} res`:'low'})]},t.key)})}),j?(0,f.jsx)(w,{rid:e,by:t,app:l,group:y,onClose:()=>C(!1)}):null]})}},1142,[982,846,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); __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}},1143,[5,797,841,798,236,844]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,x.jsxs)(r.default,{style:{gap:12},children:[(0,x.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,x.jsx)(y,{}):'take'===t?(0,x.jsx)(j,{}):(0,x.jsx)(f,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]);function y(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[y,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===y?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,x.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,x.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,x.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,x.jsx)(p.Seg,{value:y,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,x.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,x.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,x.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,x.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,x.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,x.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,x.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function j(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[y,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=y[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,x.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,x.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,x.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,x.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,x.jsx)(o.T,{size:16,children:e.name}),(0,x.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,x.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:y[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(y[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:y[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,x.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,x.jsx)(o.Muted,{children:"\u2014"}):(0,x.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,x.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,x.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,x.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function f(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,x.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,x.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,x.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,x.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,x.jsx)(v,{id:e.id,me:t}):null]},e.id)})]})}function v({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[y,j]=(0,l.useState)(b.lines.map(e=>({...e}))),f=(e,t)=>j(i=>i.map(i=>i.ing===e?{...i,...t}:i)),v='expected'!==b.status,k=(0,l.useMemo)(()=>y.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),w=k.filter(e=>Math.abs(e.pct)>=.5),$=y.reduce((e,t)=>e+t.received*t.price,0);return(0,x.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[k.map(({l:e,i:i,short:l,pct:d})=>(0,x.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,x.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,x.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,x.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>f(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!v?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>f(e.ing,{price:100*(Number(t.replace(',','.'))||0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,x.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,x.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round($))]}),S.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[S.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,w.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[w.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,v?(0,x.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,x.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,y,i,[S.length?`${S.length} short`:'',w.length?`${w.length} price changes`:''].filter(Boolean).join(', '))})]})}},1144,[796,1016,1129,982,34,402,102,794,865,836,840,1124,1018,25]); __d(function(g,_r,_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,100][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:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,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))]})}},1145,[796,1146,34,402,102,426,794,865,836,827,840,1147,1100,1050,25]); @@ -1235,279 +1235,280 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1152,[34,402,102,1153,840,794,25]); __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])},1153,[34,900,25]); __d(function(g,_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 M}}),_e.allocate=O,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:T,now:C,today:S,role:k,meId:v,me:D}=(0,x.useCtx)(6e4),B=(0,u.useOwner)(e=>e.staff),F=(0,u.useOwner)(e=>e.attendance),N=(0,u.useOwner)(e=>e.shifts),R=(0,u.useOwner)(e=>e.tronc),E=(0,u.useOwner)(e=>e.troncCash),L=(0,u.useOwner)(e=>e.troncHistory),z=(0,u.useOwner)(e=>e.troncLog),_=(0,c.useOrders)(T),V=(0,j.useVenuePay)(T).pay,[q,H]=(0,i.useState)(-1),[U,W]=(0,i.useState)(''),[Y,K]=(0,i.useState)(!1),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(R.text),[Z,ee]=(0,i.useState)(null),te='staff'!==k,se='owner'===k,{s:oe,e:ie,key:ne}=(0,j.venueRange)(V,'tips',q,C),re=`${(0,h.niceDate)(oe)} \u2013 ${(0,h.niceDate)(ie)} ${ie.getFullYear()}`,le=L.find(e=>e.key===ne),ae=e=>u.useOwner.getState().setOwner({tronc:{...R,...e}}),de=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ce=Math.round((ie.getTime()-oe.getTime())/864e5)+1,ue=(0,i.useMemo)(()=>{let e=_.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(oe)&&e.createdAt.slice(0,10)<=(0,h.ymd)(ie)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!de)for(let t=0;tC)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ne,_.length,de]),pe=E[ne]??0,he=le?le.pot:ue+pe,me=(0,i.useMemo)(()=>{const e={};for(let t=0;tS)break;const o=(0,h.ymd)(s);B.forEach(t=>{const s=F.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ne,F.length,N.length,B.length]),fe=B.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&R.includeManagers||'owner'===e.role&&R.includeOwner)),ye=(0,i.useMemo)(()=>{if(le)return le.rows;const e=fe.map(e=>{const t=(me[e.id]?.paid??0)/60,s=R.points[M(e)]??1;return'hours'===R.method?t:'points'===R.method?t*s:'equal'===R.method?t>0?1:0:R.custom[e.id]??0}),{amounts:t}=O(he,e),s=e.reduce((e,t)=>e+t,0);return fe.map((o,i)=>({staffId:o.id,hours:(me[o.id]?.paid??0)/60,points:R.points[M(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[le,fe.map(e=>e.id).join(),me,R,he]),ge=ye.reduce((e,t)=>e+t.amount,0),xe=le?0:(()=>{const e=ye.map(e=>e.pct);return O(he,e).remainder})(),je=Object.entries(R.custom).filter(([e])=>fe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),be='custom'===R.method&&Math.abs(je-100)>.01,we=new Date(ie.getFullYear(),ie.getMonth()+2,0),Te=[...L].sort((e,t)=>t.end.localeCompare(e.end))[0],Ce=0!==L.length&&(0,h.parseYmd)(Te.end)<(0,h.addMins)(C,-89280),Se=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return`${I(t.name)},${M(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return te?(0,P.jsxs)(l.default,{style:{gap:10},children:[(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,P.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>H(q-1)}),(0,P.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,P.jsx)(d.T,{weight:"semibold",children:re}),le?(0,P.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${le.lockedAt}`}):q>=0?(0,P.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,P.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:q>=0,onPress:()=>H(q+1)})]}),(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Card tips on orders"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.card:ue)})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Cash tips"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.cash:pe)})]}),le?null:(0,P.jsxs)(d.Row,{gap:6,children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:U,onChangeText:W,style:[d.styles.input,{flex:1}]}),(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(U)>=0)||''===U.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...E,[ne]:Math.round(100*Number(U))}}),W('')}})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,P.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(he)})]}),(0,P.jsx)(d.Muted,{children:de?'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).'})]}),le?(0,P.jsxs)(d.Muted,{children:["Locked with method: ",$[le.method],"."]}):(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,P.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,P.jsx)(d.Chip,{label:$[e],selected:R.method===e,onPress:()=>se&&ae({method:e})},e))}),se?null:(0,P.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===R.method?Object.entries(R.points).map(([e,t])=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:e}),(0,P.jsx)(d.Row,{gap:6,children:(0,P.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>se&&ae({points:{...R.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===R.method?(0,P.jsxs)(P.Fragment,{children:[fe.map(e=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,P.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(R.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ae({custom:{...R.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ae({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,P.jsxs)(d.T,{size:13,colour:be?m.colours.red:m.colours.ok,children:["Total ",je.toFixed(1),"%",be?' (must be 100%)':' \u2713']})]}):null,(0,P.jsx)(d.Toggle,{label:"Include managers",value:R.includeManagers,onChange:e=>se&&ae({includeManagers:e})}),(0,P.jsx)(d.Toggle,{label:"Include owner",value:R.includeOwner,onChange:e=>se&&ae({includeOwner:e})}),R.includeOwner?(0,P.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,P.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,P.jsxs)(d.T,{center:!0,children:["Points: ",'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013']}),(0,P.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,P.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,P.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(ge)]})]}):(0,P.jsx)(r.default,{horizontal:!0,children:(0,P.jsxs)(l.default,{children:[(0,P.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,P.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,P.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,P.jsx)(d.T,{size:13,style:{width:54},children:'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013'}),(0,P.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,P.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,P.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,P.jsx)(d.T,{size:13,weight:"bold",colour:ge===he?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(ge)})]})]})}),(0,P.jsxs)(d.Muted,{children:[ge===he?`\u2713 Total equals the pot (${(0,p.gbp)(he)}).`:'\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."]}),le?null:(0,P.jsx)(d.Button,{label:"Approve & lock period",disabled:!se||q>=0||be||ge!==he||he<=0,onPress:()=>{const e=`${(0,h.niceDate)(C)} ${C.toTimeString().slice(0,5)}`,t={id:`tp-${ne}`,key:ne,label:re,end:(0,h.ymd)(ie),pot:he,card:ue,cash:pe,method:R.method,rows:ye,lockedAt:e,by:D};u.useOwner.getState().setOwner({troncHistory:[t,...L],troncLog:[{id:`tl-${Date.now()}`,at:C.toISOString(),text:`${D} approved & locked tips for ${re}: ${(0,p.gbp)(he)} split ${$[R.method].toLowerCase()} between ${ye.filter(e=>e.amount>0).length} staff`},...z]})}}),!le&&q>=0?(0,P.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,se||le?null:(0,P.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),le?(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:le.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!le.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${re} approved: ${(0,p.gbp)(le.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:L.map(e=>e.id===le.id?{...e,shared:(0,h.niceDate)(C)}:e)}),ee('Posted to All staff chat.')}}):null]}),Z?(0,P.jsx)(d.Banner,{kind:"info",title:Z}):null,(0,P.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,P.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(he)} = allocated ${(0,p.gbp)(ge)}`],[R.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Ce,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(we)} ${we.getFullYear()}`],[!0,'Tip records kept for 3 years',`${L.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,P.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,P.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,P.jsxs)(l.default,{style:{flex:1},children:[(0,P.jsx)(d.T,{size:14,children:t}),(0,P.jsx)(d.Muted,{children:s})]})]},String(t))),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{X(R.text),Q(!0)}})]}),(0,P.jsx)(y.SectionHead,{title:"Tip history & audit log"}),L.map(e=>(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"semibold",children:e.label}),(0,P.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,P.jsxs)(d.Muted,{children:[$[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,P.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),L.length||z.length?null:(0,P.jsx)(d.Muted,{children:"No approved periods yet."}),(0,P.jsxs)(d.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,P.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,P.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Se.map((e,t)=>(0,P.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,P.jsxs)(d.Muted,{children:[re," \xb7 ",$[le?.method??R.method]]})]}),(0,P.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tipping policy",children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:se,value:J,onChangeText:X,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),se?(0,P.jsx)(d.Button,{label:"Save policy",onPress:()=>{ae({text:J}),Q(!1)}}):null,(0,P.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,P.jsx)(A,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||B()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${D(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${D(i)}`;return(0,P.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(R,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,P.jsx)(R,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=A;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},M=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',I=e=>(e??'').replace(' (example)','');function O(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const D=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function B(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const F={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,k.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),B()?{pot:F.pot,today:F.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function R({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${D(s)}`;return(0,P.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,P.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,P.jsx)(d.Muted,{center:!0,children:o}):(0,P.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:D(s)})]})}function A(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,P.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,P.jsx)(R,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,P.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,P.jsx)(R,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1154,[798,796,806,34,402,295,102,426,794,848,865,836,827,840,1135,1147,1100,1050,1119,985,1024,1048,13,1049,2,25]); -__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,D.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,D.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),w=(0,f.useOwner)(e=>e.swaps),[v,$]=(0,l.useState)(0),[M,O]=(0,l.useState)(null),[R,P]=(0,l.useState)(null),[z,A]=(0,l.useState)('week'),[N,F]=(0,l.useState)(''),[K,U]=(0,l.useState)(''),[G,X]=(0,l.useState)(''),J='staff'!==t,Q=(0,y.addMins)(_(e),7*v*1440);Q.setHours(0,0,0,0);const Z=q(Q),ee=Z.sales,te='none'===Z.mode,se=Array.from({length:7},(e,t)=>{const s=new Date(Q);return s.setDate(Q.getDate()+t),(0,y.ymd)(s)}),ne=(0,f.visibleShifts)(i,J).filter(e=>e.date>=se[0]&&e.date<=se[6]),ae=(()=>{const e=new Date(Q);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),oe=ne.filter(e=>!e.published||e.changed).length,ie=i.filter(e=>e.date>=ae&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),re=se.map(e=>ne.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(h[s.staffId]??0);var s},0)),de=re.reduce((e,t)=>e+t,0),ce=ee.reduce((e,t)=>e+t,0),ue=(e,t)=>t?Math.round(e/t*100):0,he=J?o:o.filter(e=>e.id===n),fe=(0,a.useNarrow)(),me=Math.max(0,se.indexOf((0,y.ymd)(e))),[pe,xe]=(0,l.useState)(null),ge=pe??me,je=(e,t)=>!fe||t===ge,be=fe?150:74;return(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(u.Chip,{label:`Swaps & leave (${w.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(u.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(v-1),O(null)}}),(0,H.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(Q)]}),(0,H.jsxs)(u.Muted,{children:[0===v?'This week':1===v?'Next week':-1===v?'Last week':v>0?`In ${v} weeks`:-v+" weeks ago",J?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(v+1),O(null)}})]}),J?(0,H.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ie?` (${ie})`:''),disabled:!ie,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(ae,se[0]);O(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,H.jsx)(u.Button,{small:!0,kind:"success",label:oe?`Publish ${oe} ${1===oe?'change':'changes'}`:'Week published',disabled:!oe,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(se[0]);O(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),oe?(0,H.jsx)(u.Badge,{kind:"amber",label:`${oe} unpublished`}):ne.length?(0,H.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,M?(0,H.jsx)(u.Banner,{kind:"success",title:M}):null,fe?(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(u.Chip,{label:`${e} ${(0,y.parseYmd)(se[t]).getDate()}`,selected:t===ge,onPress:()=>xe(t)},e))}):null,(0,H.jsx)(d.default,{horizontal:!fe,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(c.default,{style:{gap:4},children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsxs)(u.T,{size:12,weight:"semibold",colour:se[s]===(0,y.ymd)(e)?S.colours.gold:S.colours.text,children:[t," ",(0,y.parseYmd)(se[s]).getDate()]})},t)).filter(je)]}),he.map(e=>(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(ne,e.id,se[s]),a=(m[e.id]??[]).includes(s),o=le(e.id,se[s]);return(0,H.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!J,onPress:()=>P({staffId:e.id,date:se[s],shift:n}),style:{width:be,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?S.colours.gold:S.colours.amber:S.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:o?'Leave':a?'Unavail.':J?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(u.T,{size:9,colour:S.colours.red,children:o?'on leave!':'unavailable'}):n&&J&&(!n.published||n.changed)?(0,H.jsx)(u.T,{size:9,colour:S.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(je)]},e.id)),J?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour"})}),re.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:'example'===Z.mode?'Fcst sales (ex.)':'Fcst sales'})}),ee.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour %"})}),re.map((e,t)=>{const s=ue(e,ee[t]);return(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,weight:"semibold",colour:ee[t]?s>32?S.colours.red:s>26?S.colours.amber:S.colours.ok:S.colours.muted,children:ee[t]?`${s}%`:'\u2013'})},t)}).filter(je)]})]}):null]})}),!J&&n?(0,H.jsx)(c.default,{testID:"rota-team-on",children:(0,H.jsx)(u.Card,{children:se.map((e,t)=>(0,H.jsx)(x.TeamOnDay,{date:e,meId:n,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(je)})}):null,J&&te?(0,H.jsx)(u.Card,{children:(0,H.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(c.default,{testID:"labour-week-cost",children:(0,H.jsx)(u.T,{weight:"semibold",children:(0,k.gbp)(de)})})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===Z.weeks?'1 week':`${Z.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),Z.booked?(0,H.jsx)(c.default,{testID:"labour-booked",children:(0,H.jsxs)(u.T,{children:["Booked so far: ",Z.booked," Covers this week"]})}):null]})}):null,J&&!te?(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(u.Row,{gap:6,children:['example'===Z.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(u.Badge,{kind:ue(de,ce)>30?'red':'ok',label:`${ue(de,ce)}% this week`})]})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(ce)," forecast sales. Target 25\u201330%. ",'example'===Z.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=ue(re[5],ee[5]);return e&&e<24?(0,H.jsxs)(u.T,{size:14,colour:S.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,J?(0,H.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>J||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,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(e=>L(s,e)).map(t=>(0,H.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,H.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,I.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),J?null:(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(u.Muted,{testID:"swap-dept-note",children:(0,j.isAnchorageVenue)(b.VENUE_RID)?j.ANCHORAGE_SWAP_NOTE:Y(o.find(e=>e.id===n))?j.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ne.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,I.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>L(o.find(e=>e.id===n),e)).map(t=>(0,H.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)}),ne.some(e=>e.staffId===n)?null:(0,H.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(C.SectionHead,{title:"Holiday & leave"}),p.filter(e=>J||e.staffId===n).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,H.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)((0,y.parseYmd)(e.from))," \u2013 ",(0,y.niceDate)((0,y.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Request leave",J?' (as yourself)':'']}),(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:N,onChangeText:F,style:[u.styles.input,{flex:1}]}),(0,H.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:K,onChangeText:U,style:[u.styles.input,{flex:1}]})]}),(0,H.jsx)(u.Field,{label:"Reason",value:G,onChangeText:X}),(0,H.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(N)||!/^\d{4}-\d{2}-\d{2}$/.test(K)||K{f.useOwner.getState().addLeave({staffId:n,from:N,to:K,reason:G.trim()||'Holiday'}),F(''),U(''),X('')}})]})]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",J?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),he.filter(e=>'owner'!==e.role||!J).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{gap:8,children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(u.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,H.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,D.useCtx)(5e3),x=((0,v.useClockArea)(e=>e.areas[m]),(0,v.areaOf)(m));const j=(0,$.privateClockVenue)(m),[b,w]=(0,l.useState)(!1),k=(0,f.useOwner)(e=>e.consent[a]),C=(0,f.useOwner)(e=>e.attendance),I=(0,f.useOwner)(e=>e.shifts),[B,z]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,N]=(0,l.useState)(null),[F,E]=(0,l.useState)(void 0),[W,_]=(0,l.useState)(null),[q,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=C.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)(I,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,M.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),N(null),E(void 0);const l=await(0,O.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(_(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&_(null),!0):(N(l.message),E(l.fix),(0,R.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 k?(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(T.StaffAvatar,{id:a,size:48}),(0,H.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,H.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(c.default,{testID:"clock-area-line",children:(0,H.jsx)(u.T,{size:14,colour:S.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,H.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(c.default,{testID:"on-break",children:(0,H.jsxs)(u.T,{size:15,weight:"semibold",colour:S.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.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,H.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,H.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'):(N(null),z(!0))}})]}):(0,H.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(c.default,{testID:"clock-message",children:(0,H.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===F?(0,H.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===F?(0,H.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===F?(0,H.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,M.areaSet)(x)?(0,H.jsx)(c.default,{testID:"clock-area-warning",children:(0,H.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,H.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(u.T,{size:14,colour:S.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.T,{weight:"semibold",colour:S.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(u.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.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,H.jsx)(u.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(c.default,{style:{gap:12},children:[(0,H.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,H.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,H.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:()=>{w(!1),ae('in')}}),(0,H.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:m,today:t,now:e}):null,G?(0,H.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,H.jsx)(u.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,M.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.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,H.jsx)(c.default,{style:{gap:10},children:(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.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,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.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,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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]),S=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),v=_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]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const Y=e=>(0,j.deptKey)(e?.dept),L=(e,t)=>(0,j.canSwapWith)(e,t,b.VENUE_RID),N=2650,F=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,z.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,w.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*N+t.restOfDay.takeaway*F:0})}},[s,a,o,i,r,(0,y.ymd)(e)])}function V({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,H.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,H.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,H.jsx)(u.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{children:"Start"}),(0,H.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:"End"}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:i,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.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,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:D.fmtH,label:"Break time"}),(0,H.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,H.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,H.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,H.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,H.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({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,D.useSignedIn)(),{me:i,meId:r}=(0,D.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),w=s=>{if(!d)return;const a=(0,O.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,R.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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,b]=(0,l.useState)(h?Math.round(60*h.start):720),[w,k]=(0,l.useState)(h?Math.round(60*h.end):1200),[C,I]=(0,l.useState)(''),[T,v]=(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&&w<=j,P=(e,t)=>(0,H.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return T?(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.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,H.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,D.fmtH)(h.start)}\u2013${(0,D.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,y.hm)(new Date(c.in))}\u2013${c.out?(0,y.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,O?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(u.Field,{label:"Note for your manager (optional)",value:C,onChangeText:I,placeholder:"e.g. phone died",maxLength:200}),(0,H.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,w):void 0,note:C.trim(),at:t.toISOString()}),v(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.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,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(c.default,{children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(u.T,{size:28,weight:"bold",colour:S.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(u.T,{size:18,weight:"semibold",colour:w?S.colours.amber:S.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.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,H.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(C.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsxs)(u.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.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,H.jsx)(C.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,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(u.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.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,H.jsxs)(u.T,{size:13,colour:S.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,H.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,D.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,j]=(0,l.useState)(s),[b,w]=(0,l.useState)(null),[I,v]=(0,l.useState)(!1),$=!!(0,D.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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),B=P.filter(f.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),Y=B.reduce((t,s)=>t+(0,D.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(B.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,D.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,D.fmtH)(a.start)}-${(0,D.fmtH)(a.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.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,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(u.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(u.T,{size:13,colour:S.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(u.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(a.WideTable,{children:(0,H.jsxs)(c.default,{style:{gap:2},children:[(0,H.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:S.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(u.T,{size:12,weight:"semibold",colour:S.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,D.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(T.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:l?`${(0,D.fmtH)(l.start)}\u2013${(0,D.fmtH)(l.end)}`:'\u2013'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?S.colours.ok:'open'===(0,f.attStatus)(t)?S.colours.blue:S.colours.amber,children:(0,m.statusLabel)(t)}),(0,H.jsx)(u.T,{size:11,style:{width:140},colour:c.length?S.colours.amber:S.colours.ok,children:c.join(', ')||'OK'}),(0,H.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(u.T,{size:12,colour:S.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?S.colours.muted:S.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,H.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>v(!0)}),(0,H.jsx)(C.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(u.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(m.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(u.Sheet,{visible:I,onClose:()=>v(!1),title:"Payroll export",children:[(0,H.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(u.T,{size:10,colour:t?S.colours.text:S.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,796,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); +__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:s}=(0,D.useCtx)(6e4),a=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,h.useOwner)(e=>e.shifts),u=(0,D.useHourly)(),f=(0,h.useOwner)(e=>e.availability),m=(0,h.useOwner)(e=>e.leave),w=(0,h.useOwner)(e=>e.swaps),[T,$]=(0,i.useState)(0),[O,M]=(0,i.useState)(null),[R,P]=(0,i.useState)(null),[z,A]=(0,i.useState)('week'),[F,Y]=(0,i.useState)(!1),K=(0,D.useSignedIn)()?.name??'',U='staff'!==t,G=(0,y.addMins)(_(e),7*T*1440);G.setHours(0,0,0,0);const X=q(G),J=X.sales,Q='none'===X.mode,Z=Array.from({length:7},(e,t)=>{const s=new Date(G);return s.setDate(G.getDate()+t),(0,y.ymd)(s)}),ee=(0,h.visibleShifts)(o,U).filter(e=>e.date>=Z[0]&&e.date<=Z[6]),te=(()=>{const e=new Date(G);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),se=ee.filter(e=>!e.published||e.changed).length,ne=o.filter(e=>e.date>=te&&e.date!!(0,h.leaveOn)(m,e,t),oe=Z.map(e=>ee.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(u[s.staffId]??0);var s},0)),ie=oe.reduce((e,t)=>e+t,0),le=J.reduce((e,t)=>e+t,0),re=(e,t)=>t?Math.round(e/t*100):0,de=U?a:a.filter(e=>e.id===s),ce=(0,n.useNarrow)(),ue=Math.max(0,Z.indexOf((0,y.ymd)(e))),[he,fe]=(0,i.useState)(null),me=he??ue,pe=(e,t)=>!ce||t===me,xe=ce?150:74;return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(c.Chip,{label:`Swaps & time off (${w.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(c.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[!U&&s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-time-off"}):null,(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(T-1),M(null)}}),(0,H.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(c.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(G)]}),(0,H.jsxs)(c.Muted,{children:[0===T?'This week':1===T?'Next week':-1===T?'Last week':T>0?`In ${T} weeks`:-T+" weeks ago",U?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(T+1),M(null)}})]}),U?(0,H.jsxs)(c.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ne?` (${ne})`:''),disabled:!ne,testID:"rota-copy",onPress:()=>{const e=h.useOwner.getState().copyWeek(te,Z[0]);M(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,H.jsx)(c.Button,{small:!0,kind:"success",label:se?`Publish ${se} ${1===se?'change':'changes'}`:'Week published',disabled:!se,testID:"rota-publish",onPress:()=>{const e=h.useOwner.getState().publishWeek(Z[0]);M(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),se?(0,H.jsx)(c.Badge,{kind:"amber",label:`${se} unpublished`}):ee.length?(0,H.jsx)(c.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,O?(0,H.jsx)(c.Banner,{kind:"success",title:O}):null,ce?(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(c.Chip,{label:`${e} ${(0,y.parseYmd)(Z[t]).getDate()}`,selected:t===me,onPress:()=>fe(t)},e))}):null,(0,H.jsx)(r.default,{horizontal:!ce,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(d.default,{style:{gap:4},children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsxs)(c.T,{size:12,weight:"semibold",colour:Z[s]===(0,y.ymd)(e)?I.colours.gold:I.colours.text,children:[t," ",(0,y.parseYmd)(Z[s]).getDate()]})},t)).filter(pe)]}),de.map(e=>(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsxs)(c.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(c.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,h.shiftOf)(ee,e.id,Z[s]),a=(f[e.id]??[]).includes(s),o=ae(e.id,Z[s]);return(0,H.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!U,onPress:()=>P({staffId:e.id,date:Z[s],shift:n}),style:{width:xe,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?I.colours.gold:I.colours.amber:I.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(c.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:o?'Off':a?'Unavail.':U?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(c.T,{size:9,colour:I.colours.red,children:o?'on leave!':'unavailable'}):n&&U&&(!n.published||n.changed)?(0,H.jsx)(c.T,{size:9,colour:I.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(pe)]},e.id)),U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour"})}),oe.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:'example'===X.mode?'Fcst sales (ex.)':'Fcst sales'})}),J.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour %"})}),oe.map((e,t)=>{const s=re(e,J[t]);return(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,weight:"semibold",colour:J[t]?s>32?I.colours.red:s>26?I.colours.amber:I.colours.ok:I.colours.muted,children:J[t]?`${s}%`:'\u2013'})},t)}).filter(pe)]})]}):null]})}),!U&&s?(0,H.jsx)(d.default,{testID:"rota-team-on",children:(0,H.jsx)(c.Card,{children:Z.map((e,t)=>(0,H.jsx)(p.TeamOnDay,{date:e,meId:s,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(pe)})}):null,U&&Q?(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(d.default,{testID:"labour-week-cost",children:(0,H.jsx)(c.T,{weight:"semibold",children:(0,k.gbp)(ie)})})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(c.Muted,{children:`Forecasts start once CoverCharge has ${1===X.weeks?'1 week':`${X.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),X.booked?(0,H.jsx)(d.default,{testID:"labour-booked",children:(0,H.jsxs)(c.T,{children:["Booked so far: ",X.booked," Covers this week"]})}):null]})}):null,U&&!Q?(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(c.Row,{gap:6,children:['example'===X.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(c.Badge,{kind:re(ie,le)>30?'red':'ok',label:`${re(ie,le)}% this week`})]})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(le)," forecast sales. Target 25\u201330%. ",'example'===X.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=re(oe[5],J[5]);return e&&e<24?(0,H.jsxs)(c.T,{size:14,colour:I.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,U?(0,H.jsx)(c.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>U||e.fromId===s||e.toId===s).map(e=>{const t=o.find(t=>t.id===e.shiftId),s=a.find(t=>t.id===e.fromId),n=a.find(t=>t.id===e.toId);return(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(c.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:a.filter(e=>L(s,e)).map(t=>(0,H.jsx)(c.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{h.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,H.jsx)(c.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{h.useOwner.getState().setSwap(e.id,'approved');const s=e=>(a.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,C.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),U?null:(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(c.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(c.Muted,{testID:"swap-dept-note",children:(0,x.isAnchorageVenue)(j.VENUE_RID)?x.ANCHORAGE_SWAP_NOTE:N(a.find(e=>e.id===s))?x.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ee.filter(e=>e.staffId===s).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(d.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(c.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Ask for cover",onPress:()=>{h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,kind:'cover',note:'Can anyone cover?'}),(0,C.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(a.find(e=>e.id===s)?.name??'').replace(' (example)','')})`)}}),a.filter(e=>L(a.find(e=>e.id===s),e)).map(t=>(0,H.jsx)(c.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),ee.some(e=>e.staffId===s)?null:(0,H.jsx)(c.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(S.SectionHead,{title:"Holiday & time off"}),U?(0,H.jsx)(c.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>Y(!0)}):s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-requests-time-off"}):null,m.filter(e=>U||e.staffId===s).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,H.jsx)(c.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,H.jsxs)(c.Muted,{children:[(0,b.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,style:{justifyContent:'center'},children:[(0,H.jsx)(c.Button,{small:!0,label:"Approve",onPress:()=>h.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),U&&s?(0,H.jsx)(b.TimeOffSheet,{visible:F,onClose:()=>Y(!1),meId:s,me:K,manager:!0}):null]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Muted,{children:["Days each person can\u2019t work. ",U?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),de.filter(e=>'owner'!==e.role||!U).map(e=>(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{gap:8,children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(c.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(c.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(f[e.id]??[]).includes(s);return(0,H.jsx)(c.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>h.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:n,meId:r,me:u,r:f,rid:p}=(0,D.useCtx)(5e3),x=((0,T.useClockArea)(e=>e.areas[p]),(0,T.areaOf)(p));const j=(0,$.privateClockVenue)(p),[b,w]=(0,i.useState)(!1),k=(0,h.useOwner)(e=>e.consent[r]),S=(0,h.useOwner)(e=>e.attendance),C=(0,h.useOwner)(e=>e.shifts),[B,z]=(0,i.useState)(!1),[A,N]=(0,i.useState)(null),[L,F]=(0,i.useState)(null),[Y,E]=(0,i.useState)(void 0),[W,_]=(0,i.useState)(null),[q,V]=(0,i.useState)(!1),[G,X]=(0,i.useState)(null),J=S.filter(t=>t.staffId===r&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,h.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,h.visibleShifts)(C,'staff'!==n).find(e=>e.staffId===r&&e.date===t),ee='staff'!==n,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,O.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{N(s),F(null),E(void 0);const i=await(0,M.clockAction)(s,{rid:p,staffId:r,date:t,at:new Date(e.getTime()).toISOString(),...n});return N(null),i.ok?('out'===s&&i.att&&(_(i.att),(0,o.hrSettingsOf)(f.settings?.hr).on&&!a.useHr.getState().hasAnswered(p,i.att.id)&&X(i.att)),'in'===s&&_(null),!0):(F(i.message),E(i.fix),(0,R.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:i.message.split('. ')[0]+'.',body:i.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(v.StaffAvatar,{id:r,size:48}),(0,H.jsx)(c.T,{weight:"semibold",style:{flex:1},children:u})]}),(0,H.jsx)(c.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(c.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(d.default,{testID:"clock-area-line",children:(0,H.jsx)(c.T,{size:14,colour:I.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${f.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${f.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,H.jsxs)(c.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(c.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(d.default,{testID:"on-break",children:(0,H.jsxs)(c.T,{size:15,weight:"semibold",colour:I.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,h.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.jsx)(c.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,H.jsx)(c.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,H.jsx)(c.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),z(!0))}})]}):(0,H.jsx)(c.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(c.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,h.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(d.default,{testID:"clock-message",children:(0,H.jsx)(c.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===Y?(0,H.jsx)(c.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,O.areaSet)(x)?(0,H.jsx)(d.default,{testID:"clock-area-warning",children:(0,H.jsx)(c.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,H.jsx)(l.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(c.T,{size:14,colour:I.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(m.BreakRoomCard,{staffId:r,name:u,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.T,{weight:"semibold",colour:I.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(c.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.jsx)(c.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,H.jsx)(c.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(d.default,{style:{gap:12},children:[(0,H.jsxs)(c.T,{children:["We check once that you are at ",f.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,H.jsx)(c.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,H.jsx)(c.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{w(!1),ae('in')}}),(0,H.jsx)(c.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:p,today:t,now:e}):null,G?(0,H.jsx)(s.ShiftCheckout,{rid:p,shiftKey:G.id,day:G.date,meId:r,onClose:()=>X(null)}):null,(0,H.jsx)(c.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(d.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(c.Chip,{testID:`forgot-break-${e}`,label:(0,O.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.jsx)(c.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,H.jsx)(d.default,{style:{gap:10},children:(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",f.name,", within about ",x.radius," m."]}),(0,H.jsx)(c.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(c.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.jsx)(c.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 ",f.name," (within about ",x.radius," m)."]}),(0,H.jsx)(c.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.jsx)(c.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,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.jsx)(c.Button,{label:"I understand \u2014 continue",onPress:()=>h.useOwner.getState().giveConsent(r,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),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]),I=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const N=e=>(0,x.deptKey)(e?.dept),L=(e,t)=>(0,x.canSwapWith)(e,t,j.VENUE_RID),F=2650,Y=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,u.useBookings)(t),o=(0,u.useOrders)(t),l=(0,u.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,i.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),i=(0,z.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:i,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:i,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:i,booked:n,sales:t.map(e=>{const t=(0,w.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*F+t.restOfDay.takeaway*Y:0})}},[s,a,o,l,r,(0,y.ymd)(e)])}function V({init:e,onClose:t}){const s=(0,h.useOwner)(e=>e.staff),[n,a]=(0,i.useState)(e.shift?.start??12),[o,l]=(0,i.useState)(e.shift?.end??20),[r,u]=(0,i.useState)(e.shift?.breakAt),f=void 0===r||r>n&&rt.id===e.staffId),p=(0,h.leaveOn)((0,h.useOwner)(e=>e.leave),e.staffId,e.date);return(0,H.jsxs)(c.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[p?(0,H.jsx)(c.Banner,{kind:"warn",title:`${(m?.name??'').replace(' (example)','')} has time off: ${(0,b.rangeLabel)(p.from,p.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,H.jsx)(c.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,H.jsx)(c.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),l(s)}},e))}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{children:"Start"}),(0,H.jsx)(c.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:"End"}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:l,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(c.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(c.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.jsx)(c.Chip,{label:"Set a break time",onPress:()=>u(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,H.jsxs)(c.Row,{gap:6,children:[(0,H.jsx)(c.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:u,format:D.fmtH,label:"Break time"}),(0,H.jsx)(c.Chip,{label:"No set time",onPress:()=>u(void 0)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=h.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:f?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&f?{breakAt:r}:{}}),t()}}),(0,H.jsx)(c.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,H.jsx)(c.Button,{kind:"danger",label:"Remove shift",onPress:()=>{h.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({rid:e,today:t,now:s}){const n=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,h.useOwner)(e=>e.attendance),o=(0,D.useSignedIn)(),{me:l,meId:r}=(0,D.useCtx)(3e4),[d,u]=(0,i.useState)(null),[f,m]=(0,i.useState)(''),[p,x]=(0,i.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,h.isOnBreak)(j),w=s=>{if(!d)return;const a=(0,M.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??l},f);if(!a.ok)return void x(a.message);const i=n.find(e=>e.id===d)?.name??'them';(0,R.notify)({id:'mgr-clock',title:`Recorded for ${i}`,body:`Reason kept with the record: ${f.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Record it for someone"}),(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(c.Chip,{label:e.name,selected:d===e.id,onPress:()=>u(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Field,{label:"Reason (kept with the record)",value:f,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(c.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,h.useOwner)(e=>e.attendance),o=(0,h.useOwner)(e=>e.shifts),l=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),[r,d]=(0,i.useState)(s),u=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],m=(0,h.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,i.useState)(u&&!u.out?'out':'in'),[j,b]=(0,i.useState)(m?Math.round(60*m.start):720),[w,k]=(0,i.useState)(m?Math.round(60*m.end):1200),[S,C]=(0,i.useState)(''),[v,T]=(0,i.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,O='out'!==p,M='in'!==p,R=O&&M&&w<=j,P=(e,t)=>(0,H.jsx)(c.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return v?(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.jsx)(c.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,H.jsx)(c.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(c.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(c.Muted,{children:[m?`Your rota that day: ${(0,D.fmtH)(m.start)}\u2013${(0,D.fmtH)(m.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,y.hm)(new Date(u.in))}\u2013${u.out?(0,y.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(c.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(c.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),O?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,M?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(c.Field,{label:"Note for your manager (optional)",value:S,onChangeText:C,placeholder:"e.g. phone died",maxLength:200}),(0,H.jsx)(c.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{h.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:u?.id,kind:p,suggestedIn:O?(0,f.isoAt)(r,j):void 0,suggestedOut:M?(0,f.isoAt)(r,w):void 0,note:S.trim(),at:t.toISOString()}),T(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.useCtx)(3e4),n=(0,h.useOwner)(e=>e.attendance),a=(0,h.useOwner)(e=>e.shifts),o=(0,h.useOwner)(e=>e.timeRequests),[l,r]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),p=(0,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(h.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(d.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(d.default,{children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(c.T,{size:28,weight:"bold",colour:I.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(c.T,{size:18,weight:"semibold",colour:w?I.colours.amber:I.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(S.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsxs)(c.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(c.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,H.jsx)(S.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,h.shiftOf)((0,h.visibleShifts)(a,!1),t.staffId,t.date),n=(0,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(c.Card,{onPress:()=>m(u===t.id?null:t.id),children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(c.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.jsx)(c.Badge,{kind:(0,f.statusKind)(t),label:'awaiting'===(0,h.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,f.statusLabel)(t)})]}),o?(0,H.jsxs)(c.T,{size:13,colour:I.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(c.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,u===t.id?(0,H.jsx)(f.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(c.Muted,{children:"No clocked shifts yet."}),l?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const a=(0,h.useOwner)(e=>e.staff),o=(0,h.useOwner)(e=>e.shifts),r=(0,D.useHourly)(),u=(0,h.useOwner)(e=>e.attendance),m=(0,h.useOwner)(e=>e.timeRequests),p=(0,h.useOwner)(e=>e.attLog),[x,j]=(0,i.useState)(s),[b,w]=(0,i.useState)(null),[C,T]=(0,i.useState)(!1),$=!!(0,D.useSignedIn)(),O=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),M=u.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!M.some(t=>t.staffId===e.staffId)),P=u.filter(e=>O.includes(e.date)&&e.out),B=P.filter(h.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),N=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(B.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=a.find(e=>e.id===t.staffId),n=(0,h.shiftOf)(o,t.staffId,t.date),i=(0,D.paidMins)(t,e),l=r[t.staffId]??0;return`${s?.name},${t.date},${n?`${(0,D.fmtH)(n.start)}-${(0,D.fmtH)(n.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.hm)(new Date(t.out))},${i.brk},${(i.paid/60).toFixed(2)},${(l/100).toFixed(2)},${(i.paid/60*l/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:O.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(c.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(c.T,{size:13,colour:I.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(c.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(N))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(n.WideTable,{children:(0,H.jsxs)(d.default,{style:{gap:2},children:[(0,H.jsx)(n.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:I.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(c.T,{size:12,weight:"semibold",colour:I.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),M.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,h.shiftOf)(o,t.staffId,x),d=(0,D.paidMins)(t,e),u=(0,f.flagsFor)(t,r,e,s,m).map(e=>e.label);return(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(c.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(v.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(c.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:r?`${(0,D.fmtH)(r.start)}\u2013${(0,D.fmtH)(r.end)}`:'\u2013'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(c.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(c.T,{size:11,style:{width:120},colour:'confirmed'===(0,h.attStatus)(t)?I.colours.ok:'open'===(0,h.attStatus)(t)?I.colours.blue:I.colours.amber,children:(0,f.statusLabel)(t)}),(0,H.jsx)(c.T,{size:11,style:{width:140},colour:u.length?I.colours.amber:I.colours.ok,children:u.join(', ')||'OK'}),(0,H.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(c.T,{size:12,colour:I.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(c.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(c.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?I.colours.muted:I.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),M.length||R.length?null:(0,H.jsx)(c.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(c.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,H.jsx)(S.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(c.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(c.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(f.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(c.Sheet,{visible:C,onClose:()=>T(!1),title:"Payroll export",children:[(0,H.jsxs)(c.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(d.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(c.T,{size:10,colour:t?I.colours.text:I.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(c.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(c.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1159,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); __d(function(g,_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)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1156,[796,34,402,102,794,840,865,800,850,998,999,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),H=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),N=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(N.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),N.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(N.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:H.length?`Confirm all unflagged (${H.length})`:'Nothing unflagged to confirm',disabled:!H.length,onPress:()=>Y(H.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[H,N]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[H,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:H===e,onPress:()=>N(H===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:H?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),N=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),H=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(H.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),H.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(H.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:N.length?`Confirm all unflagged (${N.length})`:'Nothing unflagged to confirm',disabled:!N.length,onPress:()=>Y(N.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[N,H]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[N,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:N===e,onPress:()=>H(N===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:N?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:p}){const b=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.staff),f=(0,s.useMemo)(()=>(0,c.teamOnDay)(b,j,e,t),[b,j,e,t]);return(0,h.jsxs)(l.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(p,f),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",p]}),f.length?f.map(e=>(0,h.jsxs)(l.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,h.jsxs)(n.T,{size:13,center:!0,children:[e.name,e.job?(0,h.jsxs)(n.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,h.jsx)(n.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6])},1158,[34,102,794,865,1102,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1159,[34,102,794,865,840,1100,1103,1158,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1160,[34,102,1100,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1161,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1162,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1163,[]); -__d(function(g,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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1164,[829,34,236,402,102,900,848,840,794,1165,1099,1166,25]); -__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1165,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); -__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1166,[1167,1168,1170,1169,1171,1033,1172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1167,[]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1168,[808,5,815,818,846,1033,1169]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1169,[829,236,846,1167]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1170,[34,848,830,838,836,1168,1167]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1171,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1172,[34,1168,985,931]); -__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1173,[34,402,102,426,848,830,840,794,1164,1099,1174,25]); -__d(function(g,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}},1174,[34,102,426,848,830,1166,1033,840,794,1099,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1175,[34,236,402,102,853,794,840,994,1176,1177,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1176,[846,6,931,974,994,1166,1177]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1177,[808,1178,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1178,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1179,[34,846,1176]); -__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1180,[796,1181,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1181,[34,1019,865,804]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1182,[34,402,346,102,426,840,1153,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1183,[30,34,792,846,25]); -__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1184,[829,1097,851,30,34,1185,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); -__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])},1185,[796,34,236,102,25]); -__d(function(_g,_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"})]})]})}},1186,[30,34,336,102,1187,1189,794,830,836,848,856,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1187,[34,1188,102,830,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1188,[2,985]); -__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])},1189,[30,34,402,848,840,794,25]); -__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1190,[30,34,794,1191,848,1175,25]); -__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])},1191,[34,402,840,794,25]); -__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1192,[806,30,34,1193,794,836,848,840,1194,1198,25]); -__d(function(_g,r,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])},1193,[34,385,102,848,836,840,794,25]); -__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}},1194,[34,102,794,836,1195,1196,1197,840,25]); -__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})},1195,[]); -__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})},1196,[]); -__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()})},1197,[931,985,1196]); -__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}},1198,[815,931,974,985,2,1195]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1199,[1200,1209,5,1210,1211,1212,1215,829,30,34,236,402,102,1187,1189,794,830,836,852,848,840,1216,1175,846,865,1217,989,990,997,1219,1198,25]); -__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1200,[34,379,794,847,1201,1202,1208,848,5,6,25]); -__d(function(g,r,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])},1201,[34,379,102,794,991,992,1044,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1202,[6,34,931,794,1203,25]); -__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]})]})}},1203,[6,1204,1205,1206,34,102,796,794,840,11,1207,25]); -__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1205,[4,11]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1206,[11]); -__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.'}},1207,[6,931]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1208,[34,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1209,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1210,[34,102,794,1203,25]); -__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1211,[34,379,931,794,847,1201,1203,4,25]); -__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1212,[34,379,794,1201,847,1202,8,1213,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1213,[34,102,794,1214,25]); -__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1214,[]); -__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1215,[34,794,847,1201,1202,848,9,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1216,[34,402,102,426,794,840,1153,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1217,[798,34,336,395,402,295,102,1187,794,989,830,990,827,840,1034,25,1218]); -__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1218,[]); -__d(function(g,_r,_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)})]})}},1219,[34,102,1220,794,848,997,1195,1198,840,25]); -__d(function(g,r,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])},1220,[34,102,1221,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1221,[1222]); -__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1222,[34,900,1223,1252,1253,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1223,[1224]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1224,[1225,1226,1249,1251]); -__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1225,[]); -__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1226,[1227,1228,1229,1230,1231,1232,1233,1234,1235,1238,1242,1239,1243]); -__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1227,[]); -__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1228,[]); -__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1229,[]); -__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1230,[]); -__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1235,[1236]); -__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1239,[1240,1241]); -__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1240,[]); -__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1241,[]); -__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1244,[1239]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1245,[1239]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1247,[1239,1227]); -__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1248,[]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1249,[1250]); -__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1251,[1250]); -__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1252,[]); -__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1253,[34,900,1254,25]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1254,[]); -__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1255,[30,34,794,848,865,25]); -__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1256,[806,30,34,102,1220,794,836,848,840,1219,1198,25]); -__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1257,[806,30,34,102,1193,794,848,865,836,827,840,1194,1198,25]); -__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1258,[806,30,34,794,848,865,827,840,1219,1198,25]); -__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1259,[806,30,34,794,848,865,840,1219,1198,25]); -__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1260,[30,34,794,827,1120,1261,848,840,25]); -__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}},1261,[]); -__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1262,[30,1075,34,402,102,794,827,848,840,25]); -__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1263,[829,30,34,1185,995,102,1193,794,830,836,1104,827,848,800,840,833,25]); -__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1264,[30,34,102,1189,794,830,852,848,840,1216,5,25]); -__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)}})]})}},1265,[829,30,34,102,1193,1191,794,830,836,827,848,840,25]); -__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1266,[829,1198,30,34,102,794,830,836,827,848,853,25]); -__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]})}},1267,[30,34,846,25]); -__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}},1268,[806,30,34,794,848,5,1198,25]); -__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."})})}},1269,[30,34,794,1270,1131,1198,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1270,[796,829,34,102,794,830,836,1131,1271,848,840,25]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1271,[931,985,1131]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1272,[30,34,846,1273,1328,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"})]}),qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1273,[1121,5,6,1274,798,822,1094,829,1120,1275,1276,1277,1091,1115,1278,1279,1281,1282,1283,1130,977,1099,1284,34,1073,1148,1033,1087,1116,1285,380,402,295,102,426,36,794,1175,1179,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1286,1107,1287,1290,1292,1295,1298,1294,1299,1301,1302,1112,1093,1095,852,1304,1164,1305,1174,1166,1011,1310,1318,1320,1076,1114,1322,1323,1324,1143,1325,1142,1136,838,1326,1327,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1275,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1276,[1012,1100]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1277,[34,102,1079,794,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1278,[829,34,102,794,848,1131,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1279,[34,395,402,426,102,1220,794,1143,1014,1280,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1280,[]); -__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}))},1281,[815]); -__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1282,[798,34,379,395,402,102,794,1143,840,25]); -__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return v}}),_e.SoldOutStrip=function({rid:e,now:k,by:w,onOpen:F}){const I=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[C,_]=(0,n.useState)(0),[A,H]=(0,n.useState)(!1),L=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{O()},[]);const D=k??(0,p.nowFrom)(z),W=(0,S.activeSoldOut)(I,e,D);if(!W.length)return null;const E=W.map(e=>(0,x.withReason)(e.name,L.reason(e.itemId))),M=(0,S.stripText)(E),P=C>0&&(0,S.stripNeedsTicker)(E,C,v),R=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=R);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>F?F():H(!0),onLayout:e=>_(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:b.colours.accentBorder},children:[(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:b.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,j.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,j.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&T?{whiteSpace:'nowrap'}:{},fontFamily:b.fonts.medium,fontSize:v,lineHeight:20,color:b.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!T?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:12,color:b.colours.muted},children:"Tap for all"}):null]}),F?null:(0,j.jsxs)(c.Sheet,{visible:A,onClose:()=>H(!1),title:(0,S.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[w?(0,j.jsx)(u.SoldOutList,{rid:e,by:w,hideLinks:!0}):(0,j.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,j.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:b.colours.border},children:[(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.semibold,fontSize:17,color:b.colours.text},children:e.name}),L.reason(e.itemId)?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.medium,fontSize:14,color:b.colours.amber},children:L.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted},children:["Since ",$(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${$(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const T='undefined'!=typeof document,k=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let w=!1;function O(){if(!T||w)return;w=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=k,document.head.appendChild(e)}const $=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},v=15},1283,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,978,840,25]); -__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])},1284,[798,34,102,840,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1285,[34,102,900,840,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1286,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1287,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1288,1289,1014,865,1107,25]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1288,[798,829,34,1289,102,828,840,794,1108,25]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1289,[828]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1290,[34,236,402,102,840,794,1143,1291,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1291,[]); -__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1292,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1293,840,794,1294,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1293,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1294,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1295,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1281,1296,2,1297,1298,848,827,25]); -__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1296,[236]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1298,[34,815,931,985,1297]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1299,[829,14,1014,1300]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1300,[830]); -__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1301,[34,102,900,840,25]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1302,[829,1014,34,102,794,1096,848,1303,1299,1095,1093,1112,1113,1114,840,1276,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1303,[1014,1079]); -__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1304,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1294,848,1014,830,1089,1079,1261,840,1276,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1305,[796,34,236,402,102,794,848,1014,1306,840,1307,1309,25]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1306,[]); -__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1307,[815,848,1014,1306,1308,1309]); -__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1308,[829]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1309,[236,1308]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1310,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1311,1314,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1311,[1312,839,829,34,281,395,402,295,102,848,1011,1014,1313,827,840,1041,794,1314,1315,985,1276,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1312,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1313,[852,827,851]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1314,[5,1014,931,985]); -__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})},1315,[815,931,985,1316,2,1317]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1316,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1317,[15]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1318,[34,102,900,794,1143,827,840,798,1319,1320,1321,25]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1319,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1320,[]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1321,[1079]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1322,[829,1300]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1323,[34,402,102,794,1322,840,1285,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1324,[34,102,899,794,1143,827,840,25]); -__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1325,[34,1143,402,102,426,794,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1326,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1315,985,25]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1327,[34,1021,865,1001,800,1022,994,1315,1070]); -__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1328,[5,798,847,34,236,402,102,426,985,840,794,1281,1329,25]); -__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}})()},1329,[]); -__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]})}},1330,[30,34,846,25]); +__d(function(g,_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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1159,[34,402,102,794,865,827,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1160,[34,102,794,865,840,1100,1103,1158,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1161,[34,102,1100,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1162,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1163,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1164,[]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1165,[829,34,236,402,102,900,848,840,794,1166,1099,1167,25]); +__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1166,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); +__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1167,[1168,1169,1171,1170,1172,1033,1173]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1168,[]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1169,[808,5,815,818,846,1033,1170]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1170,[829,236,846,1168]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1171,[34,848,830,838,836,1169,1168]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1172,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1173,[34,1169,985,931]); +__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1174,[34,402,102,426,848,830,840,794,1165,1099,1175,25]); +__d(function(g,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}},1175,[34,102,426,848,830,1167,1033,840,794,1099,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1176,[34,236,402,102,853,794,840,994,1177,1178,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1177,[846,6,931,974,994,1167,1178]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1178,[808,1179,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1179,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1180,[34,846,1177]); +__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1181,[796,1182,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1182,[34,1019,865,804]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1183,[34,402,346,102,426,840,1153,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1184,[30,34,792,846,25]); +__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1185,[829,1097,851,30,34,1186,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); +__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])},1186,[796,34,236,102,25]); +__d(function(_g,_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"})]})]})}},1187,[30,34,336,102,1188,1190,794,830,836,848,856,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1188,[34,1189,102,830,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1189,[2,985]); +__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])},1190,[30,34,402,848,840,794,25]); +__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1191,[30,34,794,1192,848,1176,25]); +__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])},1192,[34,402,840,794,25]); +__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1193,[806,30,34,1194,794,836,848,840,1195,1199,25]); +__d(function(_g,r,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])},1194,[34,385,102,848,836,840,794,25]); +__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}},1195,[34,102,794,836,1196,1197,1198,840,25]); +__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})},1196,[]); +__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})},1197,[]); +__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()})},1198,[931,985,1197]); +__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}},1199,[815,931,974,985,2,1196]); +__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1200,[1201,1210,5,1211,1212,1213,1216,829,30,34,236,402,102,1188,1190,794,830,836,852,848,840,1217,1176,846,865,1218,989,990,997,1220,1199,25]); +__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1201,[34,379,794,847,1202,1203,1209,848,5,6,25]); +__d(function(g,r,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])},1202,[34,379,102,794,991,992,1044,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1203,[6,34,931,794,1204,25]); +__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]})]})}},1204,[6,1205,1206,1207,34,102,796,794,840,11,1208,25]); +__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1206,[4,11]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1207,[11]); +__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.'}},1208,[6,931]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1209,[34,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1210,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1211,[34,102,794,1204,25]); +__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1212,[34,379,931,794,847,1202,1204,4,25]); +__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1213,[34,379,794,1202,847,1203,8,1214,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1214,[34,102,794,1215,25]); +__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1215,[]); +__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1216,[34,794,847,1202,1203,848,9,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1217,[34,402,102,426,794,840,1153,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1218,[798,34,336,395,402,295,102,1188,794,989,830,990,827,840,1034,25,1219]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1219,[]); +__d(function(g,_r,_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)})]})}},1220,[34,102,1221,794,848,997,1196,1199,840,25]); +__d(function(g,r,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])},1221,[34,102,1222,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1222,[1223]); +__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1223,[34,900,1224,1253,1254,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1224,[1225]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1225,[1226,1227,1250,1252]); +__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1226,[]); +__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1227,[1228,1229,1230,1231,1232,1233,1234,1235,1236,1239,1243,1240,1244]); +__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1228,[]); +__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1229,[]); +__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1230,[]); +__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1231,[]); +__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1236,[1237]); +__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1240,[1241,1242]); +__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1241,[]); +__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1242,[]); +__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1245,[1240]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1246,[1240]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1248,[1240,1228]); +__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1249,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1250,[1251]); +__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1252,[1251]); +__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1253,[]); +__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1254,[34,900,1255,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1255,[]); +__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1256,[30,34,794,848,865,25]); +__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1257,[806,30,34,102,1221,794,836,848,840,1220,1199,25]); +__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1258,[806,30,34,102,1194,794,848,865,836,827,840,1195,1199,25]); +__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1259,[806,30,34,794,848,865,827,840,1220,1199,25]); +__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1260,[806,30,34,794,848,865,840,1220,1199,25]); +__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1261,[30,34,794,827,1120,1262,848,840,25]); +__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}},1262,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1263,[30,1075,34,402,102,794,827,848,840,25]); +__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1264,[829,30,34,1186,995,102,1194,794,830,836,1104,827,848,800,840,833,25]); +__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1265,[30,34,102,1190,794,830,852,848,840,1217,5,25]); +__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)}})]})}},1266,[829,30,34,102,1194,1192,794,830,836,827,848,840,25]); +__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1267,[829,1199,30,34,102,794,830,836,827,848,853,25]); +__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]})}},1268,[30,34,846,25]); +__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}},1269,[806,30,34,794,848,5,1199,25]); +__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."})})}},1270,[30,34,794,1271,1131,1199,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1271,[796,829,34,102,794,830,836,1131,1272,848,840,25]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1272,[931,985,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1273,[30,34,846,1274,1329,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"}),G]}),Le,qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1274,[1121,5,6,1275,798,822,1094,829,1120,1276,1277,1278,1091,1115,1279,1280,1282,1283,1284,1130,977,1099,1285,34,1073,1148,1033,1087,1116,1286,380,402,295,102,426,36,794,1176,1180,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1287,1107,1288,1291,1293,1296,1299,1295,1300,1302,1303,1112,1093,1095,852,1305,1165,1306,1175,1167,1011,1311,1319,1321,1076,1114,1323,1324,1325,1143,1326,1142,1136,838,1327,1328,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1276,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1277,[1012,1100]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1278,[34,102,1079,794,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1279,[829,34,102,794,848,1131,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1280,[34,395,402,426,102,1221,794,1143,1014,1281,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1281,[]); +__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}))},1282,[815]); +__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1283,[798,34,379,395,402,102,794,1143,840,25]); +__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return F}}),_e.SoldOutStrip=function({rid:e,now:w,by:O,onOpen:I}){const C=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[_,A]=(0,n.useState)(0),[H,L]=(0,n.useState)(!1),D=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{$()},[]);const R=w??(0,p.nowFrom)(z),W=(0,b.activeSoldOut)(C,e,R);if(!W.length)return null;const E=W.map(e=>{const t=D.reason(e.itemId);return(0,x.withReason)(e.name,S.IS_CAR&&'none left'===t?'':t)}),M=(0,b.stripText)(E),P=_>0&&(0,b.stripNeedsTicker)(E,_,F),B=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=B);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>I?I():L(!0),onLayout:e=>A(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:j.colours.accentBorder},children:[(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:j.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,T.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,T.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&k?{whiteSpace:'nowrap'}:{},fontFamily:j.fonts.medium,fontSize:F,lineHeight:20,color:j.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!k?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:12,color:j.colours.muted},children:"Tap for all"}):null]}),I?null:(0,T.jsxs)(c.Sheet,{visible:H,onClose:()=>L(!1),title:(0,b.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[O?(0,T.jsx)(u.SoldOutList,{rid:e,by:O,hideLinks:!0}):(0,T.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,T.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.colours.border},children:[(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.semibold,fontSize:17,color:j.colours.text},children:e.name}),D.reason(e.itemId)?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.medium,fontSize:14,color:j.colours.amber},children:D.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted},children:["Since ",v(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${v(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]),T=r(_d[17]);const k='undefined'!=typeof document,w=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let O=!1;function $(){if(!k||O)return;O=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=w,document.head.appendChild(e)}const v=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},F=15},1284,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,846,978,840,25]); +__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])},1285,[798,34,102,840,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1286,[34,102,900,840,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1287,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1288,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1289,1290,1014,865,1107,25]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1289,[798,829,34,1290,102,828,840,794,1108,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1290,[828]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1291,[34,236,402,102,840,794,1143,1292,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1292,[]); +__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1293,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1294,840,794,1295,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1294,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1295,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1296,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1282,1297,2,1298,1299,848,827,25]); +__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1297,[236]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1299,[34,815,931,985,1298]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1300,[829,14,1014,1301]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1301,[830]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1302,[34,102,900,840,25]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1303,[829,1014,34,102,794,1096,848,1304,1300,1095,1093,1112,1113,1114,840,1277,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1304,[1014,1079]); +__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1305,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1295,848,1014,830,1089,1079,1262,840,1277,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1306,[796,34,236,402,102,794,848,1014,1307,840,1308,1310,25]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1307,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1308,[815,848,1014,1307,1309,1310]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1309,[829]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1310,[236,1309]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1311,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1312,1315,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1312,[1313,839,829,34,281,395,402,295,102,848,1011,1014,1314,827,840,1041,794,1315,1316,985,1277,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1313,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1314,[852,827,851]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1315,[5,1014,931,985]); +__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})},1316,[815,931,985,1317,2,1318]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1317,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1318,[15]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1319,[34,102,900,794,1143,827,840,798,1320,1321,1322,25]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1320,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1321,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1322,[1079]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1323,[829,1301]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1324,[34,402,102,794,1323,840,1286,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1325,[34,102,899,794,1143,827,840,25]); +__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1326,[34,1143,402,102,426,794,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1327,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1316,985,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1328,[34,1021,865,1001,800,1022,994,1316,1070]); +__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1329,[5,798,847,34,236,402,102,426,985,840,794,1282,1330,25]); +__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}})()},1330,[]); __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]})}},1331,[30,34,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1332,[30,34,1333,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1333,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1334,[30,34,846,1335,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1335,[1336,1340,798,991,1073,1341,1160,1040,1041,1342,1344,1347,1130,977,1042,2,1047,1048,1349,993,34,1132,1175,1179,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1350,1070,1085,1086,1082,1043,1025,1100,1357,1358,1359,1368,1369,997,236,1182,1145,1151,1365,1155,1154,1376,1148,15,1161,1162,899,793,985,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1336,[796,34,1033,395,102,1107,1108,1287,1310,794,1011,1014,827,840,1100,1015,1337,1338,1035,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1337,[796,34,402,102,794,840,1014,5,1015,846,985,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1338,[34,102,794,1014,1339,828,840,1060,931,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1339,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1340,[34,102,794,1100,985,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1341,[829,34,102,794,830,836,1131,848,838,840,25]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1342,[985,34,281,236,102,1220,794,1195,1198,840,1343,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1343,[34,236,102,794,1195,25]); -__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1344,[34,102,794,830,1195,1345,1346,840,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1345,[830]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1346,[985,1345,1198]); -__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1347,[5,1348,34,102,794,836,1195,1196,1197,985,1198,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1348,[34,794,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1349,[34,102,794,840,993,1037,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1350,[5,1348,11,1351,796,806,1112,1113,1091,1115,1114,1322,1323,1100,1276,1012,1089,14,1352,1175,1353,1310,1081,1075,1090,34,102,794,1285,848,830,836,827,1261,840,1147,1096,1014,1354,1355,1136,1356,1166,985,1149,1318,852,25]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1351,[6,34,102,794,985,1207,25]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1352,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1353,[34,402,1143,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1354,[34,102,848,1014,794,840,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1355,[34,402,102,794,840,25]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1356,[34,102,853,848,833,840,794,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1357,[34,1311,1100,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1358,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1359,[804,982,1360,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1360,[796,1120,985,900,1164,1166,34,281,379,236,402,102,426,853,794,848,1175,865,836,827,840,1147,1100,838,1361,1135,1365,1366,1119,1126,1125,1024,13,1123,1367,1364,25]); -__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1361,[925,800,798,806,852,1061,1362,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1364,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1362,[499,1363]); -__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 t}});var t={}},1363,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1364,[800,865,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.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1365,[796,34,1188,1041,839,379,402,102,794,865,836,827,840,1147,1100,1364,25]); -__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1366,[1042,34,402,102,794,865,840,1100,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1367,[798,34,283,364,236,102,426,900,794,796,840,1319,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1368,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); -__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1369,[5,1370,1371,1372,1373,1374,34,236,41,102,846,997,840,1375,794,985,2,1072,996,865,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1370,[34,102,847,794,5,6,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1371,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1372,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1373,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1374,[34,102,847,794,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1375,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const v=(0,m.useInStaffApp)(),{now:L,meId:N,me:A,r:z,today:H}=(0,m.useCtx)(3e4),O=(0,s.useTravelDay)('staff',H),P=(0,c.useOwner)(e=>e.shifts),R=(0,c.useOwner)(e=>e.attendance),F=(0,c.useOwner)(e=>e.staffCanViewSuppliers),_=(0,c.useOwner)(e=>e.quickLinks),E=(0,c.useOwner)(e=>e.chat),W=(0,c.useOwner)(e=>e.swaps),V=(0,c.useOwner)(e=>e.leave),q=P.filter(e=>e.staffId===N&&e.published&&e.date>=H).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),G=q.find(e=>e.date===H),U=R.filter(e=>e.staffId===N&&e.in&&!e.out&&L.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Y=(0,x.usePay)(N,0),Q=(0,b.useOrders)(z.id),K=(0,b.useBookings)(z.id),J=Q.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,K))),X=K.filter(e=>e.date===H&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,Q.filter(T.LIVE))),Z=K.filter(e=>(0,S.undoKind)(e,H)||e.walkIn&&'cancelled'===e.status&&e.date===H).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),ee=E.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],se=W.filter(e=>e.fromId===N&&'open'===e.status).length+V.filter(e=>e.staffId===N&&'pending'===e.status).length,te=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & leave',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...F?[['Suppliers',()=>e('more','suppliers')]]:[]];return!v&&O?(0,$.jsxs)(o.default,{style:{gap:10},children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(s.DayView,{rid:z.id,day:O,today:H,app:"staff"})]}):(0,$.jsxs)(o.default,{style:{gap:10},children:[v?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(t.CoversToday,{rid:z.id})]}),(0,$.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,$.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,$.jsx)(C.StaffAvatar,{id:N,size:52})}),(0,$.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",A.replace(' (example)','').split(' ')[0]]})]}),(0,$.jsx)(r.Badge,{kind:"gold",label:v?z.name:'Staff app preview'})]}),(0,$.jsx)(r.Muted,{children:v?`${L.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,$.jsx)(M.StaffTipsTile,{rid:z.id,today:H,onPress:()=>e('more','mytips')}),(0,$.jsxs)(r.Card,{highlight:U?u.colours.ok:void 0,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{weight:"semibold",children:U?`On shift since ${(0,h.hm)(new Date(U.in))}`:'Not clocked in'}),U?(0,$.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((L.getTime()-new Date(U.in).getTime())/6e4)))}):null]}),G?(0,$.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(G.start),"\u2013",(0,m.fmtH)(G.end)]}):q[0]?(0,$.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[q[0].day]," ",Number(q[0].date.slice(8))," ",(0,m.fmtH)(q[0].start),"\u2013",(0,m.fmtH)(q[0].end)]}):(0,$.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,$.jsx)(r.Button,{small:!0,kind:U?'secondary':'success',label:U?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),(0,$.jsx)(p.ShellfishTile,{rid:z.id,by:A.replace(' (example)',''),app:"staff"}),Z.length?(0,$.jsx)(r.Card,{children:(0,$.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",Z.length,")"]}),(0,$.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),Z.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,$.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,$.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,$.jsxs)(r.Muted,{children:[e.table?(0,D.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,$.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(z.id,e)}):null,e.walkIn?(0,$.jsx)(a.CancelWalkInButton,{rid:z.id,b:e,small:!0}):null,e.walkIn?(0,$.jsx)(a.ReinstateWalkInButton,{rid:z.id,b:e,today:H,small:!0}):null,(0,$.jsx)(S.BookingUndo,{b:e,rid:z.id,today:H,who:s})]})]},e.id)})]})}):null,J.length+X.length?(0,$.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",J.length+X.length,")"]}),(0,$.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),J.map(e=>(0,$.jsx)(j.AllergyChain,{o:e,me:A},e.id)),X.map(e=>(0,$.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,I.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,$.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsx)(j.BookingAllergyChain,{b:e,me:A}),(0,$.jsx)(o.default,{style:{flexDirection:'row'},children:(0,$.jsx)(w.WhatsAppGuest,{b:e,rid:z.id,kind:"auto"})})]},e.id))]}):null,ee?(0,$.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,$.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,$.jsx)(r.T,{size:14,children:ee.text})]}):null,(0,$.jsxs)(r.Card,{children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,$.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Y.paid)," paid hours"]})]}),se?(0,$.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,$.jsxs)(r.T,{size:14,children:["You have ",se," request",se>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(_,'staff').length?(0,$.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,$.jsx)(y.QuickLinksRow,{compact:!0})]}):null,v?null:(0,$.jsx)(o.default,{style:{gap:6},children:te.map(([e,s])=>(0,$.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),D=_r(d[23]),I=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27])},1376,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1361,1136,850,1149,838,1147,899,1354,1014,829,1096,1154,25]); -__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]})}},1377,[30,34,846,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1378,[1379,985,795,1329,1381,1011,30,1408,496,34,385,336,236,41,102,5,847,846,1410,36,848,1014,865,840,1369,997,1010,1413,1414,1415,1416,1099,2,1024,1417,1298,25,1418,1419,1420,1421]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1379,[2,796,34,236,383,102,794,1380,985,840,1151,997,865,988,25]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1380,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1381,[1382,1405,1407]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1382,[215,1383,1386,1400,1401,1402,1403,1404]); -__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1383,[215,1384]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1384,[1385]); -__d(function(g,r,i,a,m,e,d){},1385,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1386,[1387,215,1383,1400,1401]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1387,[1388,1389,1399]); -__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1388,[1389,1393,1398]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1389,[215,372,1390,1394,1395,1396,1397,1393,1398]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1390,[215,1391,339,280,1392,1393]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1391,[504]); -__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1392,[215,339]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1393,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1394,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1395,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1396,[1394]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1397,[]); -__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1398,[372,1392]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1399,[34,1389]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1400,[1387,215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1401,[1387,1400]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1402,[1383]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1403,[215,1383,1386,1384]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1404,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1405,[215,54,1406]); -__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1406,[215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1407,[34,1382]); -__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]}})})},1408,[1409]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1409,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1410,[34,41,102,426,794,847,997,985,2,5,840,1411,1412,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),e.railSizes=function(s,o){const l=s>=1600?168:s>=1200?136:120,t=Math.floor((o-44)/12),n=Math.max(44,Math.min(72,t-18));return{railW:l,per:t,circle:n,label:t>=80?13:t>=66?11:10,icon:Math.round(.46*n)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return o}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}];const o=s=>s.split('').join(' ')},1411,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1412,[34,102,794,840,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1413,[986,857,856,985]); -__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1414,[798,796,34,1337,1015,402,102,846,985,1007,1014,5,840,794,1281,974,2,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1415,[796,34,236,402,102,840,985,1045,2,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.VoiceHost=function(){return null}},1416,[]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=f(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),A=[],k=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);i.includes(c)||(A.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0}),d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:u(d,23.5)}:void 0}):d===y&&e<=m&&k.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:u(d,e-.05),inSite:!0}))}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!A.some(e=>e.staffId===t.staffId&&e.date===t.date)),...A],attendance:[...S.attendance,...k]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:u(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:u((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',f=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,u=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1417,[848,800,865,1024,15,997,846]); -__d(function(e,o,s,p,t,a,n){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1418,[]); -__d(function(o,s,e,p,t,c,d){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1419,[]); -__d(function(o,s,e,p,t,d,f){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1420,[]); -__d(function(o,s,e,p,t,d,n){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1421,[]); -__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]})}},1422,[30,34,846,25]); -__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1423,[1424]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1424,[25,1425,591]); -__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1425,[34,172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1426,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1427,[25,499,34,270,651]); +__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]})}},1332,[30,34,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1333,[30,34,1334,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1334,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1335,[30,34,846,1336,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1336,[1337,1341,798,991,1073,1342,1161,1040,1041,1343,1345,1348,1130,977,1042,2,1047,1048,1350,993,34,1132,1176,1180,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1351,1070,1085,1086,1082,1043,1025,1100,1358,1359,1360,1369,1370,997,236,1183,1145,1151,1366,1155,1154,1377,1148,15,1162,1163,899,793,985,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1337,[796,34,1033,395,102,1107,1108,1288,1311,794,1011,1014,827,840,1100,1015,1338,1339,1035,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1338,[796,34,402,102,794,840,1014,5,1015,846,985,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1339,[34,102,794,1014,1340,828,840,1060,931,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1340,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1341,[34,102,794,1100,985,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1342,[829,34,102,794,830,836,1131,848,838,840,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1343,[985,34,281,236,102,1221,794,1196,1199,840,1344,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1344,[34,236,102,794,1196,25]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1345,[34,102,794,830,1196,1346,1347,840,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1346,[830]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1347,[985,1346,1199]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1348,[5,1349,34,102,794,836,1196,1197,1198,985,1199,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1349,[34,794,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1350,[34,102,794,840,993,1037,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1351,[5,1349,11,1352,796,806,1112,1113,1091,1115,1114,1323,1324,1100,1277,1012,1089,14,1353,1176,1354,1311,1081,1075,1090,34,102,794,1286,848,830,836,827,1262,840,1147,1096,1014,1355,1356,1136,1357,1167,985,1149,1319,852,25]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1352,[6,34,102,794,985,1208,25]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1353,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1354,[34,402,1143,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1355,[34,102,848,1014,794,840,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1356,[34,402,102,794,840,25]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1357,[34,102,853,848,833,840,794,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1358,[34,1312,1100,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1359,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1360,[804,982,1361,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1361,[796,1120,985,900,1165,1167,34,281,379,236,402,102,426,853,794,848,1176,865,836,827,840,1147,1100,838,1362,1135,1366,1367,1119,1126,1125,1024,13,1123,1368,1365,25]); +__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1362,[925,800,798,806,852,1061,1363,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1365,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1363,[499,1364]); +__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 t}});var t={}},1364,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1365,[800,865,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.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1366,[796,34,1189,1041,839,379,402,102,794,865,836,827,840,1147,1100,1365,25]); +__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1367,[1042,34,402,102,794,865,840,1100,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1368,[798,34,283,364,236,102,426,900,794,796,840,1320,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1369,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); +__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1370,[5,1371,1372,1373,1374,1375,34,236,41,102,846,997,840,1376,794,985,2,1072,996,865,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1371,[34,102,847,794,5,6,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1372,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1373,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1374,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1375,[34,102,847,794,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1376,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const L=(0,m.useInStaffApp)(),{now:N,meId:A,me:O,r:R,today:z}=(0,m.useCtx)(3e4),H=(0,s.useTravelDay)('staff',z),P=(0,h.useOwner)(e=>e.shifts),F=(0,h.useOwner)(e=>e.attendance),_=(0,h.useOwner)(e=>e.staffCanViewSuppliers),E=(0,h.useOwner)(e=>e.quickLinks),W=(0,h.useOwner)(e=>e.chat),q=(0,h.useOwner)(e=>e.swaps),V=(0,h.useOwner)(e=>e.leave),G=P.filter(e=>e.staffId===A&&e.published&&e.date>=z).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),U=G.find(e=>e.date===z),Y=F.filter(e=>e.staffId===A&&e.in&&!e.out&&N.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Q=(0,x.usePay)(A,0),K=(0,b.useOrders)(R.id),J=(0,b.useBookings)(R.id),X=K.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,J))),Z=J.filter(e=>e.date===z&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,K.filter(T.LIVE))),ee=J.filter(e=>(0,S.undoKind)(e,z)||e.walkIn&&'cancelled'===e.status&&e.date===z).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),se=W.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],te=q.filter(e=>e.fromId===A&&'open'===e.status).length+V.filter(e=>e.staffId===A&&'pending'===e.status).length,ie=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],..._?[['Suppliers',()=>e('more','suppliers')]]:[]];return!L&&H?(0,v.jsxs)(o.default,{style:{gap:10},children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(s.DayView,{rid:R.id,day:H,today:z,app:"staff"})]}):(0,v.jsxs)(o.default,{style:{gap:10},children:[L?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(t.CoversToday,{rid:R.id})]}),(0,v.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,v.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,v.jsx)(C.StaffAvatar,{id:A,size:52})}),(0,v.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",O.replace(' (example)','').split(' ')[0]]})]}),(0,v.jsx)(r.Badge,{kind:"gold",label:L?R.name:'Staff app preview'})]}),(0,v.jsx)(r.Muted,{children:L?`${N.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,v.jsx)(M.StaffTipsTile,{rid:R.id,today:z,onPress:()=>e('more','mytips')}),(0,v.jsxs)(r.Card,{highlight:Y?u.colours.ok:void 0,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{weight:"semibold",children:Y?`On shift since ${(0,c.hm)(new Date(Y.in))}`:'Not clocked in'}),Y?(0,v.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((N.getTime()-new Date(Y.in).getTime())/6e4)))}):null]}),U?(0,v.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(U.start),"\u2013",(0,m.fmtH)(U.end)]}):G[0]?(0,v.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[G[0].day]," ",Number(G[0].date.slice(8))," ",(0,m.fmtH)(G[0].start),"\u2013",(0,m.fmtH)(G[0].end)]}):(0,v.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,v.jsx)(r.Button,{small:!0,kind:Y?'secondary':'success',label:Y?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),A?(0,v.jsx)($.RequestTimeOff,{meId:A,me:O,testID:"staff-home-time-off"}):null,(0,v.jsx)(p.ShellfishTile,{rid:R.id,by:O.replace(' (example)',''),app:"staff"}),ee.length?(0,v.jsx)(r.Card,{children:(0,v.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ee.length,")"]}),(0,v.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),ee.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,v.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,v.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,v.jsxs)(r.Muted,{children:[e.table?(0,I.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,v.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(R.id,e)}):null,e.walkIn?(0,v.jsx)(a.CancelWalkInButton,{rid:R.id,b:e,small:!0}):null,e.walkIn?(0,v.jsx)(a.ReinstateWalkInButton,{rid:R.id,b:e,today:z,small:!0}):null,(0,v.jsx)(S.BookingUndo,{b:e,rid:R.id,today:z,who:s})]})]},e.id)})]})}):null,X.length+Z.length?(0,v.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",X.length+Z.length,")"]}),(0,v.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),X.map(e=>(0,v.jsx)(j.AllergyChain,{o:e,me:O},e.id)),Z.map(e=>(0,v.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,D.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,v.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,I.tablesLabel)(e.table)}`:'']}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsx)(j.BookingAllergyChain,{b:e,me:O}),(0,v.jsx)(o.default,{style:{flexDirection:'row'},children:(0,v.jsx)(w.WhatsAppGuest,{b:e,rid:R.id,kind:"auto"})})]},e.id))]}):null,se?(0,v.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,v.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,v.jsx)(r.T,{size:14,children:se.text})]}):null,(0,v.jsxs)(r.Card,{children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,v.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Q.paid)," paid hours"]})]}),te?(0,v.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,v.jsxs)(r.T,{size:14,children:["You have ",te," request",te>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(E,'staff').length?(0,v.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,v.jsx)(y.QuickLinksRow,{compact:!0})]}):null,L?null:(0,v.jsx)(o.default,{style:{gap:6},children:ie.map(([e,s])=>(0,v.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27]),v=_r(d[28])},1377,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1362,1136,850,1149,838,1147,899,1355,1014,829,1096,1154,1159,25]); +__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]})}},1378,[30,34,846,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1379,[1380,985,795,1330,1382,1011,30,1409,496,34,385,336,236,41,102,5,847,846,1411,36,848,1014,865,840,1370,997,1010,1414,1415,1416,1417,1099,2,1024,1418,1299,25,1419,1420,1421,1422]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1380,[2,796,34,236,383,102,794,1381,985,840,1151,997,865,988,25]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1381,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1382,[1383,1406,1408]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1383,[215,1384,1387,1401,1402,1403,1404,1405]); +__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1384,[215,1385]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1385,[1386]); +__d(function(g,r,i,a,m,e,d){},1386,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1387,[1388,215,1384,1401,1402]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1388,[1389,1390,1400]); +__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1389,[1390,1394,1399]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1390,[215,372,1391,1395,1396,1397,1398,1394,1399]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1391,[215,1392,339,280,1393,1394]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1392,[504]); +__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1393,[215,339]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1394,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1395,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1396,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1397,[1395]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1398,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1399,[372,1393]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1400,[34,1390]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1401,[1388,215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1402,[1388,1401]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1403,[1384]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1404,[215,1384,1387,1385]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1405,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1406,[215,54,1407]); +__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1407,[215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1408,[34,1383]); +__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]}})})},1409,[1410]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1410,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1411,[34,41,102,426,794,847,997,985,2,5,840,1412,1413,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"RAIL_TITLE",{enumerable:!0,get:function(){return o}}),e.railSizes=function(s,l){const t=l>=1e3?13:11,n=Math.round(1.45*t),c=48+n+8,b=Math.floor((l-o-12)/12)>=c?1:2,h=12/b,p=Math.floor((l-o-12)/h),u=1===b?s>=1600?168:s>=1200?136:120:s>=1600?128:s>=1100?100:88,f=Math.max(44,Math.min(1===b?72:64,p-n-12,u-24));return{railW:u*b,colW:u,cols:b,per:p,circle:f,label:t,lineH:n,icon:Math.round(.46*f)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return l}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}],o=32;const l=s=>s.split('').join(' ')},1412,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1413,[34,102,794,840,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1414,[986,857,856,985]); +__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1415,[798,796,34,1338,1015,402,102,846,985,1007,1014,5,840,794,1282,974,2,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1416,[796,34,236,402,102,840,985,1045,2,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.VoiceHost=function(){return null}},1417,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=u(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),k=[],A=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);if(i.includes(c))continue;k.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0});const u='st-jack'===t?{auto:'rota'}:{};d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:f(d,23.5)}:void 0,...u}):d===y&&e<=m&&A.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:f(d,u.auto?e:e-.05),inSite:!0,...u})}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!k.some(e=>e.staffId===t.staffId&&e.date===t.date)),...k],attendance:[...S.attendance,...A]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:f(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:f((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,f=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1418,[848,800,865,1024,15,997,846]); +__d(function(e,o,s,p,t,a,n){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1419,[]); +__d(function(o,s,e,p,t,c,d){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1420,[]); +__d(function(o,s,e,p,t,d,f){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1421,[]); +__d(function(o,s,e,p,t,d,n){"use strict";t.exports="/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1422,[]); +__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]})}},1423,[30,34,846,25]); +__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1424,[1425]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1425,[25,1426,591]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1426,[34,172]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1427,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1428,[25,499,34,270,651]); __r(501); __r(21); __r(0); \ No newline at end of file diff --git a/customer-app/admin.html b/customer-app/admin.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/admin.html +++ b/customer-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer.html b/customer-app/customer.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer.html +++ b/customer-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage.html b/customer-app/customer/anchorage.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage.html +++ b/customer-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/book.html b/customer-app/customer/anchorage/book.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/book.html +++ b/customer-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/feedback.html b/customer-app/customer/anchorage/feedback.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/feedback.html +++ b/customer-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/gift.html b/customer-app/customer/anchorage/gift.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/gift.html +++ b/customer-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/lost.html b/customer-app/customer/anchorage/lost.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/lost.html +++ b/customer-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/loyalty.html b/customer-app/customer/anchorage/loyalty.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/loyalty.html +++ b/customer-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/merch.html b/customer-app/customer/anchorage/merch.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/merch.html +++ b/customer-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/offers.html b/customer-app/customer/anchorage/offers.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/offers.html +++ b/customer-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/refer.html b/customer-app/customer/anchorage/refer.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/refer.html +++ b/customer-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/waitlist.html b/customer-app/customer/anchorage/waitlist.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/waitlist.html +++ b/customer-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/anchorage/whatson.html b/customer-app/customer/anchorage/whatson.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/anchorage/whatson.html +++ b/customer-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/basket.html b/customer-app/customer/basket.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/basket.html +++ b/customer-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/customer/profile.html b/customer-app/customer/profile.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/customer/profile.html +++ b/customer-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/demo.html b/customer-app/demo.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/demo.html +++ b/customer-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/display.html b/customer-app/display.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/display.html +++ b/customer-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/index.html b/customer-app/index.html index e1f1a19ca0411d9d9d81ae09665f964a98ed7462..21db53aa3a9bc631dd0aa23ca813c72a13a5549d 100644 --- a/customer-app/index.html +++ b/customer-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/kitchen.html b/customer-app/kitchen.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/kitchen.html +++ b/customer-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/owner.html b/customer-app/owner.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/owner.html +++ b/customer-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/staff.html b/customer-app/staff.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/staff.html +++ b/customer-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/customer-app/sw.js b/customer-app/sw.js index 019a985f50d45dbd0a4bcf4983e050c32faf04dc..a3c81f315b3b9b82ca5c92490fafb5a10a238e85 100644 --- a/customer-app/sw.js +++ b/customer-app/sw.js @@ -1,7 +1,7 @@ // Anchorage service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-customer-0d187b5059"; +const V = "cc-customer-3291357212"; const BASE = "/customer-app/"; -const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=0d187b505966c8bb12ae64425dbcc5d6644c966d42540786c1354e25e97544d0"]; +const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=329135721208ae36a7b11f98c518ac0b709bcbb9ff7b9099cc45bd852f749756"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/customer-app/team.html b/customer-app/team.html index bcd490d489f4538b426990fdb1907df11270ce28..4c103ad96209bc51bfb5c07375ccda51216669bc 100644 --- a/customer-app/team.html +++ b/customer-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/_expo/static/js/web/bundle.js b/display-app/_expo/static/js/web/bundle.js index bcdca2ac55c9d57566b53d56cb31df9563010f7a..b225ba0f6c68a05bd89f404c8700180a63e9f3a8 100644 --- a/display-app/_expo/static/js/web/bundle.js +++ b/display-app/_expo/static/js/web/bundle.js @@ -23,11 +23,11 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_VENUE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PITCH_TEAM",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_TEXT",{enumerable:!0,get:function(){return o}}),e.pitchText=function(a){let n=a;for(const[a,t]of o)a.test(n)?(a.lastIndex=0,n=n.replace(a,t)):a.lastIndex=0;return n};const a={name:'The Harbour Kitchen',tagline:'Harbourside seafood & seasonal plates',location:'12 Quay Street, Portmorran',phone:'01632 960 123',website:'harbourkitchen.example'},n={'st-tracy':{name:'Morgan',job:'Owner',hourlyPence:null,salaried:!0},'st-gordon':{name:'Alex',job:'General Manager',dept:'Management',hourlyPence:null,salaried:!0},'st-bisto':{name:'Ravi',job:'Head Chef',hourlyPence:null,salaried:!0},'st-agate':{name:'Priya',job:'Front of house supervisor',hourlyPence:1450},'st-lenny':{name:'Tom',job:'Commis Chef',hourlyPence:1325},'st-finn':{name:'Lewis',job:'Bar staff',hourlyPence:1290},'st-eilidh':{name:'Chloe',job:'Front of house',hourlyPence:1271},'st-emily':{name:'Ellie',job:'Front of house',hourlyPence:1271},'st-lillie':{name:'Jordan',job:'Kitchen porter (KP)',hourlyPence:1271},'st-jack':{name:'Sam',job:'Kitchen porter (KP)',hourlyPence:1271}},o=[['Harbour View, Dunure, South Ayrshire',a.location],['Harbour View, Dunure',a.location],['Harbour View mug','Harbour Kitchen mug'],['Harbour View','Quay Street'],['anchoragedunure.com',a.website],['01292 502826',a.phone],['Mini Anchors','Little Crew'],['The Anchorage',a.name],['Anchorage','Harbour Kitchen'],['ANCHORAGE','HARBOUR KITCHEN'],['South Ayrshire','the Firth coast'],['Ayrshire','the Firth coast'],['Dunure','Portmorran'],['Kittyfisher boat (Big Sean)','Coastal Fish Co'],['Kittyfisher','Coastal Fish Co'],['Big Sean','Coastal Fish Co'],['Example Fish Co.','Coastal Fish Co'],['Sample Dairy Ltd','Hillside Dairy'],['Sample Fruit & Veg','Fieldfare Veg'],['Mills milk','Hillside Dairy milk'],['Mills','Hillside Dairy'],['J. Pieroni & Sons','Fieldfare Veg'],["Pieroni's",'Fieldfare Veg'],['Pieroni','Fieldfare Veg'],['Alsons (drinks)','Drinks wholesaler'],['Alsons','the drinks wholesaler'],['Spes Bona','the deli wholesaler'],['Tarelgin','the butcher'],['Reids','the bakery'],['Reeds','the bakery'],['Example Butchers Ltd','Quayside Butchers'],['Example Dry Goods Wholesale','Dry goods wholesaler'],['Sample Brewing Co.','Harbourside Brewing'],['Example Cleaning Supplies','Cleaning supplies'],['Sample Packaging Ltd','Packaging supplier'],['Example Kitchen Repairs','Kitchen repairs'],['Preston','Ravi'],['Bisto','Ravi'],['Tracy','Morgan'],['James','Morgan'],['Gordon','Alex'],['Agate','Priya'],['Lenny','Tom'],['Finn','Lewis'],['Eilidh','Chloe'],['Emily','Ellie'],['Gabrielle','Ellie'],['Cameron Mc','Sam'],['Cameron','Sam'],['Lillie','Jordan'],['Lily','Jordan'],['Mia','Jordan'],['Jack','Sam'],['Harvey','Jordan'],['Anna','the supplier'],['(preview)',''],[' (example)','']].map(([a,n])=>[new RegExp(`${/^[A-Za-z]/.test(a)?'(?g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`](_),globalThis.__webpack_require__=o=>{const t=ErrorUtils.reportFatalError;_&&(ErrorUtils.reportFatalError=_=>{throw _});try{return g[`${__METRO_GLOBAL_PREFIX__}__r`](o)}finally{_&&(ErrorUtils.reportFatalError=t)}}},23,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1442,1445]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1443,1446]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},25,[26]); __d(function(g,r,i,a,m,e,d){ /** @@ -41,7 +41,7 @@ __d(function(g,r,i,a,m,e,d){ */ "use strict";var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(t,o,f){var l=null;if(void 0!==f&&(l=""+f),void 0!==o.key&&(l=""+o.key),"key"in o)for(var y in f={},o)"key"!==y&&(f[y]=o[y]);else f=o;return o=f.ref,{$$typeof:n,type:t,key:l,ref:void 0!==o?o:null,props:f}}e.Fragment=t,e.jsx=o,e.jsxs=o},26,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ctx",{enumerable:!0,get:function(){return t}});const t=r(d[0])},27,[28]); -__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1183,1184,1186,1190,1192,1199,1255,1256,1257,1258,1259,1260,1262,1263,1264,1265,1266,1267,1268,1269,1272,1330,1331,1332,1334,1377,1378,1441]); +__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1184,1185,1187,1191,1193,1200,1256,1257,1258,1259,1260,1261,1263,1264,1265,1266,1267,1268,1269,1270,1273,1331,1332,1333,1335,1378,1379,1442]); __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]})}},29,[30,34,792,846,988,25]); __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)},30,[31,32,782,783,785]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},31,[]); @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1159,1160,899,997,1161,1133,1162,1163,1164,1173,1166,1132,1175,1179,1156,848,1180,1130,985,1182,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1160,1161,899,997,1162,1133,1163,1164,1165,1174,1167,1132,1176,1180,1156,848,1181,1130,985,1183,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,899,927,924,840,928,25]); __d(function(g,_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 C.webLine}}),_e.T=R,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return T}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:l=!0,right:o,maxWidth:n=640,footer:s,scroll:c=!0}){const h=(0,S.jsxs)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===k.APP_VARIANT?(0,S.jsx)(D,{}):null]});return(0,S.jsxs)(x.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,S.jsx)(A,{title:t,subtitle:r,back:l,right:o})}),c?(0,S.jsx)(u.default,{contentContainerStyle:{paddingBottom:40},children:h}):(0,S.jsx)(f.default,{style:{flex:1},children:h}),s?(0,S.jsx)(f.default,{style:O.footer,children:(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=z,_e.Card=v,_e.Badge=function({label:e,kind:t="neutral"}){const r={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,S.jsx)(f.default,{style:[O.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:I?'center':'flex-start'}],children:(0,S.jsx)(R,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return E}}),_e.Row=V,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return $}}),_e.Field=function({label:e,...r}){return(0,S.jsxs)(f.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,S.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...r,style:[O.input,r.multiline&&{minHeight:70,textAlignVertical:'top'},r.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:l,sub:o,testID:n,accessibilityLabel:s}){return(0,S.jsxs)(c.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${s??e}${!s&&o?`, ${o}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:r,style:[O.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e.trim()}),o?(0,S.jsx)(R,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:o}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:l,disabled:o,a11y:n}){return(0,S.jsxs)(V,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,S.jsx)(R,{style:{flex:1,flexShrink:1},children:r}),(0,S.jsx)(b.default,{testID:l,disabled:o,accessibilityLabel:n??r,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:r=1,max:l=20,label:o,step:n=1,format:s,testID:u}){const h=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,S.jsxs)(V,{gap:10,children:[(0,S.jsx)(c.default,{testID:u?`${u}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${o??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[O.stepBtn,e<=r?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,S.jsx)(f.default,{testID:u?`${u}-value`:void 0,accessibilityLabel:o?`${o}: ${h}`:h,children:(0,S.jsx)(R,{weight:"semibold",size:p.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:h})}),(0,S.jsx)(c.default,{testID:u?`${u}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${o??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,b(e+n))),style:[O.stepBtn,e>=l?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:r,children:l,maxWidth:n,testID:h,footer:b}){const{height:j}=(0,y.default)(),C=o.default.useContext(x.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},w=Math.max(320,j-C.top-C.bottom-24);return(0,S.jsx)(s.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,S.jsx)(f.default,{style:[O.overlay,{padding:12,paddingTop:12+C.top,paddingBottom:12+C.bottom}],children:(0,S.jsxs)(f.default,{style:[O.sheet,{maxHeight:w},n?{maxWidth:n}:null],testID:h,children:[(0,S.jsxs)(V,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,S.jsx)(P,{style:{flex:1},children:r}),(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:B?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,S.jsx)(R,{size:B?18:24,colour:p.colours.text,children:B?'Close':'\u2715'})})]}),(0,S.jsx)(u.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:l}),b?(0,S.jsx)(f.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:h?`${h}-footer`:void 0,children:b}):null]})})})},_e.SectionTitle=function({children:e}){return(0,S.jsx)(R,{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 O}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),l=_r(d[3]),o=e(_r(d[4])),n=e(_r(d[5])),s=e(_r(d[6]));_r(d[7]);var c=e(_r(d[8])),u=e(_r(d[9])),h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=_r(d[14]),p=_r(d[15]),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),k=_r(d[19]),W=_r(d[20]),S=_r(d[21]);const B=['kirkton','abbotsford'].includes(w.VENUE_RID),I='display'!==k.APP_VARIANT;function R({children:e,style:r,size:l=p.font.body,weight:o="regular",colour:n=p.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:b,accessibilityLabel:f}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,w=h.default.flatten(r)||{},k=1===w.flex||1===w.flexGrow||'number'==typeof w.width||'left'===w.textAlign,W=c??(I&&('semibold'===o||'bold'===o)&&!k);return(0,S.jsx)(t.Text,{testID:u??(y?'cc-url':void 0),...W?{dataSet:{centre:'heading'}}:{},accessibilityRole:b,accessibilityLabel:f,numberOfLines:s,style:[{minWidth:0,fontFamily:p.fonts[o],fontSize:l,color:n,lineHeight:(0,j.lineFor)(l)},W&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},r,x,(0,C.webLine)(r,l),W&&'left'!==w.textAlign?{textAlign:'center'}:null],children:e})}const L=e=>(0,S.jsx)(R,{size:p.font.title,weight:"semibold",center:!0,...e}),P=e=>(0,S.jsx)(R,{size:p.font.large,weight:"semibold",center:!0,...e}),T=e=>(0,S.jsx)(R,{colour:p.colours.muted,size:p.font.small,...e,center:e.center??I});function A({title:e,back:t=!0,right:l,subtitle:o}){return(0,S.jsxs)(f.default,{style:O.brandBar,children:[(0,S.jsxs)(f.default,{style:O.row,children:[(0,S.jsx)(f.default,{style:O.brandSide,children:t?(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>r.router.canGoBack()?r.router.back():r.router.replace(k.ENTRY[k.APP_VARIANT]),style:O.backBtn,hitSlop:10,children:(0,S.jsx)(R,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,S.jsx)(c.default,{onPress:()=>r.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:O.brandCenter,children:(0,S.jsx)(W.RestaurantBrand,{size:W.HEADER_LOGO})}),(0,S.jsx)(f.default,{style:[O.brandSide,{alignItems:'flex-end'}],children:l?(0,S.jsx)(f.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,S.jsx)(L,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,S.jsx)(T,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function D(){const e=(0,r.useLocalSearchParams)().rid??w.VENUE_RID,t=(0,l.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,S.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{n.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,S.jsx)(R,{center:!0,size:14,colour:p.colours.gold,children:t})}):null}function z({label:e,sub:t,onPress:r,kind:l="primary",disabled:o,small:n,style:s,accessibilityLabel:u,accessibilityHint:h,testID:b}){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],x={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,S.jsxs)(c.default,{testID:b,accessibilityRole:"button",accessibilityLabel:u??e,accessibilityHint:h,accessibilityState:{disabled:!!o},disabled:o,onPress:r,style:({pressed:e})=>[O.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:x,opacity:o?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:j.control.min,minWidth:44},s],children:[(0,S.jsx)(R,{weight:"semibold",size:n?p.font.small:p.font.body,colour:y,center:!0,children:e.trim()}),t?(0,S.jsx)(R,{size:n?p.font.small-2:p.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function v({children:e,style:t,onPress:r,highlight:l}){const o=l===p.colours.gold||l===p.colours.accentBorder,n=(0,S.jsx)(f.default,{testID:"cc-card",style:[O.card,{alignItems:'stretch'},l?{borderColor:o?p.colours.accentBorder:l,borderWidth:o?1:2}:null,t],children:e});return r?(0,S.jsx)(c.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function F({kind:e="info",title:t,children:r}){const l={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,S.jsxs)(f.default,{accessibilityRole:"summary",style:[O.banner,{backgroundColor:l[0],borderLeftColor:l[1]}],children:[t?(0,S.jsx)(R,{weight:"semibold",colour:l[2],center:!0,children:t}):null,o.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,S.jsx)(R,{size:p.font.small,colour:l[2],center:!0,children:r}):r]})}T.statusLine=!0,z.centreRow=!0;const H=()=>(0,S.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."}),E=()=>(0,S.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function V({children:e,style:t,gap:r=8,wrap:l}){const n=o.default.Children.map(e,e=>{if(!o.default.isValidElement(e))return e;const t=e,r=h.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:o.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===v?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),s=h.default.flatten(t)||{},c=o.default.Children.toArray(n).filter(o.default.isValidElement),u=e=>e.type;if(I&&'space-between'===s.justifyContent&&1!==s.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,S.jsx)(f.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const b=I&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==s.justifyContent&&'space-between'!==s.justifyContent;return(0,S.jsx)(f.default,{...b?{dataSet:{centre:'buttons'}}:{},style:[O.row,{gap:r},b&&{justifyContent:'center',flexWrap:'wrap'},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:n})}const $=()=>(0,S.jsx)(f.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const O=h.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},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:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:j.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:j.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',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,boxSizing:'border-box',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:{maxWidth:'100%',flexShrink:0,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:j.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}})},794,[795,796,30,800,34,379,395,236,402,295,41,410,102,426,36,840,844,845,5,846,847,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -945,7 +945,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/ass __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},862,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},863,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},864,[]); -__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 h}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return g}}),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 S}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return v}}),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 D}}),_e.openShiftOf=T,_e.loggedBreakMins=$,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 U}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return x}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return F}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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',h=e=>!!e.out&&!!e.signOff,g={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},y=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return b(new Date(a,n-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),S=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),E=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],R=1271,v=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,D=[{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 T(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function $(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-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 B=()=>{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:{},chatRead:{},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:D.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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},U=(0,u.create)()((0,f.persist)((e,a)=>({...B(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:a,job:n,active:!0,level:q[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}: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,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}: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,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=y(t,e),o=y(n,e);i.shifts.filter(e=>e.date===a&&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 a=y(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,a)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??$({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=T(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:$({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),g.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,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>g.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};g.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(B()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=j().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,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=B();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}})),V=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,q={owner:'Owner',manager:'Manager',staff:'Staff'},x={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 K=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,a)=>a.indexOf(e)===t),W=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=K(e);return n.includes(a)||n.includes(a.split(' ')[0])},F=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return $}}),_e.openShiftOf=P,_e.loggedBreakMins=A,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return W}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return H}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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,t,a)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=a&&a<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,k={send:null},y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,I=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},w=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return y(new Date(a,n-1,i+t))},S=e=>w(e,-I(e)),E=(e,t)=>e.filter(e=>e.date===t),O=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),R=(e,t)=>t?e:e.filter(e=>e.published),v=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],_=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,$=[{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 P(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function A(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),M=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,N=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function C(){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,...B.includes(e.id)?{displayClock:!0}:{}}))}const B=['st-jack'];function U(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const V=()=>{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:{},chatRead:{},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:$.map(e=>({...e})),workEmail:'',staff:C(),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:U(),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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},q=(0,u.create)()((0,f.persist)((e,a)=>({...V(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:M('st'),name:t,role:a,job:n,active:!0,level:K[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:M('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:M('ph'),caption:t,tone:N[e.photos.length%N.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:M('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:M('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:M('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:M('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:M('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:I(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:I(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=w(t,e),o=w(n,e);i.shifts.filter(e=>e.date===a&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!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:I(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 a=w(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const a={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[a,...e.leave]})),a},setLeave:(t,n)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)}));const i=a().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:M('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??A({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:M('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=P(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:A({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:M('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),k.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:M('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:M('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};k.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(V()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=C().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,hourly:{...e.hourly,...U()},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=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=V();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=S(y(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:w(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}})),x=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,K={owner:'Owner',manager:'Manager',staff:'Staff'},W={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 F=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,a)=>a.indexOf(e)===t),G=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=F(e);return n.includes(a)||n.includes(a.split(' ')[0])},H=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},866,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},867,[]); __d(function(s,t,i,r,a,c,e){"use strict";a.exports={uri:"/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},868,[]); @@ -1065,7 +1065,7 @@ __d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModul __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},982,[804]); __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 u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).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 u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),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(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};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 u=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):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},983,[982]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return c.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const c=e.IS_CAR?b[n]:'nolink'===n&&'display'===e.APP_VARIANT?p:f[n];return(0,h.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${c}`,style:{borderRadius:16,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface,padding:14,gap:4},children:[(0,h.jsx)(u.T,{size:12,weight:"semibold",colour:l.colours.goldMuted,children:o.toUpperCase()}),(0,h.jsx)(u.T,{size:18,weight:"semibold",children:c})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]);const f={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},p="This Display isn't paired yet. Tap Not paired to pair it.",b={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when the car is back online.',nolink:'Not connected yet. Check the car has internet. If this stays, sign the car in again from Managers on your phone.'}},984,[846,34,102,985,2,840,794,25]); -__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return he}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),It(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=he.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Gt,i.readAccessLog=async function(){const e=he.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Qt}}),i.uploadOrderLogo=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Qt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=Jt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Qt).createSignedUrl(e,3600);if(t?.signedUrl)return Jt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Qt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return zt}}),i.claimInvite=ca,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(na,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ia,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=he.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=he.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(na),await T.kv.remove(ia),Se({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=he.getState().venueId;if(ae.PITCH||!s||'staff'!==he.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await ma('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'}}},i.claimInviteForSync=async function(e){const t=await ca(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return await ma('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return ma('staff_app_link_history',{p_venue:he.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await ma('revoke_staff_app_link',{p_venue:he.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=he.getState().venueId;if(!e||'staff'!==he.getState().kind)return{};try{const t=await ma('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return Number(await ma('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=he.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(sa,n),Sa(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(la,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:fa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(la,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(na,null);await T.kv.set(na,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||Sa()}return'revoked'!==i&&'unknown'!==i||await pa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await pa(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}Se({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await ma('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:fa(e)}}},i.carList=async function(){const e=he.getState().venueId;if(!e)return[];return(await ma('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await ma('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:fa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(sa),await ha();try{await _e().auth.signOut()}catch{}Se({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(na),await T.kv.remove(ia),await ha();try{await _e().auth.signOut()}catch{}Se({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Se({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ga,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return ma}}),i.mendSession=ya,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,wa=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,h.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,h.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Se({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 Ka(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void Se({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void Se({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];Se({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>Se({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>Se({mode:e?he.getState().venueId?'live':he.getState().mode:he.getState().venueId?'offline':he.getState().mode}))),await va()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ua}}),i.goLive=Ea,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ga}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Va.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Va.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),ma('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Ue(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Ue(a.from_time),to:Ue(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Va.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ga.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Va.get(a);e&&!e.ok&&Va.delete(a)}));const n=Va.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=he.getState().venueId;if(!n||'staff'!==he.getState().kind)throw new Error('Connect to your venue first.');const i=await ma('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),h=t(r[10]),S=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),D=t(r[21]),U=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),j=t(r[34]),B=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,U.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const he=(0,D.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Se=e=>he.setState(e),ye=e=>{const t=he.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=he.getState().mode;return'live'===e||'offline'===e||'connecting'===e};he.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),De=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Ue=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=De(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=De(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==he.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(j.useFloor.getState().plans[e]??(0,j.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:he.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&j.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>j.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>B.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>B.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>B.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>B.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(B.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==he.getState().kind&&('device'!==he.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>B.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>B.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(B.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={...B.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;B.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{B.useShellStore.getState().server[e]||B.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const je=new Set;function Be(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,h.isAnchorage)(e)&&(0,h.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,h.isAnchorage)(e)&&(s={...s,signOff:(0,h.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,h.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,h.isAnchorage)(e)&&(0,h.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,h.isAnchorage)(e)&&(0,h.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!je.has(e)){je.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){je.delete(e),Se({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,D.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==he.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,h.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${he.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=De(62),t=e=>ye('rota.manage')||e.staffId===he.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,S.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,S.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=De(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===he.getState().staffRef&&'open'===e.status,writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===he.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const gt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function mt(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function _t(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:j.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:gt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...St??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...St?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...St?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},St=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&j.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&mt(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=j.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,St=null;const yt=()=>new Date(Date.now()-2592e6).toISOString(),wt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},vt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},bt=()=>he.getState().perms.includes('*');function kt(){const e=()=>he.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!wt(t.ch)&&(t.from===e()||bt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('created_at',yt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=yt(),toRow:(e,t)=>{const a=wt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=vt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=vt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function It(e,t,a){const s=he.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':wt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Ot(e){const t=he.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':vt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function Rt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function At(e){const t=De(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===he.getState().staffRef,writable:()=>'staff'===he.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ut=e=>null==e||''===e?null:Number(e),Ct=e=>e.filter(e=>!e.startsWith('data:'));function Et(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',De(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Ct(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Tt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Ct(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Nt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function Mt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',De(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function xt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ut(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function Kt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function qt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Lt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function Pt(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===he.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:he.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function $t(e){const t=De(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,S.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Bt(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===he.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ft(e){const t=De(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=he.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===he.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Wt(e,t=!1){const a=De(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Ht(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Vt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Gt(){const e=he.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Qt='order-list-logos';const Jt=new Map;const zt=(0,D.create)(()=>({live:!1,known:!1}));async function Zt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const Xt=(e,t)=>Ee({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)}),ea='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function ta(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Xt(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function aa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ea).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Xt(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const sa='pair:v1',na='staff:v1',ia='staff:rejoin:v1';async function ra(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function oa(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ia,null);if(!e)return'none';try{await ua();const{data:t,error:a}=await ra(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ia),await T.kv.remove(na),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(na,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ia),'refused')}catch{return'offline'}}const da=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 ua(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}Se({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 ca(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ua();const{data:t,error:a}=await ra(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(na,n),await T.kv.set(ia,e),Re&&Sa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Se({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const la='car:request:v1',fa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function pa(){await T.kv.remove(na),await T.kv.remove(la),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ga(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ua(),!0}catch{return!1}}const ma=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let _a=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],_a&&(clearInterval(_a),_a=null)}async function Sa(){await ha(),await va()}async function ya(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ia,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await oa()&&(Sa(),!0)}catch{return!1}}(0,d.setSessionMender)(ya);let wa=o.VENUE_RID;async function va(){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 e=wa;try{if(Se({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Oa(e);const t=await T.kv.get(sa,null);let a=await T.kv.get(na,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await oa();if('offline'===t)return Se({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{wa===e&&Sa()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(na,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void Se({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await ma('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(sa):(await T.kv.remove(na),await T.kv.remove(ia)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))Se({mode:'offline'});else if(da(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await oa()&&setTimeout(()=>{wa===e&&Sa()},500)}i=he.getState().perms}Se({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await ka(n.venueId,e,n.kind)}catch(e){Se({mode:'local',lastError:String(e?.message??e)})}}const ba=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 ka(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ea(a),Oe.push(Ha(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[_t(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Wa()},onRemote:()=>{Wa()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[wa]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[wa],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&&V.useSetup.getState().patch(wa,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[wa]?.staffGrade!==a.sites[wa]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Be(a),La(a)];ye('wages.view')&&n.push(Pa(a)),'staff'===s&&(n.push(ut(),ct(),lt(),pt(a)),ft(e));const i='staff'===s&&await Yt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(kt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Vt('hr_questions')&&(n.push(ta(a)),ba.add('hr_questions'),aa(e,a)),'guest'!==s&&await Vt('sold_out_items')?(n.push(Wt(a,await Vt('sold_out_items','auto'))),ba.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Vt('sold_out_links')?(n.push(Ht(a)),ba.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Zt()&&(n.push(Rt(a)),'staff'===s&&n.push(At(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Vt('staff','nickname'),Ze=await Vt('staff','display_clock');const[e,t,s,i]=await Promise.all([Vt('scheduled_notifications'),Vt('order_lists'),Vt('venue_clock_area'),Vt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Bt(a),Ft(a)),ba.add('daily_tasks'),ba.add('daily_task_ticks')),e&&(n.push(qt(a)),Gt()),t&&n.push(Lt(a),Pt(a),$t(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ba.add(n)}if('guest'!==s&&await Vt('day_tips')){n.push(Mt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ba.add(e);await Vt('tips_pot_events')&&n.push(xt(a),Kt(a)),'staff'===s&&(n.push(Et(a),Tt(a),Nt(a)),ba.add('cash_ups'),ba.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Vt('scheduled_notifications')&&n.push(qt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Vt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ba.add('ingredient_prices'),await Vt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ba.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Vt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ba.add('specials_boards'));const c={onActivity:()=>Se({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Se({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Se({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await ma('whoami')??[]).some(t=>t.venue_id===e))return void(wa===a&&Sa());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await ma('whoami');if(!t?.some(t=>t.venue_id===e))return void(wa===a&&Sa())}catch(e){if(da(e)){const e=await oa();return void('ok'!==e&&'refused'!==e||wa===a&&Sa())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Ot(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(Se({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):Se({mode:'offline'}),!ye('wages.view')){const e=he.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ba.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const h=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);Se({lastSyncAt:(new Date).toISOString()})},e=>{Se({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(h)}),_a=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...he.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Ia='guest:sent:v1';async function Oa(e){Se({kind:'guest',venueSlug:e,perms:[]});try{const t=(await ma('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){Se({venueId:t.id,venueName:t.name}),await Ea(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),mt(e,t.app?.events)}await Ra(e),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Se({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Ra(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Aa(e)}async function Ra(e){const t=await ma('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Aa(e){let t=await T.kv.get(Ia,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ga())return;for(const a of n)try{const s=(await ma('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await ma('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Order: ${e?.message}`}))}await T.kv.set(Ia,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await ma('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Ia,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await ma('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Se({mode:(0,E.isOnline)()?he.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),_a=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ua={bridges:()=>Ie,restart:Sa},Ca='golive:v1:';async function Ea(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await Ka(e):(await T.kv.get(Ca+e,!1)||await Ka(e),await T.kv.get(Ma+e,!1)||(xa(e),await T.kv.set(Ma+e,!0)),await T.kv.get(Ta+e,!1)||(Na(),await T.kv.set(Ta+e,!0)))}const Ta='golive:v3:';function Na(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 Ma='golive:v2:';function xa(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 Ka(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,h.isDemoCard)(e)),log:m.log.filter(e=>!(0,h.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ca+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),j.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:[],swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ca+e,!0)}const qa=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function La(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(j.useFloor.getState().live[e]??{}).map(([e,t])=>qa(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===he.getState().kind||ye('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:he.getState().staffRef??ve}),fromRow:e=>qa(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>j.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>j.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Pa(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const $a='staff-avatars',ja=new Map;let Ba=!1;const Fa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Wa(){if(!Ba){Ba=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===he.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from($a).download(t);if(n||!s)continue;const i=await Fa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ba=!1}}}function Ha(e){const t=async()=>{const t=he.getState().staffRef,a=t?Ye.get(t)??he.getState().staffUuid:void 0;if(!t||!a||'staff'!==he.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from($a).remove([t]).catch(()=>{})};if(!s)return void(n&&(await ma('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Se({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 _e().storage.from($a).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await ma('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Se({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==he.getState().staffRef){const e=s[t].path;ja.set(t,null),ma('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from($a).remove([e])).catch(()=>{})}});return t(),s}const Va=new Map,Ga=(0,D.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),Ot(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=Se.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(Zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Qt,i.readAccessLog=async function(){const e=Se.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Jt}}),i.uploadOrderLogo=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Jt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=zt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Jt).createSignedUrl(e,3600);if(t?.signedUrl)return zt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Jt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return Zt}}),i.claimInvite=la,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(ia,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ra,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(ia),await T.kv.remove(ra),he({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Se.getState().venueId;if(ae.PITCH||!s||'staff'!==Se.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await _a('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'}}},i.claimInviteForSync=async function(e){const t=await la(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return _a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return await _a('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),_a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return _a('staff_app_link_history',{p_venue:Se.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await _a('revoke_staff_app_link',{p_venue:Se.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=Se.getState().venueId;if(!e||'staff'!==Se.getState().kind)return{};try{const t=await _a('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return Number(await _a('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=Se.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(na,n),ya(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(fa,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:pa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(fa,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(ia,null);await T.kv.set(ia,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||ya()}return'revoked'!==i&&'unknown'!==i||await ga(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await ga(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}he({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await _a('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:pa(e)}}},i.carList=async function(){const e=Se.getState().venueId;if(!e)return[];return(await _a('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await _a('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:pa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(na),await ha();try{await _e().auth.signOut()}catch{}he({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(ia),await T.kv.remove(ra),await ha();try{await _e().auth.signOut()}catch{}he({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}he({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ma,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return _a}}),i.mendSession=wa,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,va=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,S.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,S.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void he({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 qa(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void he({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void he({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];he({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>he({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>he({mode:e?Se.getState().venueId?'live':Se.getState().mode:Se.getState().venueId?'offline':Se.getState().mode}))),await ba()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ca}}),i.goLive=Ta,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Qa}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Ga.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Ga.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),_a('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:De(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:De(a.from_time),to:De(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Ga.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Qa.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ga.get(a);e&&!e.ok&&Ga.delete(a)}));const n=Ga.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Se.getState().venueId;if(!n||'staff'!==Se.getState().kind)throw new Error('Connect to your venue first.');const i=await _a('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),U=t(r[21]),D=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),B=t(r[34]),j=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,D.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const Se=(0,U.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),he=e=>Se.setState(e),ye=e=>{const t=Se.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=Se.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Se.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),Ue=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),De=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=Ue(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=Ue(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Se.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(B.useFloor.getState().plans[e]??(0,B.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:Se.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&B.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>B.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>j.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>j.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>j.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>j.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(j.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Se.getState().kind&&('device'!==Se.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>j.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>j.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(j.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={...j.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;j.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{j.useShellStore.getState().server[e]||j.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const Be=new Set;function je(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,S.isAnchorage)(e)&&(0,S.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,S.isAnchorage)(e)&&(s={...s,signOff:(0,S.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,S.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,S.isAnchorage)(e)&&(0,S.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,S.isAnchorage)(e)&&(0,S.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!Be.has(e)){Be.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Be.delete(e),he({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,U.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==Se.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,S.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${Se.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=Ue(62),t=e=>ye('rota.manage')||e.staffId===Se.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,h.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,h.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=Ue(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===Se.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.leaveRemote.decide=t=>!(!ye('rota.manage')||!(0,z.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(K.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),Oe.push(()=>{J.leaveRemote.decide=null})}function pt(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function gt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Se.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const mt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function _t(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function St(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:B.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...yt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...yt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...yt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},yt=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&B.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&_t(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=B.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,yt=null;const wt=()=>new Date(Date.now()-2592e6).toISOString(),vt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},bt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},kt=()=>Se.getState().perms.includes('*');function It(){const e=()=>Se.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!vt(t.ch)&&(t.from===e()||kt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('created_at',wt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=wt(),toRow:(e,t)=>{const a=vt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=bt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=bt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Ot(e,t,a){const s=Se.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':vt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Rt(e){const t=Se.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':bt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function At(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Ut(e){const t=Ue(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===Se.getState().staffRef,writable:()=>'staff'===Se.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ct=e=>null==e||''===e?null:Number(e),Et=e=>e.filter(e=>!e.startsWith('data:'));function Tt(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',Ue(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Et(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Nt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Et(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Mt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function xt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',Ue(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.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:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ct(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function qt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Lt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Pt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function $t(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Se.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Se.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Bt(e){const t=Ue(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,h.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Ft(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===Se.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Wt(e){const t=Ue(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Se.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===Se.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Ht(e,t=!1){const a=Ue(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Vt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Gt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Qt(){const e=Se.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();Zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Jt='order-list-logos';const zt=new Map;const Zt=(0,U.create)(()=>({live:!1,known:!1}));async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Xt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const ea=(e,t)=>Ee({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)}),ta='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function aa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ea(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function sa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ta).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ea(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const na='pair:v1',ia='staff:v1',ra='staff:rejoin:v1';async function oa(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function da(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ra,null);if(!e)return'none';try{await ca();const{data:t,error:a}=await oa(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ra),await T.kv.remove(ia),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(ia,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ra),'refused')}catch{return'offline'}}const ua=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 ca(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}he({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 la(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ca();const{data:t,error:a}=await oa(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(ia,n),await T.kv.set(ra,e),Re&&ya(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return he({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const fa='car:request:v1',pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function ga(){await T.kv.remove(ia),await T.kv.remove(fa),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ma(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ca(),!0}catch{return!1}}const _a=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let Sa=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],Sa&&(clearInterval(Sa),Sa=null)}async function ya(){await ha(),await ba()}async function wa(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ra,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await da()&&(ya(),!0)}catch{return!1}}(0,d.setSessionMender)(wa);let va=o.VENUE_RID;async function ba(){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 e=va;try{if(he({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Ra(e);const t=await T.kv.get(na,null);let a=await T.kv.get(ia,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await da();if('offline'===t)return he({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{va===e&&ya()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(ia,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void he({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await _a('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(na):(await T.kv.remove(ia),await T.kv.remove(ra)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))he({mode:'offline'});else if(ua(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await da()&&setTimeout(()=>{va===e&&ya()},500)}i=Se.getState().perms}he({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await Ia(n.venueId,e,n.kind)}catch(e){he({mode:'local',lastError:String(e?.message??e)})}}const ka=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 Ia(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ta(a),Oe.push(Va(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[St(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ha()},onRemote:()=>{Ha()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[va]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[va],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&&V.useSetup.getState().patch(va,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[va]?.staffGrade!==a.sites[va]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},je(a),Pa(a)];ye('wages.view')&&n.push($a(a)),'staff'===s&&(n.push(ut(),ct(),lt(),gt(a)),pt(e)),'staff'===s&&await Gt('staff_leave')&&(n.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Se.getState().staffRef&&'pending'===e.status||ye('rota.manage')),writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:Ee(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),ka.add('staff_leave'),ft(e));const i='staff'===s&&await Xt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(It(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Gt('hr_questions')&&(n.push(aa(a)),ka.add('hr_questions'),sa(e,a)),'guest'!==s&&await Gt('sold_out_items')?(n.push(Ht(a,await Gt('sold_out_items','auto'))),ka.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Gt('sold_out_links')?(n.push(Vt(a)),ka.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Yt()&&(n.push(At(a)),'staff'===s&&n.push(Ut(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Gt('staff','nickname'),Ze=await Gt('staff','display_clock');const[e,t,s,i]=await Promise.all([Gt('scheduled_notifications'),Gt('order_lists'),Gt('venue_clock_area'),Gt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Ft(a),Wt(a)),ka.add('daily_tasks'),ka.add('daily_task_ticks')),e&&(n.push(Lt(a)),Qt()),t&&n.push(Pt(a),$t(a),Bt(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ka.add(n)}if('guest'!==s&&await Gt('day_tips')){n.push(xt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ka.add(e);await Gt('tips_pot_events')&&n.push(Kt(a),qt(a)),'staff'===s&&(n.push(Tt(a),Nt(a),Mt(a)),ka.add('cash_ups'),ka.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Gt('scheduled_notifications')&&n.push(Lt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Gt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ka.add('ingredient_prices'),await Gt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ka.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Gt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ka.add('specials_boards'));const c={onActivity:()=>he({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>he({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{he({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await _a('whoami')??[]).some(t=>t.venue_id===e))return void(va===a&&ya());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await _a('whoami');if(!t?.some(t=>t.venue_id===e))return void(va===a&&ya())}catch(e){if(ua(e)){const e=await da();return void('ok'!==e&&'refused'!==e||va===a&&ya())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Rt(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(he({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):he({mode:'offline'}),!ye('wages.view')){const e=Se.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ka.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);he({lastSyncAt:(new Date).toISOString()})},e=>{he({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(S)}),Sa=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...Se.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Oa='guest:sent:v1';async function Ra(e){he({kind:'guest',venueSlug:e,perms:[]});try{const t=(await _a('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){he({venueId:t.id,venueName:t.name}),await Ta(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),_t(e,t.app?.events)}await Aa(e),he({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{he({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Aa(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Ua(e)}async function Aa(e){const t=await _a('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Ua(e){let t=await T.kv.get(Oa,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ma())return;for(const a of n)try{const s=(await _a('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await _a('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Order: ${e?.message}`}))}await T.kv.set(Oa,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await _a('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Oa,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await _a('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),he({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{he({mode:(0,E.isOnline)()?Se.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),Sa=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ca={bridges:()=>Ie,restart:ya},Ea='golive:v1:';async function Ta(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await qa(e):(await T.kv.get(Ea+e,!1)||await qa(e),await T.kv.get(xa+e,!1)||(Ka(e),await T.kv.set(xa+e,!0)),await T.kv.get(Na+e,!1)||(Ma(),await T.kv.set(Na+e,!0)))}const Na='golive:v3:';function Ma(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 xa='golive:v2:';function Ka(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 qa(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,S.isDemoCard)(e)),log:m.log.filter(e=>!(0,S.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ea+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),B.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:e.leave.filter(e=>(0,z.isUuid)(e.id)),swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ea+e,!0)}const La=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Pa(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(B.useFloor.getState().live[e]??{}).map(([e,t])=>La(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Se.getState().kind||ye('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:Se.getState().staffRef??ve}),fromRow:e=>La(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>B.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>B.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function $a(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ba='staff-avatars',ja=new Map;let Fa=!1;const Wa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ha(){if(!Fa){Fa=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Se.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from(Ba).download(t);if(n||!s)continue;const i=await Wa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Fa=!1}}}function Va(e){const t=async()=>{const t=Se.getState().staffRef,a=t?Ye.get(t)??Se.getState().staffUuid:void 0;if(!t||!a||'staff'!==Se.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from(Ba).remove([t]).catch(()=>{})};if(!s)return void(n&&(await _a('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void he({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 _e().storage.from(Ba).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await _a('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){he({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Se.getState().staffRef){const e=s[t].path;ja.set(t,null),_a('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from(Ba).remove([e])).catch(()=>{})}});return t(),s}const Ga=new Map,Qa=(0,U.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=O,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return b}}),_e.useGpCalcView=function(){const e=b();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...O(e)}:e,[e])},Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return v}}),_e.gpSyncItems=E,_e.gpSyncFromRow=P,_e.mergeGpItems=w,_e.gpSyncSpec=function(e,t){const i='ing'===e?'ingredient_prices':'card_costs';return{name:i,table:i,deletes:!1,list:()=>E(b.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:C(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>P(e,t),apply:(t,i)=>b.setState(n=>w(n,e,t,i)),subscribe:t=>b.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i.cardCosts===n.cardCosts)||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),r=(e=a)&&e.__esModule?e:{default:e},d=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,t,i,n,s,a=0,r=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:a,allergens:r}),m=e=>new Date(Date.now()-864e5*e).toISOString(),S={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},k=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...h('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...h('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(S[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:m(7*(i.length-t))}))})),y=(e,t,i,n,s,a,r,d="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:a,status:r,description:d,allergens:[]}),I=[y('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),y('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),y('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),y('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),y('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),y('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function O(e){const t=e=>I.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),a=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),r=e=>{const t=k.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},d=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(d).forEach(e=>e.lines.forEach(e=>a.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>a.has(e.id)||!r(e)),cardCosts:d}}const b=(0,d.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:k,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),a=n.ingredients.map(e=>e.id===t.id?t:e);let r=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,a,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(d(t)-d(s))/d(s)*100;i.length&&(r=[{id:f('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...r].slice(0,20))}const d=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:d?a.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):a,alerts:r})},addPricePaid:(e,t,n)=>{const s=i(),a=s.ingredients.find(t=>t.id===e);if(!(a&&t>0))return;const r=[...a.prices?.length?a.prices:[{p:a.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),d={...a,prices:r};i().saveIngredient({...d,packPrice:(0,o.costingPrice)(d,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=f('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)}))}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>r.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...O({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&b.persist.rehydrate()});const v='1970-01-01T00:00:00.000Z',C=e=>JSON.parse(JSON.stringify(e));function E(e,t){const i=O(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??v,doc:C({...e,updatedAt:e.updatedAt??v})})):Object.entries(i.cardCosts).map(([e,t])=>({id:e,updatedAt:t.updatedAt??v,doc:C({...t,updatedAt:t.updatedAt??v})})),s=new Set(n.map(e=>e.id)),a=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...a]}function P(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('card'!==e||Array.isArray(s.lines))?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function w(e,t,i,n){const s={...e.gone??{}},a=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e.cardCosts??{})),r=[];for(const e of i){const i=`${t}:${e.id}`,n=a.get(e.id),d=n?n.updatedAt??v:void 0,c=s[i];if(e.deletedAt){if(n&&d>e.deletedAt)continue;a.delete(e.id),(!c||ce.updatedAt)continue;if(n&&d>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?a.set(e.id,o):r.push([e.id,o]),delete s[i]}for(const e of n)a.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...a.values(),...r.map(([,e])=>e)],gone:s}}return{cardCosts:Object.fromEntries([...a.entries(),...r]),gone:s}}},986,[806,34,807,5,808,815,818,987,832,839]); __d(function(_g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return i}}),e.priceStats=c,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return o}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return l}}),e.convert=function(t,n,i){const c=u[n],o=u[i];return c&&o&&c.dim===o.dim?t*c.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return d}}),e.perBaseUnit=function(t){const n=u[t.packUnit];if(!(n&&t.packSize>0))return null;const i=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/i*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/i*1e3,per:'litre'}:{pence:t.packPrice/i,per:'item'}},Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return g}}),e.lineCost=m,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return p}}),e.suggestAllergens=function t(n,i,c=[],o=0){const s=new Set;for(const u of n.lines)if(u.ingId.startsWith('dish:')){const n=c.find(t=>t.id===u.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>s.add(t)),t(n,i,c,o+1).forEach(t=>s.add(t)))}else i.find(t=>t.id===u.ingId)?.allergens?.forEach(t=>s.add(t));return[...s]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:h(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return S}}),e.suggestForMultiple=function(t,n,i,c,o){const s=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?b(Math.ceil(s)):Math.ceil(s)},e.amountLabel=k,e.cardCostSummary=function(t,n,i,c){const o=(t?.lines??[]).map(t=>{const i=n.find(n=>n.id===t.ingId);return{line:t,name:i?.name??'Removed ingredient',cost:m(t,n),label:k(t,i)}}),s=o.reduce((t,n)=>t+n.cost,0),u=Math.max(1,t?.portions||1),a=s/u,l=t?.target??i.defaultTarget??70,f=a>0?y(a,l,i.vatPct,i.pricePoints):null,d=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,g=d??(c&&c>0?c:f),p=g&&a>0?P(a,g,i.vatPct):null;return{lines:o,batch:s,perPortion:a,target:l,suggested:f,price:g,priceIsSuggested:!(d||c&&c>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,l):null,missing:o.filter(t=>t.cost<=0).length}};var t=r(_d[0]);const n=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],i=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function c(t,n=5){const c=i(t),o=c.slice(-Math.max(1,n)),s=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:s,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",i=5)=>'average'===n?c(t,i).avg:c(t,i).latest;const s={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},u={kg:{dim:'mass',f:s.kg},g:{dim:'mass',f:s.g},oz:{dim:'mass',f:s.oz},lb:{dim:'mass',f:s.lb},stone:{dim:'mass',f:s.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=['kg','g','stone','lb','oz','L','ml','each'],l=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const f=(t,n)=>[...'mass'===u[t].dim?['g','kg','oz','lb']:'vol'===u[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],d=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;const g=(t,n)=>{const i=(t?.servingName||'serving').trim().toLowerCase();return 1===n?i:/(s|sh|ch|x)$/.test(i)?`${i}es`:`${i}s`};function m(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?p(o,n,i,c+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=d(o);return null==n?0:t.qty*n}const s=u[o.packUnit],a=u[t.unit];if(!a||s.dim!==a.dim)return 0;const l=o.packPrice/(o.packSize*s.f),f=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*a.f*l/(1-f/100)}const p=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+m(o,n,i,c),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,i){const c=h(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}}function b(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}function y(t,n,i,c){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+i/100);return c?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const S=t=>`${t.toFixed(1)}x`;function k(t,n){const i=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${i} ${g(n,t.qty)}`:'each'===t.unit?`${i} ${1===t.qty?'item':'items'}`:`${i} ${l(t.unit,t.qty)}`}},987,[982]); __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 f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});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:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},988,[]); @@ -1088,7 +1088,7 @@ __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1006,[975]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1007,[1003,975,1008]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1009,[]); __d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return v}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class v{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=c(t),this.saveKnown())})}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=s.get(e);if(!this.pending(e)){if(f){const t=c(f);if(this.rev(f)===this.rev(h)){this.known[e]=l,t!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(h),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,h.length>l&&!f)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||e.syncable(s)&&e.writable()&&this.known[n]!==t&&!this.pending(n)&&this.write(s)}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1010,[1005,931,1003,975,1007]); __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 b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);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??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`: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}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},1011,[829,808,839,815,818,827,1012,1013]); @@ -1122,7 +1122,7 @@ __d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},1038,[1039]); __d(function(g,r,i,a,m,e,d){function n(n,t){const o=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o,s){const u=()=>r.importAll(t,s);{const l=o?.[String(t)];if(Array.isArray(l)){const c=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(c?.isReady?.(l))return u();const f=n(t,o);if(null!=f)return f.then(u);throw new Error(`Cannot import module ${s??t}: the async bundle loader is unavailable. Load the initial Expo bundle before importing these chunks: ${l.join(', ')}`)}try{return u()}catch(s){const l=n(t,o);if(null!=l)return l.then(u);throw s}}const l=n(t,o);return null!=l?l.then(u):u()}function o(n,o,s){const u=t(n,o,s),l=Promise.resolve(u);return l._result=u,l}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},1039,[]); __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)},1040,[34]); __d(function(_g,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,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return p}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[w,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(p,Math.ceil(f.w)+4),j=e&&l>0&&l-2*vu(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.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 t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const w=()=>f(e=>e.layers.some(e=>e.own)),p=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1041,[34,236,402,102,815,840,794,1040,25]); -__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.120'},1042,[]); +__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.121'},1042,[]); __d(function(_g,_r,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'},1043,[796,991,34,379,402,102,794,840,1021,1022,865,1025,1026,1027,992,1044,985,1045,994,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1044,[]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1045,[1046,931,985,846]); @@ -1179,7 +1179,7 @@ __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return z}}),_e.useTableNames=B,_e.resetTableLive=N,_e.seatBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'seated'),N(e,t.table)},_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=M,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return F}}),_e.TablePicker=A,_e.WalkInSheet=R,_e.AssignTableSheet=W,_e.undoNotice=E,_e.NewBookingSheet=_,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[n,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,O.jsxs)(O.Fragment,{children:[s?(0,O.jsx)(R,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:E}):null,l?(0,O.jsx)(_,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,i.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,O.jsx)(W,{booking:n.b,combine:n.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),O=_r(_d[27]);const z=Array.from({length:12},(e,t)=>String(t+1));function B(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function N(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function M(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=B(e),a=(0,S.useFloor)(t=>t.live[e])??{},n=(0,S.usePlan)(e),i=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(i,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[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,S.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,x.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 F=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function A({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=n?6:8,y=n?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(i??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,O.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],i=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!i,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,O.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:i?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,O.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,O.jsx)(T.T,{weight:"bold",size:22,colour:i?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,O.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,O.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,O.jsx)(T.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const L=[1,2,3,4,5,6,7,8];function R({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:y,r:w,now:C}=(0,p.useCtx)(15e3),D=M(y,C),[I,$]=(0,r.useState)(2),[P,z]=(0,r.useState)(!1),[B,F]=(0,r.useState)(i??null),R=(0,S.usePlan)(y),W=(0,f.useBookings)(y),E=(0,v.useBlocks)(e=>e.blocks),_=(0,v.closedAreasAt)(E,y,(0,x.ymd)(C),(0,x.hm)(C)),H=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(D).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(R,W.filter(e=>e.date===(0,x.ymd)(C)),e,I,C,(0,k.turnFor)(I,w.settings.turnMins),90,void 0,{closed:_})?.table??null},[R,W,D,I,_.size,C.getTime()]);(0,r.useEffect)(()=>{B&&(0,S.tablesOf)(B).some(e=>'Closed'===D[e]?.label)&&F(null)},[B,_.size]);const[U,q]=(0,r.useState)(!1),[V,Y]=(0,r.useState)(''),G=(e,t=String(e),s=()=>{z(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,O.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,O.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},K=(0,O.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),Q=(0,O.jsxs)(b.default,{style:{gap:8,width:n?256:void 0},children:[(0,O.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,O.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[L.map(e=>G(e)),G(9,'9+',()=>{z(!0),$(e=>e>=9?e:9)})]}),P?K:null]}),[X,J]=(0,r.useState)(!1),Z=async(t=B)=>{if(!X){J(!0);try{const s=await f.repo.bookings.seatWalkIn(y,I,t??void 0,V);N(y,t??void 0),a(s),e()}finally{J(!1)}}},ee=(0,O.jsxs)(b.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,O.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,O.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),B?(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>F(null)}):null]}),(0,O.jsx)(A,{use:D,value:B,onPick:e=>{D[e]&&!D[e].busy?Z(e):F(B===e?null:e)},big:n,dense:n,best:H,bestSet:(0,u.bestTables)(R)}),(0,O.jsxs)(T.Muted,{children:["Tap a free table to seat them there",H&&!B?` (suggested for ${I}: ${(0,l.tableNumbers)(H)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(C)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,O.jsx)(T.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${B?` \xb7 ${(0,l.tableNumbers)(B)}`:''}`,disabled:X,onPress:()=>{Z()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,O.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[Q,ee]}):(0,O.jsxs)(O.Fragment,{children:[Q,ee]}),(0,O.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[U?(0,O.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>q(!0)}),(0,O.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,O.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function W({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,p.useCtx)(15e3),i=M(o,n),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(n)),t,e.partySize,n,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,n.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),B=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&N(o,l),t()},R=C?(0,O.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,O.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,O.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,O.jsx)(b.default,{testID:"combine-short",children:(0,O.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,O.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>L(I)}),(0,O.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,O.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${F(e)}`,testID:"assign-table-sheet",footer:R,children:[v&&!C?(0,O.jsx)(b.default,{testID:"assign-suggested",children:(0,O.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,O.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,O.jsx)(A,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await L([e])}})]})}function E(e){(0,i.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${F(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function _({date:e,onClose:t,wide:i,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:B}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,F]=(0,r.useState)(ee.blocks),[R,W]=(0,r.useState)(!1),[E,_]=(0,r.useState)(''),[H,U]=(0,r.useState)(2),[q,V]=(0,r.useState)(null),[Y,G]=(0,r.useState)(''),[K,Q]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ne=(0,S.usePlan)(u),ie=(0,P.dogSetUp)(ne),re=!0===te.dog&&ie,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(H,c.settings.turnMins),be=A.filter(e=>e.date===M),ge=e=>(0,k.freeTablesAt)(ne,be,H,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(L,u,M,e)}),he=re&&q?ge(q):[];(0,r.useEffect)(()=>{ae(null)},[re,q,H]);const pe=(0,y.bookingSlots)(c,ue,e=>A.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),H,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0)),me=(0,w.ukPhone)(K),[fe,ye]=(0,r.useState)(!1),ke=q?pe.find(e=>e.time===q):void 0,xe=ke&&ke.left=2&&!!q&&(!xe||fe)&&(0,o.validParty)(H)&&me.ok&&(0,w.emailOk)(X)&&(!je||we&&R)&&(!re||he.length>0)&&!Te,ve=te.wheelchair>0||te.stepFree;return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:i?760:void 0,testID:"booking-sheet",children:[(0,O.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:H,audience:"staff"}),te.dog&&!ie?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(F(e),V(null),W(!1))}}),(0,O.jsxs)(T.Row,{gap:6,children:[(0,O.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,O.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,O.jsx)(T.Field,{label:"Name",value:E,onChangeText:_,placeholder:"e.g. Reid",testID:"nb-name"}),(0,O.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:K,onChangeText:Q,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&K?(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,O.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,O.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(T.T,{center:!0,children:"Covers"}),(0,O.jsx)(s.PartySizeInput,{value:H,onChange:e=>{U(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!ge(e.time).length||!(0,D.dogTimeOk)(c,A,M,e.time,de);return(0,O.jsx)(T.Chip,{label:e.time,sub:(0,v.blockAt)(L,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':e.left>0?`${e.left} left`:'Full',disabled:(e.past??!e.available)||t,selected:q===e.time,onPress:()=>{V(e.time),W(!1),ye(!1)}},e.time)})}),xe?(0,O.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(H,xe.left,xe.time)}),(0,O.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&q?(0,O.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,O.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,O.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ne.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),he.length?(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:he.slice(0,10).map((e,t)=>(0,O.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${ve&&(0,P.accessibleSetUp)(ne)&&!(0,P.isAccessible)(ne,e.table)?' \xb7 not step-free':''}`,selected:(le??he[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",H," at ",q,". Try another time."]})]}):null,je?(0,O.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",je.from,"\u2013",je.to,je.reason?` (${je.reason})`:'']}),we?(0,O.jsx)(T.Chip,{label:R?'Manager override on':'Override and book anyway',selected:R,onPress:()=>W(e=>!e)}):(0,O.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,O.jsx)(b.default,{testID:"nb-closed",children:(0,O.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,O.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:H,date:M,time:q,today:(0,x.ymd)(h),bookings:A,audience:"staff",showTables:!1!==c.settings.tableRequests}),ve&&!(0,P.accessibleSetUp)(ne)?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(T.Field,{label:"Notes (optional)",value:Y,onChangeText:G,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,n.depositDue)((0,n.depositOf)(c.settings),H)?(0,O.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(c.settings),H))," (",(0,a.gbp)((0,n.depositOf)(c.settings).perPersonPence)," per person for ",(0,n.depositOf)(c.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,O.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),Te?(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",q,". Try another time: dogs are very welcome then."]}):null,(0,O.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Se,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||he.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:H,date:M,time:q,notes:Y.trim(),security:(0,n.depositDue)((0,n.depositOf)(c.settings),H)?'deposit':'none',depositPaid:0,...(0,n.depositDue)((0,n.depositOf)(c.settings),H)?{depositDue:(0,n.depositDue)((0,n.depositOf)(c.settings),H),depositPolicy:(0,n.depositWords)((0,n.depositOf)(c.settings),H,c.name).join(' '),depositRefundable:(0,n.depositOf)(c.settings).refundable,depositCutoffHours:(0,n.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??he[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,B)).catch(()=>{}),d?.({date:M,time:q,name:E.trim()}),t()}})]})}},1096,[796,1097,1098,829,836,14,1099,34,828,402,102,846,1100,848,1104,1079,827,840,833,794,1014,1011,1105,1106,1111,1081,1075,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1097,[34,402,412,102,1098,840,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const f=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(f)?f:u))},f=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),b=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`},1098,[]); -__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{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]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); +__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); __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 c.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return c.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return D}}),_e.useShiftManager=b,_e.useSignedIn=h,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(w),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),c=h(),m=o||'staff'===s.APP_VARIANT,y=(0,t.useContext)(D),O=b(),S=m?y&&O?'manager':'staff':c?p(i,l(c)):i,M=(0,r.useOwner)(e=>e.staff),A=(0,n.useRestaurant)(u),P=(0,n.useNow)(e),I=c?c.id:m&&f?f:d[S],R=M.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:A,now:P,role:S,me:R,meId:I,today:(0,a.venueYmd)(P),signedIn:!!c}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return S}}),_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()-O(n));const c=(0,a.ymd)(f),d=(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===O(t)&&e.date>=c&&e.date<=d&&!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,c=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,...c})})}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 M}}),_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()-O(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=h(),t=(0,r.useOwner)(e=>e.hourly);return e?t:A};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]),c=_r(_d[10]);const d={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=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,p=(e,t)=>m[e]>m[t]?t:e,w=(0,t.createContext)(!1),y=()=>(0,t.useContext)(w),D=(0,t.createContext)(!1);function b(){const e=(0,t.useContext)(w)||'staff'===s.APP_VARIANT,n=h(),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 h(){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 O=e=>(e.getDay()+6)%7,S=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const M=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const A={}},1100,[806,34,848,865,827,846,985,1101,997,15,1103]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); __d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[1103]); @@ -1222,7 +1222,7 @@ __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1139,[931,974,985,975]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1140,[1129,982,34,379,102,794,865,988,836,840,1100,1124,1018,1141,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1141,[796,804,982,34,379,236,402,102,794,1016,981,983,836,1017,840,1124,25]); -__d(function(g,_r,_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:u,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),f=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,o.useLiveState)();if('ready'!==$)return(0,p.jsx)(o.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,p.jsxs)(n.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface,padding:u?10:12,gap:6},b],children:[(0,p.jsxs)(r.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:u?1:void 0},children:[(0,p.jsxs)(i.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:["LIVE \xb7 ",I]}),(0,p.jsx)(i.T,{size:12,colour:c.colours.muted,children:"Tap to update \u203a"})]}),(0,p.jsx)(i.Row,{gap:u?14:18,style:{flex:u?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,p.jsx)(i.T,{size:u?42:34,weight:"bold",colour:s<=0?c.colours.red:o?c.colours.amber:c.colours.text,style:{lineHeight:u?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,p.jsxs)(i.T,{size:13,colour:o?c.colours.amber:c.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!u&&L.length?(0,p.jsxs)(n.default,{testID:"shellfish-low",style:{backgroundColor:c.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,p.jsxs)(i.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.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,p.jsx)(i.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,u||L.length||!h?null:(0,p.jsx)(r.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,p.jsx)(i.T,{size:13,colour:c.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,p.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:u=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,f]=(0,s.useState)(!1);if(!h.items.length)return null;const x=u>=80,w=Math.max(28,Math.min(52,Math.round(.6*u))),C=Math.max(22,Math.min(34,Math.round(.42*u)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.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:()=>f(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:u,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,r=b[t.key]??0,d=Math.max(0,o-r),y=d<=0,f=y||h.isLow(t.key);return(0,p.jsxs)(n.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:f?'rgba(255,107,94,0.07)':'transparent',...l.look.web(f?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,p.jsx)(i.T,{size:C,children:t.icon}),(0,p.jsx)(i.T,{size:w,weight:"bold",colour:f?'#FF8E82':c.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,p.jsxs)(n.default,{style:{gap:0},children:[(0,p.jsx)(i.T,{size:x?15:13,weight:"semibold",colour:f?'#FFB3AA':c.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),f&&u>=60?(0,p.jsx)(i.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,p.jsxs)(i.T,{size:x?14:12,weight:"semibold",colour:r?c.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,r)]})]})]},t.key)})}),y?(0,p.jsx)(j,{rid:e,by:t,app:o,onClose:()=>f(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=w,_e.SundayRoastChip=function(e){return(0,p.jsx)(w,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_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]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]);const f=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,u.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:r,onOrder:u,group:h}){const b=(0,d.useShellfish)(e,o,l,h),y='roast'===h,[k,j]=(0,s.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,k[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):k,[C,S]=(0,s.useState)(null),$=x(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&j(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=k[e.key]&&k[e.key]!==Math.round(b.counts[e.key]??0));return(0,p.jsxs)(i.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,p.jsx)(i.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,p.jsxs)(n.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface2},children:[(0,p.jsxs)(i.T,{center:!0,size:13,colour:c.colours.muted,children:[s.icon," ",s.plural]}),(0,p.jsx)(i.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?c.colours.amber:c.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,p.jsx)(i.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,p.jsx)(i.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,p.jsx)(n.default,{style:{minHeight:52}})]},s.key)})}),(0,p.jsx)(i.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,a.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,a.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,p.jsx)(i.Banner,{kind:"success",title:C}):null,(0,p.jsxs)(n.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:c.colours.gold,backgroundColor:c.colours.goldTint},children:[(0,p.jsx)(i.T,{weight:"semibold",colour:c.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,p.jsxs)(i.Row,{gap:10,children:[(0,p.jsxs)(i.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,p.jsx)(i.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,w[s.key]||0)}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,p.jsx)(i.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=k[e.key]&&b.recount(e.key,Math.max(0,Math.round(k[e.key])))}),j({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,p.jsx)(i.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),j({})},style:{minHeight:54}})]}),u?(0,p.jsx)(i.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:u}):null,(0,p.jsxs)(n.default,{style:{gap:2},children:[(0,p.jsx)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,p.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(i.T,{size:13,style:{flex:1},children:(0,a.describe)(e,b.itemOf(e.kind))}),(0,p.jsxs)(i.Muted,{children:[f(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,p.jsx)(i.Row,{wrap:!0,gap:6,children:b.synced?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"ok",label:"Shared live"}),(0,p.jsx)(i.Muted,{children:"Every paired device sees the same count."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"neutral",label:"Saved on this device"}),(0,p.jsx)(i.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function w({rid:e,by:t,app:o,size:u="m",group:b}){const y=(0,d.useShellfish)(e,t,o,b),f=k(e),[x,w]=(0,s.useState)(!1),C=(0,h.useNow)(3e4);if(!y.items.length)return null;if('roast'===b&&!(0,a.isSundayIn)(C))return null;const S='m'===u?20:17,$='xs'!==u;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.default,{testID:'roast'===b?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===b?'Sunday roast: ':''}${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(y.counts[t.key]??0)-(f[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>w(!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:y.items.map((t,s)=>{const o=y.counts[t.key]??0,l=f[t.key]??0,r=Math.max(0,o-l),d=r<=0,u=d||y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,r)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:u?'rgba(255,107,94,0.10)':'transparent'},children:[(0,p.jsx)(i.T,{size:S-2,children:t.icon}),(0,p.jsx)(i.T,{size:S,weight:"bold",colour:d?c.colours.red:u?c.colours.amber:c.colours.text,style:{lineHeight:S+4},children:(0,a.fmtStockCount)(e,t,r)}),$&&(l||d||u)?(0,p.jsx)(i.T,{size:10,weight:"semibold",colour:d||u?'#FFB3AA':c.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),x?(0,p.jsx)(j,{rid:e,by:t,app:o,group:b,onClose:()=>w(!1)}):null]})}},1142,[982,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); +__d(function(g,_r,_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=x,_e.ShellfishTile=function({rid:e,by:t,app:s,big:r,onOrder:c,style:b}){const y=(0,u.useShellfish)(e,t,s),p=x(e),[k,C]=(0,o.useState)(!1),S=j(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,l.useLiveState)();if('ready'!==$)return(0,f.jsx)(l.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(i.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface,padding:r?10:12,gap:6},b],children:[(0,f.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:r?1:void 0},children:[(0,f.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:["LIVE \xb7 ",I]}),(0,f.jsx)(a.T,{size:12,colour:h.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(a.Row,{gap:r?14:18,style:{flex:r?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)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(a.T,{size:r?42:34,weight:"bold",colour:s<=0?h.colours.red:o?h.colours.amber:h.colours.text,style:{lineHeight:r?50:42},children:(0,d.fmtStockCount)(e,t,s)}),(0,f.jsxs)(a.T,{size:13,colour:o?h.colours.amber:h.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.goldLight,children:["Reserved: ",(0,d.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,d.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!r&&L.length?(0,f.jsxs)(i.default,{testID:"shellfish-low",style:{backgroundColor:h.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.map(t=>`${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,d.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),c?(0,f.jsx)(a.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:c}):null]}):null,r||L.length||!c?null:(0,f.jsx)(n.default,{accessibilityRole:"button",onPress:c,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(a.T,{size:13,colour:h.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),k?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>C(!1),onOrder:c?()=>{C(!1),c()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:l=76}){const c=(0,u.useShellfish)(e,t,s),b=x(e),[y,p]=(0,o.useState)(!1);if(!c.items.length)return null;const k=l>=80,j=Math.max(28,Math.min(52,Math.round(.6*l))),C=Math.max(22,Math.min(34,Math.round(.42*l)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${c.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,c.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:l,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...r.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:c.items.map((t,s)=>{const o=c.counts[t.key]??0,n=b[t.key]??0,u=Math.max(0,o-n),y=u<=0,p=y||c.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,u)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:k?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...r.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)(a.T,{size:C,children:t.icon}),(0,f.jsx)(a.T,{size:j,weight:"bold",colour:p?'#FF8E82':h.colours.text,style:{lineHeight:Math.round(1.15*j),letterSpacing:-.5,minWidth:Math.round(.85*j),textAlign:'center'},children:(0,d.fmtStockCount)(e,t,u)}),(0,f.jsxs)(i.default,{style:{gap:0},children:[(0,f.jsx)(a.T,{size:k?15:13,weight:"semibold",colour:p?'#FFB3AA':h.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&l>=60?(0,f.jsx)(a.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,d.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(a.T,{size:k?14:12,weight:"semibold",colour:n?h.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,d.fmtStockCount)(e,t,n)]})]})]},t.key)})}),y?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=w,_e.ShellfishChip=C,_e.SundayRoastChip=function(e){return(0,f.jsx)(C,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),r=_r(_d[4]),n=e(_r(_d[5])),i=e(_r(_d[6])),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]),f=_r(_d[15]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function x(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.ymd)((0,b.useNow)(6e4));return(0,y.reservedOn)(t,o,(0,y.reservablesOf)(s))}function j(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function w({rid:e,by:s,app:l,onClose:r,onOrder:n,group:c}){const b=(0,u.useShellfish)(e,s,l,c),y='roast'===c,[p,x]=(0,o.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,p[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):p,[C,S]=(0,o.useState)(null),$=j(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&x(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=p[e.key]&&p[e.key]!==Math.round(b.counts[e.key]??0));return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,f.jsx)(a.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,f.jsxs)(i.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(a.T,{center:!0,size:13,colour:h.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(a.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?h.colours.amber:h.colours.text,style:{lineHeight:56},children:(0,d.fmtStockCount)(e,s,o)}),(0,f.jsx)(a.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(a.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(i.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(a.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,d.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,d.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,f.jsx)(a.Banner,{kind:"success",title:C}):null,(0,f.jsxs)(i.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,f.jsx)(a.T,{weight:"semibold",colour:h.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsxs)(a.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(a.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,d.fmtStockCount)(e,s,w[s.key]||0)}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,f.jsx)(a.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=p[e.key]&&b.recount(e.key,Math.max(0,Math.round(p[e.key])))}),x({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,f.jsx)(a.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,d.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),x({})},style:{minHeight:54}})]}),n?(0,f.jsx)(a.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:n}):null,(0,f.jsxs)(i.default,{style:{gap:2},children:[(0,f.jsx)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,style:{flex:1},children:(0,d.describe)(e,b.itemOf(e.kind))}),(0,f.jsxs)(a.Muted,{children:[k(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:b.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(a.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(a.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function C({rid:e,by:t,app:l,size:c="m",group:y}){const p=(0,u.useShellfish)(e,t,l,y),k=x(e),[j,C]=(0,o.useState)(!1),S=(0,b.useNow)(3e4);if(!p.items.length)return null;if('roast'===y&&!(0,d.isSundayIn)(S))return null;const $='m'===c?20:17,L='xs'!==c;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:'roast'===y?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===y?'Sunday roast: ':''}${p.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,Math.max(0,(p.counts[t.key]??0)-(k[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>C(!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)',...r.look.web({cursor:'pointer'})}),children:p.items.map((t,o)=>{const l=p.counts[t.key]??0,r=k[t.key]??0,n=Math.max(0,l-r),u=n<=0,c=u||p.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,n)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(a.T,{size:$-2,children:t.icon}),(0,f.jsx)(a.T,{size:$,weight:"bold",colour:u?h.colours.red:c?h.colours.amber:h.colours.text,style:{lineHeight:$+4},children:(0,d.fmtStockCount)(e,t,n)}),!L||!(r||u||c)||u&&s.IS_CAR?null:(0,f.jsx)(a.T,{size:10,weight:"semibold",colour:u||c?'#FFB3AA':h.colours.goldLight,children:u?'none left':r?`${(0,d.fmtStockCount)(e,t,r)} res`:'low'})]},t.key)})}),j?(0,f.jsx)(w,{rid:e,by:t,app:l,group:y,onClose:()=>C(!1)}):null]})}},1142,[982,846,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); __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}},1143,[5,797,841,798,236,844]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,x.jsxs)(r.default,{style:{gap:12},children:[(0,x.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,x.jsx)(y,{}):'take'===t?(0,x.jsx)(j,{}):(0,x.jsx)(f,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]);function y(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[y,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===y?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,x.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,x.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,x.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,x.jsx)(p.Seg,{value:y,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,x.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,x.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,x.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,x.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,x.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,x.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,x.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function j(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[y,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=y[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,x.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,x.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,x.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,x.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,x.jsx)(o.T,{size:16,children:e.name}),(0,x.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,x.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:y[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(y[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:y[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,x.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,x.jsx)(o.Muted,{children:"\u2014"}):(0,x.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,x.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,x.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,x.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function f(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,x.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,x.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,x.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,x.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,x.jsx)(v,{id:e.id,me:t}):null]},e.id)})]})}function v({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[y,j]=(0,l.useState)(b.lines.map(e=>({...e}))),f=(e,t)=>j(i=>i.map(i=>i.ing===e?{...i,...t}:i)),v='expected'!==b.status,k=(0,l.useMemo)(()=>y.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),w=k.filter(e=>Math.abs(e.pct)>=.5),$=y.reduce((e,t)=>e+t.received*t.price,0);return(0,x.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[k.map(({l:e,i:i,short:l,pct:d})=>(0,x.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,x.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,x.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,x.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>f(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!v?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>f(e.ing,{price:100*(Number(t.replace(',','.'))||0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,x.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,x.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round($))]}),S.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[S.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,w.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[w.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,v?(0,x.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,x.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,y,i,[S.length?`${S.length} short`:'',w.length?`${w.length} price changes`:''].filter(Boolean).join(', '))})]})}},1144,[796,1016,1129,982,34,402,102,794,865,836,840,1124,1018,25]); __d(function(g,_r,_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,100][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:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,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))]})}},1145,[796,1146,34,402,102,426,794,865,836,827,840,1147,1100,1050,25]); @@ -1235,298 +1235,299 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1152,[34,402,102,1153,840,794,25]); __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])},1153,[34,900,25]); __d(function(g,_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 M}}),_e.allocate=O,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:T,now:C,today:S,role:k,meId:v,me:D}=(0,x.useCtx)(6e4),B=(0,u.useOwner)(e=>e.staff),F=(0,u.useOwner)(e=>e.attendance),N=(0,u.useOwner)(e=>e.shifts),R=(0,u.useOwner)(e=>e.tronc),E=(0,u.useOwner)(e=>e.troncCash),L=(0,u.useOwner)(e=>e.troncHistory),z=(0,u.useOwner)(e=>e.troncLog),_=(0,c.useOrders)(T),V=(0,j.useVenuePay)(T).pay,[q,H]=(0,i.useState)(-1),[U,W]=(0,i.useState)(''),[Y,K]=(0,i.useState)(!1),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(R.text),[Z,ee]=(0,i.useState)(null),te='staff'!==k,se='owner'===k,{s:oe,e:ie,key:ne}=(0,j.venueRange)(V,'tips',q,C),re=`${(0,h.niceDate)(oe)} \u2013 ${(0,h.niceDate)(ie)} ${ie.getFullYear()}`,le=L.find(e=>e.key===ne),ae=e=>u.useOwner.getState().setOwner({tronc:{...R,...e}}),de=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ce=Math.round((ie.getTime()-oe.getTime())/864e5)+1,ue=(0,i.useMemo)(()=>{let e=_.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(oe)&&e.createdAt.slice(0,10)<=(0,h.ymd)(ie)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!de)for(let t=0;tC)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ne,_.length,de]),pe=E[ne]??0,he=le?le.pot:ue+pe,me=(0,i.useMemo)(()=>{const e={};for(let t=0;tS)break;const o=(0,h.ymd)(s);B.forEach(t=>{const s=F.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ne,F.length,N.length,B.length]),fe=B.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&R.includeManagers||'owner'===e.role&&R.includeOwner)),ye=(0,i.useMemo)(()=>{if(le)return le.rows;const e=fe.map(e=>{const t=(me[e.id]?.paid??0)/60,s=R.points[M(e)]??1;return'hours'===R.method?t:'points'===R.method?t*s:'equal'===R.method?t>0?1:0:R.custom[e.id]??0}),{amounts:t}=O(he,e),s=e.reduce((e,t)=>e+t,0);return fe.map((o,i)=>({staffId:o.id,hours:(me[o.id]?.paid??0)/60,points:R.points[M(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[le,fe.map(e=>e.id).join(),me,R,he]),ge=ye.reduce((e,t)=>e+t.amount,0),xe=le?0:(()=>{const e=ye.map(e=>e.pct);return O(he,e).remainder})(),je=Object.entries(R.custom).filter(([e])=>fe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),be='custom'===R.method&&Math.abs(je-100)>.01,we=new Date(ie.getFullYear(),ie.getMonth()+2,0),Te=[...L].sort((e,t)=>t.end.localeCompare(e.end))[0],Ce=0!==L.length&&(0,h.parseYmd)(Te.end)<(0,h.addMins)(C,-89280),Se=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return`${I(t.name)},${M(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return te?(0,P.jsxs)(l.default,{style:{gap:10},children:[(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,P.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>H(q-1)}),(0,P.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,P.jsx)(d.T,{weight:"semibold",children:re}),le?(0,P.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${le.lockedAt}`}):q>=0?(0,P.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,P.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:q>=0,onPress:()=>H(q+1)})]}),(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Card tips on orders"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.card:ue)})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Cash tips"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.cash:pe)})]}),le?null:(0,P.jsxs)(d.Row,{gap:6,children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:U,onChangeText:W,style:[d.styles.input,{flex:1}]}),(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(U)>=0)||''===U.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...E,[ne]:Math.round(100*Number(U))}}),W('')}})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,P.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(he)})]}),(0,P.jsx)(d.Muted,{children:de?'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).'})]}),le?(0,P.jsxs)(d.Muted,{children:["Locked with method: ",$[le.method],"."]}):(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,P.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,P.jsx)(d.Chip,{label:$[e],selected:R.method===e,onPress:()=>se&&ae({method:e})},e))}),se?null:(0,P.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===R.method?Object.entries(R.points).map(([e,t])=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:e}),(0,P.jsx)(d.Row,{gap:6,children:(0,P.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>se&&ae({points:{...R.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===R.method?(0,P.jsxs)(P.Fragment,{children:[fe.map(e=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,P.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(R.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ae({custom:{...R.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ae({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,P.jsxs)(d.T,{size:13,colour:be?m.colours.red:m.colours.ok,children:["Total ",je.toFixed(1),"%",be?' (must be 100%)':' \u2713']})]}):null,(0,P.jsx)(d.Toggle,{label:"Include managers",value:R.includeManagers,onChange:e=>se&&ae({includeManagers:e})}),(0,P.jsx)(d.Toggle,{label:"Include owner",value:R.includeOwner,onChange:e=>se&&ae({includeOwner:e})}),R.includeOwner?(0,P.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,P.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,P.jsxs)(d.T,{center:!0,children:["Points: ",'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013']}),(0,P.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,P.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,P.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(ge)]})]}):(0,P.jsx)(r.default,{horizontal:!0,children:(0,P.jsxs)(l.default,{children:[(0,P.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,P.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,P.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,P.jsx)(d.T,{size:13,style:{width:54},children:'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013'}),(0,P.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,P.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,P.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,P.jsx)(d.T,{size:13,weight:"bold",colour:ge===he?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(ge)})]})]})}),(0,P.jsxs)(d.Muted,{children:[ge===he?`\u2713 Total equals the pot (${(0,p.gbp)(he)}).`:'\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."]}),le?null:(0,P.jsx)(d.Button,{label:"Approve & lock period",disabled:!se||q>=0||be||ge!==he||he<=0,onPress:()=>{const e=`${(0,h.niceDate)(C)} ${C.toTimeString().slice(0,5)}`,t={id:`tp-${ne}`,key:ne,label:re,end:(0,h.ymd)(ie),pot:he,card:ue,cash:pe,method:R.method,rows:ye,lockedAt:e,by:D};u.useOwner.getState().setOwner({troncHistory:[t,...L],troncLog:[{id:`tl-${Date.now()}`,at:C.toISOString(),text:`${D} approved & locked tips for ${re}: ${(0,p.gbp)(he)} split ${$[R.method].toLowerCase()} between ${ye.filter(e=>e.amount>0).length} staff`},...z]})}}),!le&&q>=0?(0,P.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,se||le?null:(0,P.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),le?(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:le.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!le.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${re} approved: ${(0,p.gbp)(le.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:L.map(e=>e.id===le.id?{...e,shared:(0,h.niceDate)(C)}:e)}),ee('Posted to All staff chat.')}}):null]}),Z?(0,P.jsx)(d.Banner,{kind:"info",title:Z}):null,(0,P.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,P.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(he)} = allocated ${(0,p.gbp)(ge)}`],[R.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Ce,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(we)} ${we.getFullYear()}`],[!0,'Tip records kept for 3 years',`${L.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,P.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,P.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,P.jsxs)(l.default,{style:{flex:1},children:[(0,P.jsx)(d.T,{size:14,children:t}),(0,P.jsx)(d.Muted,{children:s})]})]},String(t))),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{X(R.text),Q(!0)}})]}),(0,P.jsx)(y.SectionHead,{title:"Tip history & audit log"}),L.map(e=>(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"semibold",children:e.label}),(0,P.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,P.jsxs)(d.Muted,{children:[$[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,P.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),L.length||z.length?null:(0,P.jsx)(d.Muted,{children:"No approved periods yet."}),(0,P.jsxs)(d.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,P.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,P.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Se.map((e,t)=>(0,P.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,P.jsxs)(d.Muted,{children:[re," \xb7 ",$[le?.method??R.method]]})]}),(0,P.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tipping policy",children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:se,value:J,onChangeText:X,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),se?(0,P.jsx)(d.Button,{label:"Save policy",onPress:()=>{ae({text:J}),Q(!1)}}):null,(0,P.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,P.jsx)(A,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||B()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${D(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${D(i)}`;return(0,P.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(R,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,P.jsx)(R,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=A;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},M=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',I=e=>(e??'').replace(' (example)','');function O(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const D=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function B(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const F={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,k.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),B()?{pot:F.pot,today:F.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function R({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${D(s)}`;return(0,P.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,P.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,P.jsx)(d.Muted,{center:!0,children:o}):(0,P.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:D(s)})]})}function A(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,P.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,P.jsx)(R,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,P.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,P.jsx)(R,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1154,[798,796,806,34,402,295,102,426,794,848,865,836,827,840,1135,1147,1100,1050,1119,985,1024,1048,13,1049,2,25]); -__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,D.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,D.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),w=(0,f.useOwner)(e=>e.swaps),[v,$]=(0,l.useState)(0),[M,O]=(0,l.useState)(null),[R,P]=(0,l.useState)(null),[z,A]=(0,l.useState)('week'),[N,F]=(0,l.useState)(''),[K,U]=(0,l.useState)(''),[G,X]=(0,l.useState)(''),J='staff'!==t,Q=(0,y.addMins)(_(e),7*v*1440);Q.setHours(0,0,0,0);const Z=q(Q),ee=Z.sales,te='none'===Z.mode,se=Array.from({length:7},(e,t)=>{const s=new Date(Q);return s.setDate(Q.getDate()+t),(0,y.ymd)(s)}),ne=(0,f.visibleShifts)(i,J).filter(e=>e.date>=se[0]&&e.date<=se[6]),ae=(()=>{const e=new Date(Q);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),oe=ne.filter(e=>!e.published||e.changed).length,ie=i.filter(e=>e.date>=ae&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),re=se.map(e=>ne.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(h[s.staffId]??0);var s},0)),de=re.reduce((e,t)=>e+t,0),ce=ee.reduce((e,t)=>e+t,0),ue=(e,t)=>t?Math.round(e/t*100):0,he=J?o:o.filter(e=>e.id===n),fe=(0,a.useNarrow)(),me=Math.max(0,se.indexOf((0,y.ymd)(e))),[pe,xe]=(0,l.useState)(null),ge=pe??me,je=(e,t)=>!fe||t===ge,be=fe?150:74;return(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(u.Chip,{label:`Swaps & leave (${w.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(u.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(v-1),O(null)}}),(0,H.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(Q)]}),(0,H.jsxs)(u.Muted,{children:[0===v?'This week':1===v?'Next week':-1===v?'Last week':v>0?`In ${v} weeks`:-v+" weeks ago",J?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(v+1),O(null)}})]}),J?(0,H.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ie?` (${ie})`:''),disabled:!ie,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(ae,se[0]);O(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,H.jsx)(u.Button,{small:!0,kind:"success",label:oe?`Publish ${oe} ${1===oe?'change':'changes'}`:'Week published',disabled:!oe,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(se[0]);O(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),oe?(0,H.jsx)(u.Badge,{kind:"amber",label:`${oe} unpublished`}):ne.length?(0,H.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,M?(0,H.jsx)(u.Banner,{kind:"success",title:M}):null,fe?(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(u.Chip,{label:`${e} ${(0,y.parseYmd)(se[t]).getDate()}`,selected:t===ge,onPress:()=>xe(t)},e))}):null,(0,H.jsx)(d.default,{horizontal:!fe,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(c.default,{style:{gap:4},children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsxs)(u.T,{size:12,weight:"semibold",colour:se[s]===(0,y.ymd)(e)?S.colours.gold:S.colours.text,children:[t," ",(0,y.parseYmd)(se[s]).getDate()]})},t)).filter(je)]}),he.map(e=>(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(ne,e.id,se[s]),a=(m[e.id]??[]).includes(s),o=le(e.id,se[s]);return(0,H.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!J,onPress:()=>P({staffId:e.id,date:se[s],shift:n}),style:{width:be,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?S.colours.gold:S.colours.amber:S.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:o?'Leave':a?'Unavail.':J?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(u.T,{size:9,colour:S.colours.red,children:o?'on leave!':'unavailable'}):n&&J&&(!n.published||n.changed)?(0,H.jsx)(u.T,{size:9,colour:S.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(je)]},e.id)),J?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour"})}),re.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:'example'===Z.mode?'Fcst sales (ex.)':'Fcst sales'})}),ee.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour %"})}),re.map((e,t)=>{const s=ue(e,ee[t]);return(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,weight:"semibold",colour:ee[t]?s>32?S.colours.red:s>26?S.colours.amber:S.colours.ok:S.colours.muted,children:ee[t]?`${s}%`:'\u2013'})},t)}).filter(je)]})]}):null]})}),!J&&n?(0,H.jsx)(c.default,{testID:"rota-team-on",children:(0,H.jsx)(u.Card,{children:se.map((e,t)=>(0,H.jsx)(x.TeamOnDay,{date:e,meId:n,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(je)})}):null,J&&te?(0,H.jsx)(u.Card,{children:(0,H.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(c.default,{testID:"labour-week-cost",children:(0,H.jsx)(u.T,{weight:"semibold",children:(0,k.gbp)(de)})})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===Z.weeks?'1 week':`${Z.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),Z.booked?(0,H.jsx)(c.default,{testID:"labour-booked",children:(0,H.jsxs)(u.T,{children:["Booked so far: ",Z.booked," Covers this week"]})}):null]})}):null,J&&!te?(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(u.Row,{gap:6,children:['example'===Z.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(u.Badge,{kind:ue(de,ce)>30?'red':'ok',label:`${ue(de,ce)}% this week`})]})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(ce)," forecast sales. Target 25\u201330%. ",'example'===Z.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=ue(re[5],ee[5]);return e&&e<24?(0,H.jsxs)(u.T,{size:14,colour:S.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,J?(0,H.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>J||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,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(e=>L(s,e)).map(t=>(0,H.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,H.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,I.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),J?null:(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(u.Muted,{testID:"swap-dept-note",children:(0,j.isAnchorageVenue)(b.VENUE_RID)?j.ANCHORAGE_SWAP_NOTE:Y(o.find(e=>e.id===n))?j.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ne.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,I.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>L(o.find(e=>e.id===n),e)).map(t=>(0,H.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)}),ne.some(e=>e.staffId===n)?null:(0,H.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(C.SectionHead,{title:"Holiday & leave"}),p.filter(e=>J||e.staffId===n).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,H.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)((0,y.parseYmd)(e.from))," \u2013 ",(0,y.niceDate)((0,y.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Request leave",J?' (as yourself)':'']}),(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:N,onChangeText:F,style:[u.styles.input,{flex:1}]}),(0,H.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:K,onChangeText:U,style:[u.styles.input,{flex:1}]})]}),(0,H.jsx)(u.Field,{label:"Reason",value:G,onChangeText:X}),(0,H.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(N)||!/^\d{4}-\d{2}-\d{2}$/.test(K)||K{f.useOwner.getState().addLeave({staffId:n,from:N,to:K,reason:G.trim()||'Holiday'}),F(''),U(''),X('')}})]})]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",J?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),he.filter(e=>'owner'!==e.role||!J).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{gap:8,children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(u.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,H.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,D.useCtx)(5e3),x=((0,v.useClockArea)(e=>e.areas[m]),(0,v.areaOf)(m));const j=(0,$.privateClockVenue)(m),[b,w]=(0,l.useState)(!1),k=(0,f.useOwner)(e=>e.consent[a]),C=(0,f.useOwner)(e=>e.attendance),I=(0,f.useOwner)(e=>e.shifts),[B,z]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,N]=(0,l.useState)(null),[F,E]=(0,l.useState)(void 0),[W,_]=(0,l.useState)(null),[q,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=C.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)(I,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,M.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),N(null),E(void 0);const l=await(0,O.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(_(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&_(null),!0):(N(l.message),E(l.fix),(0,R.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 k?(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(T.StaffAvatar,{id:a,size:48}),(0,H.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,H.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(c.default,{testID:"clock-area-line",children:(0,H.jsx)(u.T,{size:14,colour:S.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,H.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(c.default,{testID:"on-break",children:(0,H.jsxs)(u.T,{size:15,weight:"semibold",colour:S.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.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,H.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,H.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'):(N(null),z(!0))}})]}):(0,H.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(c.default,{testID:"clock-message",children:(0,H.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===F?(0,H.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===F?(0,H.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===F?(0,H.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,M.areaSet)(x)?(0,H.jsx)(c.default,{testID:"clock-area-warning",children:(0,H.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,H.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(u.T,{size:14,colour:S.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.T,{weight:"semibold",colour:S.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(u.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.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,H.jsx)(u.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(c.default,{style:{gap:12},children:[(0,H.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,H.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,H.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:()=>{w(!1),ae('in')}}),(0,H.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:m,today:t,now:e}):null,G?(0,H.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,H.jsx)(u.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,M.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.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,H.jsx)(c.default,{style:{gap:10},children:(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.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,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.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,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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]),S=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),v=_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]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const Y=e=>(0,j.deptKey)(e?.dept),L=(e,t)=>(0,j.canSwapWith)(e,t,b.VENUE_RID),N=2650,F=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,z.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,w.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*N+t.restOfDay.takeaway*F:0})}},[s,a,o,i,r,(0,y.ymd)(e)])}function V({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,H.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,H.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,H.jsx)(u.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{children:"Start"}),(0,H.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:"End"}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:i,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.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,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:D.fmtH,label:"Break time"}),(0,H.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,H.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,H.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,H.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,H.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({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,D.useSignedIn)(),{me:i,meId:r}=(0,D.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),w=s=>{if(!d)return;const a=(0,O.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,R.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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,b]=(0,l.useState)(h?Math.round(60*h.start):720),[w,k]=(0,l.useState)(h?Math.round(60*h.end):1200),[C,I]=(0,l.useState)(''),[T,v]=(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&&w<=j,P=(e,t)=>(0,H.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return T?(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.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,H.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,D.fmtH)(h.start)}\u2013${(0,D.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,y.hm)(new Date(c.in))}\u2013${c.out?(0,y.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,O?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(u.Field,{label:"Note for your manager (optional)",value:C,onChangeText:I,placeholder:"e.g. phone died",maxLength:200}),(0,H.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,w):void 0,note:C.trim(),at:t.toISOString()}),v(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.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,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(c.default,{children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(u.T,{size:28,weight:"bold",colour:S.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(u.T,{size:18,weight:"semibold",colour:w?S.colours.amber:S.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.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,H.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(C.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsxs)(u.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.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,H.jsx)(C.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,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(u.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.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,H.jsxs)(u.T,{size:13,colour:S.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,H.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,D.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,j]=(0,l.useState)(s),[b,w]=(0,l.useState)(null),[I,v]=(0,l.useState)(!1),$=!!(0,D.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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),B=P.filter(f.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),Y=B.reduce((t,s)=>t+(0,D.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(B.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,D.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,D.fmtH)(a.start)}-${(0,D.fmtH)(a.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.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,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(u.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(u.T,{size:13,colour:S.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(u.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(a.WideTable,{children:(0,H.jsxs)(c.default,{style:{gap:2},children:[(0,H.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:S.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(u.T,{size:12,weight:"semibold",colour:S.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,D.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(T.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:l?`${(0,D.fmtH)(l.start)}\u2013${(0,D.fmtH)(l.end)}`:'\u2013'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?S.colours.ok:'open'===(0,f.attStatus)(t)?S.colours.blue:S.colours.amber,children:(0,m.statusLabel)(t)}),(0,H.jsx)(u.T,{size:11,style:{width:140},colour:c.length?S.colours.amber:S.colours.ok,children:c.join(', ')||'OK'}),(0,H.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(u.T,{size:12,colour:S.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?S.colours.muted:S.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,H.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>v(!0)}),(0,H.jsx)(C.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(u.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(m.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(u.Sheet,{visible:I,onClose:()=>v(!1),title:"Payroll export",children:[(0,H.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(u.T,{size:10,colour:t?S.colours.text:S.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,796,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); +__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:s}=(0,D.useCtx)(6e4),a=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,h.useOwner)(e=>e.shifts),u=(0,D.useHourly)(),f=(0,h.useOwner)(e=>e.availability),m=(0,h.useOwner)(e=>e.leave),w=(0,h.useOwner)(e=>e.swaps),[T,$]=(0,i.useState)(0),[O,M]=(0,i.useState)(null),[R,P]=(0,i.useState)(null),[z,A]=(0,i.useState)('week'),[F,Y]=(0,i.useState)(!1),K=(0,D.useSignedIn)()?.name??'',U='staff'!==t,G=(0,y.addMins)(_(e),7*T*1440);G.setHours(0,0,0,0);const X=q(G),J=X.sales,Q='none'===X.mode,Z=Array.from({length:7},(e,t)=>{const s=new Date(G);return s.setDate(G.getDate()+t),(0,y.ymd)(s)}),ee=(0,h.visibleShifts)(o,U).filter(e=>e.date>=Z[0]&&e.date<=Z[6]),te=(()=>{const e=new Date(G);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),se=ee.filter(e=>!e.published||e.changed).length,ne=o.filter(e=>e.date>=te&&e.date!!(0,h.leaveOn)(m,e,t),oe=Z.map(e=>ee.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(u[s.staffId]??0);var s},0)),ie=oe.reduce((e,t)=>e+t,0),le=J.reduce((e,t)=>e+t,0),re=(e,t)=>t?Math.round(e/t*100):0,de=U?a:a.filter(e=>e.id===s),ce=(0,n.useNarrow)(),ue=Math.max(0,Z.indexOf((0,y.ymd)(e))),[he,fe]=(0,i.useState)(null),me=he??ue,pe=(e,t)=>!ce||t===me,xe=ce?150:74;return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(c.Chip,{label:`Swaps & time off (${w.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(c.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[!U&&s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-time-off"}):null,(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(T-1),M(null)}}),(0,H.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(c.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(G)]}),(0,H.jsxs)(c.Muted,{children:[0===T?'This week':1===T?'Next week':-1===T?'Last week':T>0?`In ${T} weeks`:-T+" weeks ago",U?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(T+1),M(null)}})]}),U?(0,H.jsxs)(c.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ne?` (${ne})`:''),disabled:!ne,testID:"rota-copy",onPress:()=>{const e=h.useOwner.getState().copyWeek(te,Z[0]);M(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,H.jsx)(c.Button,{small:!0,kind:"success",label:se?`Publish ${se} ${1===se?'change':'changes'}`:'Week published',disabled:!se,testID:"rota-publish",onPress:()=>{const e=h.useOwner.getState().publishWeek(Z[0]);M(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),se?(0,H.jsx)(c.Badge,{kind:"amber",label:`${se} unpublished`}):ee.length?(0,H.jsx)(c.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,O?(0,H.jsx)(c.Banner,{kind:"success",title:O}):null,ce?(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(c.Chip,{label:`${e} ${(0,y.parseYmd)(Z[t]).getDate()}`,selected:t===me,onPress:()=>fe(t)},e))}):null,(0,H.jsx)(r.default,{horizontal:!ce,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(d.default,{style:{gap:4},children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsxs)(c.T,{size:12,weight:"semibold",colour:Z[s]===(0,y.ymd)(e)?I.colours.gold:I.colours.text,children:[t," ",(0,y.parseYmd)(Z[s]).getDate()]})},t)).filter(pe)]}),de.map(e=>(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsxs)(c.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(c.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,h.shiftOf)(ee,e.id,Z[s]),a=(f[e.id]??[]).includes(s),o=ae(e.id,Z[s]);return(0,H.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!U,onPress:()=>P({staffId:e.id,date:Z[s],shift:n}),style:{width:xe,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?I.colours.gold:I.colours.amber:I.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(c.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:o?'Off':a?'Unavail.':U?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(c.T,{size:9,colour:I.colours.red,children:o?'on leave!':'unavailable'}):n&&U&&(!n.published||n.changed)?(0,H.jsx)(c.T,{size:9,colour:I.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(pe)]},e.id)),U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour"})}),oe.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:'example'===X.mode?'Fcst sales (ex.)':'Fcst sales'})}),J.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour %"})}),oe.map((e,t)=>{const s=re(e,J[t]);return(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,weight:"semibold",colour:J[t]?s>32?I.colours.red:s>26?I.colours.amber:I.colours.ok:I.colours.muted,children:J[t]?`${s}%`:'\u2013'})},t)}).filter(pe)]})]}):null]})}),!U&&s?(0,H.jsx)(d.default,{testID:"rota-team-on",children:(0,H.jsx)(c.Card,{children:Z.map((e,t)=>(0,H.jsx)(p.TeamOnDay,{date:e,meId:s,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(pe)})}):null,U&&Q?(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(d.default,{testID:"labour-week-cost",children:(0,H.jsx)(c.T,{weight:"semibold",children:(0,k.gbp)(ie)})})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(c.Muted,{children:`Forecasts start once CoverCharge has ${1===X.weeks?'1 week':`${X.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),X.booked?(0,H.jsx)(d.default,{testID:"labour-booked",children:(0,H.jsxs)(c.T,{children:["Booked so far: ",X.booked," Covers this week"]})}):null]})}):null,U&&!Q?(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(c.Row,{gap:6,children:['example'===X.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(c.Badge,{kind:re(ie,le)>30?'red':'ok',label:`${re(ie,le)}% this week`})]})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(le)," forecast sales. Target 25\u201330%. ",'example'===X.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=re(oe[5],J[5]);return e&&e<24?(0,H.jsxs)(c.T,{size:14,colour:I.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,U?(0,H.jsx)(c.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>U||e.fromId===s||e.toId===s).map(e=>{const t=o.find(t=>t.id===e.shiftId),s=a.find(t=>t.id===e.fromId),n=a.find(t=>t.id===e.toId);return(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(c.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:a.filter(e=>L(s,e)).map(t=>(0,H.jsx)(c.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{h.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,H.jsx)(c.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{h.useOwner.getState().setSwap(e.id,'approved');const s=e=>(a.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,C.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),U?null:(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(c.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(c.Muted,{testID:"swap-dept-note",children:(0,x.isAnchorageVenue)(j.VENUE_RID)?x.ANCHORAGE_SWAP_NOTE:N(a.find(e=>e.id===s))?x.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ee.filter(e=>e.staffId===s).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(d.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(c.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Ask for cover",onPress:()=>{h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,kind:'cover',note:'Can anyone cover?'}),(0,C.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(a.find(e=>e.id===s)?.name??'').replace(' (example)','')})`)}}),a.filter(e=>L(a.find(e=>e.id===s),e)).map(t=>(0,H.jsx)(c.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),ee.some(e=>e.staffId===s)?null:(0,H.jsx)(c.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(S.SectionHead,{title:"Holiday & time off"}),U?(0,H.jsx)(c.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>Y(!0)}):s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-requests-time-off"}):null,m.filter(e=>U||e.staffId===s).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,H.jsx)(c.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,H.jsxs)(c.Muted,{children:[(0,b.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,style:{justifyContent:'center'},children:[(0,H.jsx)(c.Button,{small:!0,label:"Approve",onPress:()=>h.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),U&&s?(0,H.jsx)(b.TimeOffSheet,{visible:F,onClose:()=>Y(!1),meId:s,me:K,manager:!0}):null]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Muted,{children:["Days each person can\u2019t work. ",U?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),de.filter(e=>'owner'!==e.role||!U).map(e=>(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{gap:8,children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(c.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(c.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(f[e.id]??[]).includes(s);return(0,H.jsx)(c.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>h.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:n,meId:r,me:u,r:f,rid:p}=(0,D.useCtx)(5e3),x=((0,T.useClockArea)(e=>e.areas[p]),(0,T.areaOf)(p));const j=(0,$.privateClockVenue)(p),[b,w]=(0,i.useState)(!1),k=(0,h.useOwner)(e=>e.consent[r]),S=(0,h.useOwner)(e=>e.attendance),C=(0,h.useOwner)(e=>e.shifts),[B,z]=(0,i.useState)(!1),[A,N]=(0,i.useState)(null),[L,F]=(0,i.useState)(null),[Y,E]=(0,i.useState)(void 0),[W,_]=(0,i.useState)(null),[q,V]=(0,i.useState)(!1),[G,X]=(0,i.useState)(null),J=S.filter(t=>t.staffId===r&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,h.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,h.visibleShifts)(C,'staff'!==n).find(e=>e.staffId===r&&e.date===t),ee='staff'!==n,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,O.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{N(s),F(null),E(void 0);const i=await(0,M.clockAction)(s,{rid:p,staffId:r,date:t,at:new Date(e.getTime()).toISOString(),...n});return N(null),i.ok?('out'===s&&i.att&&(_(i.att),(0,o.hrSettingsOf)(f.settings?.hr).on&&!a.useHr.getState().hasAnswered(p,i.att.id)&&X(i.att)),'in'===s&&_(null),!0):(F(i.message),E(i.fix),(0,R.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:i.message.split('. ')[0]+'.',body:i.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(v.StaffAvatar,{id:r,size:48}),(0,H.jsx)(c.T,{weight:"semibold",style:{flex:1},children:u})]}),(0,H.jsx)(c.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(c.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(d.default,{testID:"clock-area-line",children:(0,H.jsx)(c.T,{size:14,colour:I.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${f.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${f.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,H.jsxs)(c.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(c.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(d.default,{testID:"on-break",children:(0,H.jsxs)(c.T,{size:15,weight:"semibold",colour:I.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,h.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.jsx)(c.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,H.jsx)(c.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,H.jsx)(c.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),z(!0))}})]}):(0,H.jsx)(c.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(c.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,h.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(d.default,{testID:"clock-message",children:(0,H.jsx)(c.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===Y?(0,H.jsx)(c.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,O.areaSet)(x)?(0,H.jsx)(d.default,{testID:"clock-area-warning",children:(0,H.jsx)(c.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,H.jsx)(l.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(c.T,{size:14,colour:I.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(m.BreakRoomCard,{staffId:r,name:u,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.T,{weight:"semibold",colour:I.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(c.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.jsx)(c.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,H.jsx)(c.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(d.default,{style:{gap:12},children:[(0,H.jsxs)(c.T,{children:["We check once that you are at ",f.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,H.jsx)(c.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,H.jsx)(c.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{w(!1),ae('in')}}),(0,H.jsx)(c.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:p,today:t,now:e}):null,G?(0,H.jsx)(s.ShiftCheckout,{rid:p,shiftKey:G.id,day:G.date,meId:r,onClose:()=>X(null)}):null,(0,H.jsx)(c.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(d.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(c.Chip,{testID:`forgot-break-${e}`,label:(0,O.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.jsx)(c.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,H.jsx)(d.default,{style:{gap:10},children:(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",f.name,", within about ",x.radius," m."]}),(0,H.jsx)(c.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(c.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.jsx)(c.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 ",f.name," (within about ",x.radius," m)."]}),(0,H.jsx)(c.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.jsx)(c.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,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.jsx)(c.Button,{label:"I understand \u2014 continue",onPress:()=>h.useOwner.getState().giveConsent(r,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),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]),I=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const N=e=>(0,x.deptKey)(e?.dept),L=(e,t)=>(0,x.canSwapWith)(e,t,j.VENUE_RID),F=2650,Y=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,u.useBookings)(t),o=(0,u.useOrders)(t),l=(0,u.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,i.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),i=(0,z.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:i,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:i,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:i,booked:n,sales:t.map(e=>{const t=(0,w.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*F+t.restOfDay.takeaway*Y:0})}},[s,a,o,l,r,(0,y.ymd)(e)])}function V({init:e,onClose:t}){const s=(0,h.useOwner)(e=>e.staff),[n,a]=(0,i.useState)(e.shift?.start??12),[o,l]=(0,i.useState)(e.shift?.end??20),[r,u]=(0,i.useState)(e.shift?.breakAt),f=void 0===r||r>n&&rt.id===e.staffId),p=(0,h.leaveOn)((0,h.useOwner)(e=>e.leave),e.staffId,e.date);return(0,H.jsxs)(c.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[p?(0,H.jsx)(c.Banner,{kind:"warn",title:`${(m?.name??'').replace(' (example)','')} has time off: ${(0,b.rangeLabel)(p.from,p.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,H.jsx)(c.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,H.jsx)(c.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),l(s)}},e))}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{children:"Start"}),(0,H.jsx)(c.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:"End"}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:l,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(c.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(c.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.jsx)(c.Chip,{label:"Set a break time",onPress:()=>u(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,H.jsxs)(c.Row,{gap:6,children:[(0,H.jsx)(c.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:u,format:D.fmtH,label:"Break time"}),(0,H.jsx)(c.Chip,{label:"No set time",onPress:()=>u(void 0)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=h.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:f?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&f?{breakAt:r}:{}}),t()}}),(0,H.jsx)(c.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,H.jsx)(c.Button,{kind:"danger",label:"Remove shift",onPress:()=>{h.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({rid:e,today:t,now:s}){const n=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,h.useOwner)(e=>e.attendance),o=(0,D.useSignedIn)(),{me:l,meId:r}=(0,D.useCtx)(3e4),[d,u]=(0,i.useState)(null),[f,m]=(0,i.useState)(''),[p,x]=(0,i.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,h.isOnBreak)(j),w=s=>{if(!d)return;const a=(0,M.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??l},f);if(!a.ok)return void x(a.message);const i=n.find(e=>e.id===d)?.name??'them';(0,R.notify)({id:'mgr-clock',title:`Recorded for ${i}`,body:`Reason kept with the record: ${f.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Record it for someone"}),(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(c.Chip,{label:e.name,selected:d===e.id,onPress:()=>u(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Field,{label:"Reason (kept with the record)",value:f,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(c.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,h.useOwner)(e=>e.attendance),o=(0,h.useOwner)(e=>e.shifts),l=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),[r,d]=(0,i.useState)(s),u=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],m=(0,h.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,i.useState)(u&&!u.out?'out':'in'),[j,b]=(0,i.useState)(m?Math.round(60*m.start):720),[w,k]=(0,i.useState)(m?Math.round(60*m.end):1200),[S,C]=(0,i.useState)(''),[v,T]=(0,i.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,O='out'!==p,M='in'!==p,R=O&&M&&w<=j,P=(e,t)=>(0,H.jsx)(c.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return v?(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.jsx)(c.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,H.jsx)(c.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(c.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(c.Muted,{children:[m?`Your rota that day: ${(0,D.fmtH)(m.start)}\u2013${(0,D.fmtH)(m.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,y.hm)(new Date(u.in))}\u2013${u.out?(0,y.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(c.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(c.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),O?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,M?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(c.Field,{label:"Note for your manager (optional)",value:S,onChangeText:C,placeholder:"e.g. phone died",maxLength:200}),(0,H.jsx)(c.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{h.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:u?.id,kind:p,suggestedIn:O?(0,f.isoAt)(r,j):void 0,suggestedOut:M?(0,f.isoAt)(r,w):void 0,note:S.trim(),at:t.toISOString()}),T(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.useCtx)(3e4),n=(0,h.useOwner)(e=>e.attendance),a=(0,h.useOwner)(e=>e.shifts),o=(0,h.useOwner)(e=>e.timeRequests),[l,r]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),p=(0,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(h.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(d.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(d.default,{children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(c.T,{size:28,weight:"bold",colour:I.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(c.T,{size:18,weight:"semibold",colour:w?I.colours.amber:I.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(S.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsxs)(c.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(c.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,H.jsx)(S.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,h.shiftOf)((0,h.visibleShifts)(a,!1),t.staffId,t.date),n=(0,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(c.Card,{onPress:()=>m(u===t.id?null:t.id),children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(c.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.jsx)(c.Badge,{kind:(0,f.statusKind)(t),label:'awaiting'===(0,h.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,f.statusLabel)(t)})]}),o?(0,H.jsxs)(c.T,{size:13,colour:I.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(c.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,u===t.id?(0,H.jsx)(f.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(c.Muted,{children:"No clocked shifts yet."}),l?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const a=(0,h.useOwner)(e=>e.staff),o=(0,h.useOwner)(e=>e.shifts),r=(0,D.useHourly)(),u=(0,h.useOwner)(e=>e.attendance),m=(0,h.useOwner)(e=>e.timeRequests),p=(0,h.useOwner)(e=>e.attLog),[x,j]=(0,i.useState)(s),[b,w]=(0,i.useState)(null),[C,T]=(0,i.useState)(!1),$=!!(0,D.useSignedIn)(),O=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),M=u.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!M.some(t=>t.staffId===e.staffId)),P=u.filter(e=>O.includes(e.date)&&e.out),B=P.filter(h.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),N=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(B.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=a.find(e=>e.id===t.staffId),n=(0,h.shiftOf)(o,t.staffId,t.date),i=(0,D.paidMins)(t,e),l=r[t.staffId]??0;return`${s?.name},${t.date},${n?`${(0,D.fmtH)(n.start)}-${(0,D.fmtH)(n.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.hm)(new Date(t.out))},${i.brk},${(i.paid/60).toFixed(2)},${(l/100).toFixed(2)},${(i.paid/60*l/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:O.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(c.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(c.T,{size:13,colour:I.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(c.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(N))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(n.WideTable,{children:(0,H.jsxs)(d.default,{style:{gap:2},children:[(0,H.jsx)(n.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:I.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(c.T,{size:12,weight:"semibold",colour:I.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),M.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,h.shiftOf)(o,t.staffId,x),d=(0,D.paidMins)(t,e),u=(0,f.flagsFor)(t,r,e,s,m).map(e=>e.label);return(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(c.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(v.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(c.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:r?`${(0,D.fmtH)(r.start)}\u2013${(0,D.fmtH)(r.end)}`:'\u2013'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(c.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(c.T,{size:11,style:{width:120},colour:'confirmed'===(0,h.attStatus)(t)?I.colours.ok:'open'===(0,h.attStatus)(t)?I.colours.blue:I.colours.amber,children:(0,f.statusLabel)(t)}),(0,H.jsx)(c.T,{size:11,style:{width:140},colour:u.length?I.colours.amber:I.colours.ok,children:u.join(', ')||'OK'}),(0,H.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(c.T,{size:12,colour:I.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(c.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(c.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?I.colours.muted:I.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),M.length||R.length?null:(0,H.jsx)(c.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(c.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,H.jsx)(S.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(c.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(c.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(f.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(c.Sheet,{visible:C,onClose:()=>T(!1),title:"Payroll export",children:[(0,H.jsxs)(c.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(d.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(c.T,{size:10,colour:t?I.colours.text:I.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(c.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(c.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1159,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); __d(function(g,_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)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1156,[796,34,402,102,794,840,865,800,850,998,999,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),H=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),N=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(N.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),N.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(N.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:H.length?`Confirm all unflagged (${H.length})`:'Nothing unflagged to confirm',disabled:!H.length,onPress:()=>Y(H.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[H,N]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[H,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:H===e,onPress:()=>N(H===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:H?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),N=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),H=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(H.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),H.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(H.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:N.length?`Confirm all unflagged (${N.length})`:'Nothing unflagged to confirm',disabled:!N.length,onPress:()=>Y(N.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[N,H]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[N,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:N===e,onPress:()=>H(N===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:N?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:p}){const b=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.staff),f=(0,s.useMemo)(()=>(0,c.teamOnDay)(b,j,e,t),[b,j,e,t]);return(0,h.jsxs)(l.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(p,f),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",p]}),f.length?f.map(e=>(0,h.jsxs)(l.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,h.jsxs)(n.T,{size:13,center:!0,children:[e.name,e.job?(0,h.jsxs)(n.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,h.jsx)(n.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6])},1158,[34,102,794,865,1102,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1159,[34,102,794,865,840,1100,1103,1158,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1160,[34,102,1100,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1161,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1162,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1163,[]); -__d(function(g,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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1164,[829,34,236,402,102,900,848,840,794,1165,1099,1166,25]); -__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1165,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); -__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1166,[1167,1168,1170,1169,1171,1033,1172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1167,[]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1168,[808,5,815,818,846,1033,1169]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1169,[829,236,846,1167]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1170,[34,848,830,838,836,1168,1167]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1171,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1172,[34,1168,985,931]); -__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1173,[34,402,102,426,848,830,840,794,1164,1099,1174,25]); -__d(function(g,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}},1174,[34,102,426,848,830,1166,1033,840,794,1099,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1175,[34,236,402,102,853,794,840,994,1176,1177,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1176,[846,6,931,974,994,1166,1177]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1177,[808,1178,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1178,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1179,[34,846,1176]); -__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1180,[796,1181,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1181,[34,1019,865,804]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1182,[34,402,346,102,426,840,1153,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1183,[30,34,792,846,25]); -__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1184,[829,1097,851,30,34,1185,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); -__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])},1185,[796,34,236,102,25]); -__d(function(_g,_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"})]})]})}},1186,[30,34,336,102,1187,1189,794,830,836,848,856,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1187,[34,1188,102,830,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1188,[2,985]); -__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])},1189,[30,34,402,848,840,794,25]); -__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1190,[30,34,794,1191,848,1175,25]); -__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])},1191,[34,402,840,794,25]); -__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1192,[806,30,34,1193,794,836,848,840,1194,1198,25]); -__d(function(_g,r,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])},1193,[34,385,102,848,836,840,794,25]); -__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}},1194,[34,102,794,836,1195,1196,1197,840,25]); -__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})},1195,[]); -__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})},1196,[]); -__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()})},1197,[931,985,1196]); -__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}},1198,[815,931,974,985,2,1195]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1199,[1200,1209,5,1210,1211,1212,1215,829,30,34,236,402,102,1187,1189,794,830,836,852,848,840,1216,1175,846,865,1217,989,990,997,1219,1198,25]); -__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1200,[34,379,794,847,1201,1202,1208,848,5,6,25]); -__d(function(g,r,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])},1201,[34,379,102,794,991,992,1044,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1202,[6,34,931,794,1203,25]); -__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]})]})}},1203,[6,1204,1205,1206,34,102,796,794,840,11,1207,25]); -__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1205,[4,11]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1206,[11]); -__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.'}},1207,[6,931]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1208,[34,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1209,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1210,[34,102,794,1203,25]); -__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1211,[34,379,931,794,847,1201,1203,4,25]); -__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1212,[34,379,794,1201,847,1202,8,1213,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1213,[34,102,794,1214,25]); -__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1214,[]); -__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1215,[34,794,847,1201,1202,848,9,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1216,[34,402,102,426,794,840,1153,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1217,[798,34,336,395,402,295,102,1187,794,989,830,990,827,840,1034,25,1218]); -__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1218,[]); -__d(function(g,_r,_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)})]})}},1219,[34,102,1220,794,848,997,1195,1198,840,25]); -__d(function(g,r,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])},1220,[34,102,1221,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1221,[1222]); -__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1222,[34,900,1223,1252,1253,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1223,[1224]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1224,[1225,1226,1249,1251]); -__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1225,[]); -__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1226,[1227,1228,1229,1230,1231,1232,1233,1234,1235,1238,1242,1239,1243]); -__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1227,[]); -__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1228,[]); -__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1229,[]); -__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1230,[]); -__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1235,[1236]); -__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1239,[1240,1241]); -__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1240,[]); -__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1241,[]); -__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1244,[1239]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1245,[1239]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1247,[1239,1227]); -__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1248,[]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1249,[1250]); -__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1251,[1250]); -__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1252,[]); -__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1253,[34,900,1254,25]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1254,[]); -__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1255,[30,34,794,848,865,25]); -__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1256,[806,30,34,102,1220,794,836,848,840,1219,1198,25]); -__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1257,[806,30,34,102,1193,794,848,865,836,827,840,1194,1198,25]); -__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1258,[806,30,34,794,848,865,827,840,1219,1198,25]); -__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1259,[806,30,34,794,848,865,840,1219,1198,25]); -__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1260,[30,34,794,827,1120,1261,848,840,25]); -__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}},1261,[]); -__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1262,[30,1075,34,402,102,794,827,848,840,25]); -__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1263,[829,30,34,1185,995,102,1193,794,830,836,1104,827,848,800,840,833,25]); -__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1264,[30,34,102,1189,794,830,852,848,840,1216,5,25]); -__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)}})]})}},1265,[829,30,34,102,1193,1191,794,830,836,827,848,840,25]); -__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1266,[829,1198,30,34,102,794,830,836,827,848,853,25]); -__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]})}},1267,[30,34,846,25]); -__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}},1268,[806,30,34,794,848,5,1198,25]); -__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."})})}},1269,[30,34,794,1270,1131,1198,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1270,[796,829,34,102,794,830,836,1131,1271,848,840,25]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1271,[931,985,1131]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1272,[30,34,846,1273,1328,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"})]}),qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1273,[1121,5,6,1274,798,822,1094,829,1120,1275,1276,1277,1091,1115,1278,1279,1281,1282,1283,1130,977,1099,1284,34,1073,1148,1033,1087,1116,1285,380,402,295,102,426,36,794,1175,1179,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1286,1107,1287,1290,1292,1295,1298,1294,1299,1301,1302,1112,1093,1095,852,1304,1164,1305,1174,1166,1011,1310,1318,1320,1076,1114,1322,1323,1324,1143,1325,1142,1136,838,1326,1327,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1275,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1276,[1012,1100]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1277,[34,102,1079,794,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1278,[829,34,102,794,848,1131,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1279,[34,395,402,426,102,1220,794,1143,1014,1280,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1280,[]); -__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}))},1281,[815]); -__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1282,[798,34,379,395,402,102,794,1143,840,25]); -__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return v}}),_e.SoldOutStrip=function({rid:e,now:k,by:w,onOpen:F}){const I=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[C,_]=(0,n.useState)(0),[A,H]=(0,n.useState)(!1),L=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{O()},[]);const D=k??(0,p.nowFrom)(z),W=(0,S.activeSoldOut)(I,e,D);if(!W.length)return null;const E=W.map(e=>(0,x.withReason)(e.name,L.reason(e.itemId))),M=(0,S.stripText)(E),P=C>0&&(0,S.stripNeedsTicker)(E,C,v),R=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=R);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>F?F():H(!0),onLayout:e=>_(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:b.colours.accentBorder},children:[(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:b.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,j.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,j.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&T?{whiteSpace:'nowrap'}:{},fontFamily:b.fonts.medium,fontSize:v,lineHeight:20,color:b.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!T?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:12,color:b.colours.muted},children:"Tap for all"}):null]}),F?null:(0,j.jsxs)(c.Sheet,{visible:A,onClose:()=>H(!1),title:(0,S.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[w?(0,j.jsx)(u.SoldOutList,{rid:e,by:w,hideLinks:!0}):(0,j.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,j.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:b.colours.border},children:[(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.semibold,fontSize:17,color:b.colours.text},children:e.name}),L.reason(e.itemId)?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.medium,fontSize:14,color:b.colours.amber},children:L.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted},children:["Since ",$(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${$(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const T='undefined'!=typeof document,k=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let w=!1;function O(){if(!T||w)return;w=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=k,document.head.appendChild(e)}const $=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},v=15},1283,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,978,840,25]); -__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])},1284,[798,34,102,840,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1285,[34,102,900,840,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1286,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1287,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1288,1289,1014,865,1107,25]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1288,[798,829,34,1289,102,828,840,794,1108,25]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1289,[828]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1290,[34,236,402,102,840,794,1143,1291,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1291,[]); -__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1292,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1293,840,794,1294,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1293,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1294,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1295,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1281,1296,2,1297,1298,848,827,25]); -__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1296,[236]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1298,[34,815,931,985,1297]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1299,[829,14,1014,1300]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1300,[830]); -__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1301,[34,102,900,840,25]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1302,[829,1014,34,102,794,1096,848,1303,1299,1095,1093,1112,1113,1114,840,1276,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1303,[1014,1079]); -__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1304,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1294,848,1014,830,1089,1079,1261,840,1276,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1305,[796,34,236,402,102,794,848,1014,1306,840,1307,1309,25]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1306,[]); -__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1307,[815,848,1014,1306,1308,1309]); -__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1308,[829]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1309,[236,1308]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1310,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1311,1314,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1311,[1312,839,829,34,281,395,402,295,102,848,1011,1014,1313,827,840,1041,794,1314,1315,985,1276,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1312,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1313,[852,827,851]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1314,[5,1014,931,985]); -__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})},1315,[815,931,985,1316,2,1317]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1316,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1317,[15]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1318,[34,102,900,794,1143,827,840,798,1319,1320,1321,25]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1319,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1320,[]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1321,[1079]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1322,[829,1300]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1323,[34,402,102,794,1322,840,1285,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1324,[34,102,899,794,1143,827,840,25]); -__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1325,[34,1143,402,102,426,794,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1326,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1315,985,25]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1327,[34,1021,865,1001,800,1022,994,1315,1070]); -__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1328,[5,798,847,34,236,402,102,426,985,840,794,1281,1329,25]); -__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}})()},1329,[]); -__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]})}},1330,[30,34,846,25]); +__d(function(g,_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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1159,[34,402,102,794,865,827,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1160,[34,102,794,865,840,1100,1103,1158,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1161,[34,102,1100,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1162,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1163,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1164,[]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1165,[829,34,236,402,102,900,848,840,794,1166,1099,1167,25]); +__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1166,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); +__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1167,[1168,1169,1171,1170,1172,1033,1173]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1168,[]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1169,[808,5,815,818,846,1033,1170]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1170,[829,236,846,1168]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1171,[34,848,830,838,836,1169,1168]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1172,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1173,[34,1169,985,931]); +__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1174,[34,402,102,426,848,830,840,794,1165,1099,1175,25]); +__d(function(g,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}},1175,[34,102,426,848,830,1167,1033,840,794,1099,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1176,[34,236,402,102,853,794,840,994,1177,1178,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1177,[846,6,931,974,994,1167,1178]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1178,[808,1179,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1179,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1180,[34,846,1177]); +__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1181,[796,1182,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1182,[34,1019,865,804]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1183,[34,402,346,102,426,840,1153,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1184,[30,34,792,846,25]); +__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1185,[829,1097,851,30,34,1186,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); +__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])},1186,[796,34,236,102,25]); +__d(function(_g,_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"})]})]})}},1187,[30,34,336,102,1188,1190,794,830,836,848,856,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1188,[34,1189,102,830,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1189,[2,985]); +__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])},1190,[30,34,402,848,840,794,25]); +__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1191,[30,34,794,1192,848,1176,25]); +__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])},1192,[34,402,840,794,25]); +__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1193,[806,30,34,1194,794,836,848,840,1195,1199,25]); +__d(function(_g,r,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])},1194,[34,385,102,848,836,840,794,25]); +__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}},1195,[34,102,794,836,1196,1197,1198,840,25]); +__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})},1196,[]); +__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})},1197,[]); +__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()})},1198,[931,985,1197]); +__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}},1199,[815,931,974,985,2,1196]); +__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1200,[1201,1210,5,1211,1212,1213,1216,829,30,34,236,402,102,1188,1190,794,830,836,852,848,840,1217,1176,846,865,1218,989,990,997,1220,1199,25]); +__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1201,[34,379,794,847,1202,1203,1209,848,5,6,25]); +__d(function(g,r,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])},1202,[34,379,102,794,991,992,1044,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1203,[6,34,931,794,1204,25]); +__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]})]})}},1204,[6,1205,1206,1207,34,102,796,794,840,11,1208,25]); +__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1206,[4,11]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1207,[11]); +__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.'}},1208,[6,931]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1209,[34,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1210,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1211,[34,102,794,1204,25]); +__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1212,[34,379,931,794,847,1202,1204,4,25]); +__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1213,[34,379,794,1202,847,1203,8,1214,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1214,[34,102,794,1215,25]); +__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1215,[]); +__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1216,[34,794,847,1202,1203,848,9,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1217,[34,402,102,426,794,840,1153,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1218,[798,34,336,395,402,295,102,1188,794,989,830,990,827,840,1034,25,1219]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1219,[]); +__d(function(g,_r,_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)})]})}},1220,[34,102,1221,794,848,997,1196,1199,840,25]); +__d(function(g,r,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])},1221,[34,102,1222,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1222,[1223]); +__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1223,[34,900,1224,1253,1254,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1224,[1225]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1225,[1226,1227,1250,1252]); +__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1226,[]); +__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1227,[1228,1229,1230,1231,1232,1233,1234,1235,1236,1239,1243,1240,1244]); +__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1228,[]); +__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1229,[]); +__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1230,[]); +__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1231,[]); +__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1236,[1237]); +__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1240,[1241,1242]); +__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1241,[]); +__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1242,[]); +__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1245,[1240]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1246,[1240]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1248,[1240,1228]); +__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1249,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1250,[1251]); +__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1252,[1251]); +__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1253,[]); +__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1254,[34,900,1255,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1255,[]); +__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1256,[30,34,794,848,865,25]); +__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1257,[806,30,34,102,1221,794,836,848,840,1220,1199,25]); +__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1258,[806,30,34,102,1194,794,848,865,836,827,840,1195,1199,25]); +__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1259,[806,30,34,794,848,865,827,840,1220,1199,25]); +__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1260,[806,30,34,794,848,865,840,1220,1199,25]); +__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1261,[30,34,794,827,1120,1262,848,840,25]); +__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}},1262,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1263,[30,1075,34,402,102,794,827,848,840,25]); +__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1264,[829,30,34,1186,995,102,1194,794,830,836,1104,827,848,800,840,833,25]); +__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1265,[30,34,102,1190,794,830,852,848,840,1217,5,25]); +__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)}})]})}},1266,[829,30,34,102,1194,1192,794,830,836,827,848,840,25]); +__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1267,[829,1199,30,34,102,794,830,836,827,848,853,25]); +__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]})}},1268,[30,34,846,25]); +__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}},1269,[806,30,34,794,848,5,1199,25]); +__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."})})}},1270,[30,34,794,1271,1131,1199,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1271,[796,829,34,102,794,830,836,1131,1272,848,840,25]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1272,[931,985,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1273,[30,34,846,1274,1329,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"}),G]}),Le,qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1274,[1121,5,6,1275,798,822,1094,829,1120,1276,1277,1278,1091,1115,1279,1280,1282,1283,1284,1130,977,1099,1285,34,1073,1148,1033,1087,1116,1286,380,402,295,102,426,36,794,1176,1180,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1287,1107,1288,1291,1293,1296,1299,1295,1300,1302,1303,1112,1093,1095,852,1305,1165,1306,1175,1167,1011,1311,1319,1321,1076,1114,1323,1324,1325,1143,1326,1142,1136,838,1327,1328,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1276,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1277,[1012,1100]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1278,[34,102,1079,794,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1279,[829,34,102,794,848,1131,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1280,[34,395,402,426,102,1221,794,1143,1014,1281,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1281,[]); +__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}))},1282,[815]); +__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1283,[798,34,379,395,402,102,794,1143,840,25]); +__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return F}}),_e.SoldOutStrip=function({rid:e,now:w,by:O,onOpen:I}){const C=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[_,A]=(0,n.useState)(0),[H,L]=(0,n.useState)(!1),D=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{$()},[]);const R=w??(0,p.nowFrom)(z),W=(0,b.activeSoldOut)(C,e,R);if(!W.length)return null;const E=W.map(e=>{const t=D.reason(e.itemId);return(0,x.withReason)(e.name,S.IS_CAR&&'none left'===t?'':t)}),M=(0,b.stripText)(E),P=_>0&&(0,b.stripNeedsTicker)(E,_,F),B=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=B);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>I?I():L(!0),onLayout:e=>A(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:j.colours.accentBorder},children:[(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:j.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,T.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,T.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&k?{whiteSpace:'nowrap'}:{},fontFamily:j.fonts.medium,fontSize:F,lineHeight:20,color:j.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!k?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:12,color:j.colours.muted},children:"Tap for all"}):null]}),I?null:(0,T.jsxs)(c.Sheet,{visible:H,onClose:()=>L(!1),title:(0,b.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[O?(0,T.jsx)(u.SoldOutList,{rid:e,by:O,hideLinks:!0}):(0,T.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,T.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.colours.border},children:[(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.semibold,fontSize:17,color:j.colours.text},children:e.name}),D.reason(e.itemId)?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.medium,fontSize:14,color:j.colours.amber},children:D.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted},children:["Since ",v(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${v(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]),T=r(_d[17]);const k='undefined'!=typeof document,w=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let O=!1;function $(){if(!k||O)return;O=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=w,document.head.appendChild(e)}const v=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},F=15},1284,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,846,978,840,25]); +__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])},1285,[798,34,102,840,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1286,[34,102,900,840,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1287,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1288,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1289,1290,1014,865,1107,25]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1289,[798,829,34,1290,102,828,840,794,1108,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1290,[828]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1291,[34,236,402,102,840,794,1143,1292,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1292,[]); +__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1293,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1294,840,794,1295,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1294,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1295,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1296,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1282,1297,2,1298,1299,848,827,25]); +__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1297,[236]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1299,[34,815,931,985,1298]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1300,[829,14,1014,1301]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1301,[830]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1302,[34,102,900,840,25]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1303,[829,1014,34,102,794,1096,848,1304,1300,1095,1093,1112,1113,1114,840,1277,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1304,[1014,1079]); +__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1305,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1295,848,1014,830,1089,1079,1262,840,1277,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1306,[796,34,236,402,102,794,848,1014,1307,840,1308,1310,25]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1307,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1308,[815,848,1014,1307,1309,1310]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1309,[829]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1310,[236,1309]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1311,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1312,1315,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1312,[1313,839,829,34,281,395,402,295,102,848,1011,1014,1314,827,840,1041,794,1315,1316,985,1277,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1313,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1314,[852,827,851]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1315,[5,1014,931,985]); +__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})},1316,[815,931,985,1317,2,1318]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1317,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1318,[15]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1319,[34,102,900,794,1143,827,840,798,1320,1321,1322,25]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1320,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1321,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1322,[1079]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1323,[829,1301]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1324,[34,402,102,794,1323,840,1286,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1325,[34,102,899,794,1143,827,840,25]); +__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1326,[34,1143,402,102,426,794,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1327,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1316,985,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1328,[34,1021,865,1001,800,1022,994,1316,1070]); +__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1329,[5,798,847,34,236,402,102,426,985,840,794,1282,1330,25]); +__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}})()},1330,[]); __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]})}},1331,[30,34,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1332,[30,34,1333,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1333,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1334,[30,34,846,1335,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1335,[1336,1340,798,991,1073,1341,1160,1040,1041,1342,1344,1347,1130,977,1042,2,1047,1048,1349,993,34,1132,1175,1179,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1350,1070,1085,1086,1082,1043,1025,1100,1357,1358,1359,1368,1369,997,236,1182,1145,1151,1365,1155,1154,1376,1148,15,1161,1162,899,793,985,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1336,[796,34,1033,395,102,1107,1108,1287,1310,794,1011,1014,827,840,1100,1015,1337,1338,1035,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1337,[796,34,402,102,794,840,1014,5,1015,846,985,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1338,[34,102,794,1014,1339,828,840,1060,931,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1339,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1340,[34,102,794,1100,985,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1341,[829,34,102,794,830,836,1131,848,838,840,25]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1342,[985,34,281,236,102,1220,794,1195,1198,840,1343,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1343,[34,236,102,794,1195,25]); -__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1344,[34,102,794,830,1195,1345,1346,840,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1345,[830]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1346,[985,1345,1198]); -__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1347,[5,1348,34,102,794,836,1195,1196,1197,985,1198,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1348,[34,794,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1349,[34,102,794,840,993,1037,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1350,[5,1348,11,1351,796,806,1112,1113,1091,1115,1114,1322,1323,1100,1276,1012,1089,14,1352,1175,1353,1310,1081,1075,1090,34,102,794,1285,848,830,836,827,1261,840,1147,1096,1014,1354,1355,1136,1356,1166,985,1149,1318,852,25]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1351,[6,34,102,794,985,1207,25]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1352,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1353,[34,402,1143,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1354,[34,102,848,1014,794,840,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1355,[34,402,102,794,840,25]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1356,[34,102,853,848,833,840,794,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1357,[34,1311,1100,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1358,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1359,[804,982,1360,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1360,[796,1120,985,900,1164,1166,34,281,379,236,402,102,426,853,794,848,1175,865,836,827,840,1147,1100,838,1361,1135,1365,1366,1119,1126,1125,1024,13,1123,1367,1364,25]); -__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1361,[925,800,798,806,852,1061,1362,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1364,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1362,[499,1363]); -__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 t}});var t={}},1363,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1364,[800,865,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.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1365,[796,34,1188,1041,839,379,402,102,794,865,836,827,840,1147,1100,1364,25]); -__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1366,[1042,34,402,102,794,865,840,1100,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1367,[798,34,283,364,236,102,426,900,794,796,840,1319,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1368,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); -__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1369,[5,1370,1371,1372,1373,1374,34,236,41,102,846,997,840,1375,794,985,2,1072,996,865,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1370,[34,102,847,794,5,6,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1371,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1372,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1373,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1374,[34,102,847,794,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1375,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const v=(0,m.useInStaffApp)(),{now:L,meId:N,me:A,r:z,today:H}=(0,m.useCtx)(3e4),O=(0,s.useTravelDay)('staff',H),P=(0,c.useOwner)(e=>e.shifts),R=(0,c.useOwner)(e=>e.attendance),F=(0,c.useOwner)(e=>e.staffCanViewSuppliers),_=(0,c.useOwner)(e=>e.quickLinks),E=(0,c.useOwner)(e=>e.chat),W=(0,c.useOwner)(e=>e.swaps),V=(0,c.useOwner)(e=>e.leave),q=P.filter(e=>e.staffId===N&&e.published&&e.date>=H).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),G=q.find(e=>e.date===H),U=R.filter(e=>e.staffId===N&&e.in&&!e.out&&L.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Y=(0,x.usePay)(N,0),Q=(0,b.useOrders)(z.id),K=(0,b.useBookings)(z.id),J=Q.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,K))),X=K.filter(e=>e.date===H&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,Q.filter(T.LIVE))),Z=K.filter(e=>(0,S.undoKind)(e,H)||e.walkIn&&'cancelled'===e.status&&e.date===H).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),ee=E.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],se=W.filter(e=>e.fromId===N&&'open'===e.status).length+V.filter(e=>e.staffId===N&&'pending'===e.status).length,te=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & leave',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...F?[['Suppliers',()=>e('more','suppliers')]]:[]];return!v&&O?(0,$.jsxs)(o.default,{style:{gap:10},children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(s.DayView,{rid:z.id,day:O,today:H,app:"staff"})]}):(0,$.jsxs)(o.default,{style:{gap:10},children:[v?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(t.CoversToday,{rid:z.id})]}),(0,$.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,$.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,$.jsx)(C.StaffAvatar,{id:N,size:52})}),(0,$.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",A.replace(' (example)','').split(' ')[0]]})]}),(0,$.jsx)(r.Badge,{kind:"gold",label:v?z.name:'Staff app preview'})]}),(0,$.jsx)(r.Muted,{children:v?`${L.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,$.jsx)(M.StaffTipsTile,{rid:z.id,today:H,onPress:()=>e('more','mytips')}),(0,$.jsxs)(r.Card,{highlight:U?u.colours.ok:void 0,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{weight:"semibold",children:U?`On shift since ${(0,h.hm)(new Date(U.in))}`:'Not clocked in'}),U?(0,$.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((L.getTime()-new Date(U.in).getTime())/6e4)))}):null]}),G?(0,$.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(G.start),"\u2013",(0,m.fmtH)(G.end)]}):q[0]?(0,$.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[q[0].day]," ",Number(q[0].date.slice(8))," ",(0,m.fmtH)(q[0].start),"\u2013",(0,m.fmtH)(q[0].end)]}):(0,$.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,$.jsx)(r.Button,{small:!0,kind:U?'secondary':'success',label:U?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),(0,$.jsx)(p.ShellfishTile,{rid:z.id,by:A.replace(' (example)',''),app:"staff"}),Z.length?(0,$.jsx)(r.Card,{children:(0,$.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",Z.length,")"]}),(0,$.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),Z.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,$.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,$.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,$.jsxs)(r.Muted,{children:[e.table?(0,D.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,$.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(z.id,e)}):null,e.walkIn?(0,$.jsx)(a.CancelWalkInButton,{rid:z.id,b:e,small:!0}):null,e.walkIn?(0,$.jsx)(a.ReinstateWalkInButton,{rid:z.id,b:e,today:H,small:!0}):null,(0,$.jsx)(S.BookingUndo,{b:e,rid:z.id,today:H,who:s})]})]},e.id)})]})}):null,J.length+X.length?(0,$.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",J.length+X.length,")"]}),(0,$.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),J.map(e=>(0,$.jsx)(j.AllergyChain,{o:e,me:A},e.id)),X.map(e=>(0,$.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,I.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,$.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsx)(j.BookingAllergyChain,{b:e,me:A}),(0,$.jsx)(o.default,{style:{flexDirection:'row'},children:(0,$.jsx)(w.WhatsAppGuest,{b:e,rid:z.id,kind:"auto"})})]},e.id))]}):null,ee?(0,$.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,$.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,$.jsx)(r.T,{size:14,children:ee.text})]}):null,(0,$.jsxs)(r.Card,{children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,$.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Y.paid)," paid hours"]})]}),se?(0,$.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,$.jsxs)(r.T,{size:14,children:["You have ",se," request",se>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(_,'staff').length?(0,$.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,$.jsx)(y.QuickLinksRow,{compact:!0})]}):null,v?null:(0,$.jsx)(o.default,{style:{gap:6},children:te.map(([e,s])=>(0,$.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),D=_r(d[23]),I=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27])},1376,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1361,1136,850,1149,838,1147,899,1354,1014,829,1096,1154,25]); -__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]})}},1377,[30,34,846,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1378,[1379,985,795,1329,1381,1011,30,1408,496,34,385,336,236,41,102,5,847,846,1410,36,848,1014,865,840,1369,997,1010,1413,1414,1415,1416,1099,2,1024,1436,1298,25,1437,1438,1439,1440]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1379,[2,796,34,236,383,102,794,1380,985,840,1151,997,865,988,25]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1380,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1381,[1382,1405,1407]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1382,[215,1383,1386,1400,1401,1402,1403,1404]); -__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1383,[215,1384]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1384,[1385]); -__d(function(g,r,i,a,m,e,d){},1385,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1386,[1387,215,1383,1400,1401]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1387,[1388,1389,1399]); -__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1388,[1389,1393,1398]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1389,[215,372,1390,1394,1395,1396,1397,1393,1398]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1390,[215,1391,339,280,1392,1393]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1391,[504]); -__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1392,[215,339]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1393,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1394,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1395,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1396,[1394]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1397,[]); -__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1398,[372,1392]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1399,[34,1389]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1400,[1387,215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1401,[1387,1400]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1402,[1383]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1403,[215,1383,1386,1384]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1404,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1405,[215,54,1406]); -__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1406,[215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1407,[34,1382]); -__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]}})})},1408,[1409]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1409,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1410,[34,41,102,426,794,847,997,985,2,5,840,1411,1412,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),e.railSizes=function(s,o){const l=s>=1600?168:s>=1200?136:120,t=Math.floor((o-44)/12),n=Math.max(44,Math.min(72,t-18));return{railW:l,per:t,circle:n,label:t>=80?13:t>=66?11:10,icon:Math.round(.46*n)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return o}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}];const o=s=>s.split('').join(' ')},1411,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1412,[34,102,794,840,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1413,[986,857,856,985]); -__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1414,[798,796,34,1337,1015,402,102,846,985,1007,1014,5,840,794,1281,974,2,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1415,[796,34,236,402,102,840,985,1045,2,25]); -__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1416,[5,796,34,385,283,364,380,236,402,295,426,102,1417,1116,2,900,1100,15,865,794,840,1418,930,1432,1428,1429,1433,1117,1434,929,1435,1431,25,277]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"useAssistantUi",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AssistantFab",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AssistantSheet",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"AssistantPage",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AssistantSettings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"AssistantPlanCard",{enumerable:!0,get:function(){return c}});const t=!1,n={getState:()=>({open:!1,setOpen:t=>{}})},u=()=>null,s=()=>null,l=()=>null,o=()=>null,c=()=>null},1417,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${O[t.risk]}${$(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if($(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(c.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const c=(0,l.searchHelp)(p.HELP,e,3);return c.length?{kind:'help',ids:c.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,O={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},$=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);return e.staffId&&e.date&&a>t?(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`):'That shift isn\u2019t complete.'}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...u.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1418,[1419,1098,829,1422,1423,865,848,1014,1427,1428,1429,1425,1424,1430,1431,1012,1013]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1419,[1420,1421,1038]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1420,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1421,[34,846,1420,827,985,931]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1422,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1423,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1424,1422]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1424,[804,1098,829,1120,1198,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1425,1426]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1425,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1426,[808,815,818]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1427,[798,34,283,364,236,402,102,815,794,840,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1428,[]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1429,[]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1430,[800,865,989,836,1424,1032]); -__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1431,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1432,[865,800,1014]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1433,[815]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1434,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1435,[815]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=f(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),A=[],k=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);i.includes(c)||(A.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0}),d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:u(d,23.5)}:void 0}):d===y&&e<=m&&k.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:u(d,e-.05),inSite:!0}))}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!A.some(e=>e.staffId===t.staffId&&e.date===t.date)),...A],attendance:[...S.attendance,...k]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:u(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:u((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',f=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,u=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1436,[848,800,865,1024,15,997,846]); -__d(function(e,s,o,p,t,a,n){"use strict";t.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1437,[]); -__d(function(s,o,p,e,d,t,c){"use strict";d.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1438,[]); -__d(function(o,s,p,e,d,t,f){"use strict";d.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1439,[]); -__d(function(o,s,p,d,e,t,n){"use strict";e.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1440,[]); -__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]})}},1441,[30,34,846,25]); -__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1442,[1443]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1443,[25,1444,591]); -__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1444,[34,172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1445,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1446,[25,499,34,270,651]); +__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]})}},1332,[30,34,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1333,[30,34,1334,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1334,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1335,[30,34,846,1336,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1336,[1337,1341,798,991,1073,1342,1161,1040,1041,1343,1345,1348,1130,977,1042,2,1047,1048,1350,993,34,1132,1176,1180,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1351,1070,1085,1086,1082,1043,1025,1100,1358,1359,1360,1369,1370,997,236,1183,1145,1151,1366,1155,1154,1377,1148,15,1162,1163,899,793,985,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1337,[796,34,1033,395,102,1107,1108,1288,1311,794,1011,1014,827,840,1100,1015,1338,1339,1035,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1338,[796,34,402,102,794,840,1014,5,1015,846,985,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1339,[34,102,794,1014,1340,828,840,1060,931,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1340,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1341,[34,102,794,1100,985,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1342,[829,34,102,794,830,836,1131,848,838,840,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1343,[985,34,281,236,102,1221,794,1196,1199,840,1344,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1344,[34,236,102,794,1196,25]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1345,[34,102,794,830,1196,1346,1347,840,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1346,[830]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1347,[985,1346,1199]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1348,[5,1349,34,102,794,836,1196,1197,1198,985,1199,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1349,[34,794,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1350,[34,102,794,840,993,1037,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1351,[5,1349,11,1352,796,806,1112,1113,1091,1115,1114,1323,1324,1100,1277,1012,1089,14,1353,1176,1354,1311,1081,1075,1090,34,102,794,1286,848,830,836,827,1262,840,1147,1096,1014,1355,1356,1136,1357,1167,985,1149,1319,852,25]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1352,[6,34,102,794,985,1208,25]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1353,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1354,[34,402,1143,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1355,[34,102,848,1014,794,840,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1356,[34,402,102,794,840,25]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1357,[34,102,853,848,833,840,794,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1358,[34,1312,1100,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1359,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1360,[804,982,1361,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1361,[796,1120,985,900,1165,1167,34,281,379,236,402,102,426,853,794,848,1176,865,836,827,840,1147,1100,838,1362,1135,1366,1367,1119,1126,1125,1024,13,1123,1368,1365,25]); +__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1362,[925,800,798,806,852,1061,1363,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1365,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1363,[499,1364]); +__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 t}});var t={}},1364,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1365,[800,865,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.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1366,[796,34,1189,1041,839,379,402,102,794,865,836,827,840,1147,1100,1365,25]); +__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1367,[1042,34,402,102,794,865,840,1100,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1368,[798,34,283,364,236,102,426,900,794,796,840,1320,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1369,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); +__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1370,[5,1371,1372,1373,1374,1375,34,236,41,102,846,997,840,1376,794,985,2,1072,996,865,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1371,[34,102,847,794,5,6,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1372,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1373,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1374,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1375,[34,102,847,794,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1376,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const L=(0,m.useInStaffApp)(),{now:N,meId:A,me:O,r:R,today:z}=(0,m.useCtx)(3e4),H=(0,s.useTravelDay)('staff',z),P=(0,h.useOwner)(e=>e.shifts),F=(0,h.useOwner)(e=>e.attendance),_=(0,h.useOwner)(e=>e.staffCanViewSuppliers),E=(0,h.useOwner)(e=>e.quickLinks),W=(0,h.useOwner)(e=>e.chat),q=(0,h.useOwner)(e=>e.swaps),V=(0,h.useOwner)(e=>e.leave),G=P.filter(e=>e.staffId===A&&e.published&&e.date>=z).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),U=G.find(e=>e.date===z),Y=F.filter(e=>e.staffId===A&&e.in&&!e.out&&N.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Q=(0,x.usePay)(A,0),K=(0,b.useOrders)(R.id),J=(0,b.useBookings)(R.id),X=K.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,J))),Z=J.filter(e=>e.date===z&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,K.filter(T.LIVE))),ee=J.filter(e=>(0,S.undoKind)(e,z)||e.walkIn&&'cancelled'===e.status&&e.date===z).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),se=W.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],te=q.filter(e=>e.fromId===A&&'open'===e.status).length+V.filter(e=>e.staffId===A&&'pending'===e.status).length,ie=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],..._?[['Suppliers',()=>e('more','suppliers')]]:[]];return!L&&H?(0,v.jsxs)(o.default,{style:{gap:10},children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(s.DayView,{rid:R.id,day:H,today:z,app:"staff"})]}):(0,v.jsxs)(o.default,{style:{gap:10},children:[L?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(t.CoversToday,{rid:R.id})]}),(0,v.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,v.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,v.jsx)(C.StaffAvatar,{id:A,size:52})}),(0,v.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",O.replace(' (example)','').split(' ')[0]]})]}),(0,v.jsx)(r.Badge,{kind:"gold",label:L?R.name:'Staff app preview'})]}),(0,v.jsx)(r.Muted,{children:L?`${N.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,v.jsx)(M.StaffTipsTile,{rid:R.id,today:z,onPress:()=>e('more','mytips')}),(0,v.jsxs)(r.Card,{highlight:Y?u.colours.ok:void 0,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{weight:"semibold",children:Y?`On shift since ${(0,c.hm)(new Date(Y.in))}`:'Not clocked in'}),Y?(0,v.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((N.getTime()-new Date(Y.in).getTime())/6e4)))}):null]}),U?(0,v.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(U.start),"\u2013",(0,m.fmtH)(U.end)]}):G[0]?(0,v.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[G[0].day]," ",Number(G[0].date.slice(8))," ",(0,m.fmtH)(G[0].start),"\u2013",(0,m.fmtH)(G[0].end)]}):(0,v.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,v.jsx)(r.Button,{small:!0,kind:Y?'secondary':'success',label:Y?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),A?(0,v.jsx)($.RequestTimeOff,{meId:A,me:O,testID:"staff-home-time-off"}):null,(0,v.jsx)(p.ShellfishTile,{rid:R.id,by:O.replace(' (example)',''),app:"staff"}),ee.length?(0,v.jsx)(r.Card,{children:(0,v.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ee.length,")"]}),(0,v.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),ee.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,v.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,v.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,v.jsxs)(r.Muted,{children:[e.table?(0,I.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,v.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(R.id,e)}):null,e.walkIn?(0,v.jsx)(a.CancelWalkInButton,{rid:R.id,b:e,small:!0}):null,e.walkIn?(0,v.jsx)(a.ReinstateWalkInButton,{rid:R.id,b:e,today:z,small:!0}):null,(0,v.jsx)(S.BookingUndo,{b:e,rid:R.id,today:z,who:s})]})]},e.id)})]})}):null,X.length+Z.length?(0,v.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",X.length+Z.length,")"]}),(0,v.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),X.map(e=>(0,v.jsx)(j.AllergyChain,{o:e,me:O},e.id)),Z.map(e=>(0,v.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,D.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,v.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,I.tablesLabel)(e.table)}`:'']}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsx)(j.BookingAllergyChain,{b:e,me:O}),(0,v.jsx)(o.default,{style:{flexDirection:'row'},children:(0,v.jsx)(w.WhatsAppGuest,{b:e,rid:R.id,kind:"auto"})})]},e.id))]}):null,se?(0,v.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,v.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,v.jsx)(r.T,{size:14,children:se.text})]}):null,(0,v.jsxs)(r.Card,{children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,v.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Q.paid)," paid hours"]})]}),te?(0,v.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,v.jsxs)(r.T,{size:14,children:["You have ",te," request",te>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(E,'staff').length?(0,v.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,v.jsx)(y.QuickLinksRow,{compact:!0})]}):null,L?null:(0,v.jsx)(o.default,{style:{gap:6},children:ie.map(([e,s])=>(0,v.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27]),v=_r(d[28])},1377,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1362,1136,850,1149,838,1147,899,1355,1014,829,1096,1154,1159,25]); +__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]})}},1378,[30,34,846,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1379,[1380,985,795,1330,1382,1011,30,1409,496,34,385,336,236,41,102,5,847,846,1411,36,848,1014,865,840,1370,997,1010,1414,1415,1416,1417,1099,2,1024,1437,1299,25,1438,1439,1440,1441]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1380,[2,796,34,236,383,102,794,1381,985,840,1151,997,865,988,25]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1381,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1382,[1383,1406,1408]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1383,[215,1384,1387,1401,1402,1403,1404,1405]); +__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1384,[215,1385]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1385,[1386]); +__d(function(g,r,i,a,m,e,d){},1386,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1387,[1388,215,1384,1401,1402]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1388,[1389,1390,1400]); +__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1389,[1390,1394,1399]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1390,[215,372,1391,1395,1396,1397,1398,1394,1399]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1391,[215,1392,339,280,1393,1394]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1392,[504]); +__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1393,[215,339]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1394,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1395,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1396,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1397,[1395]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1398,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1399,[372,1393]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1400,[34,1390]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1401,[1388,215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1402,[1388,1401]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1403,[1384]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1404,[215,1384,1387,1385]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1405,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1406,[215,54,1407]); +__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1407,[215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1408,[34,1383]); +__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]}})})},1409,[1410]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1410,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1411,[34,41,102,426,794,847,997,985,2,5,840,1412,1413,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"RAIL_TITLE",{enumerable:!0,get:function(){return o}}),e.railSizes=function(s,l){const t=l>=1e3?13:11,n=Math.round(1.45*t),c=48+n+8,b=Math.floor((l-o-12)/12)>=c?1:2,h=12/b,p=Math.floor((l-o-12)/h),u=1===b?s>=1600?168:s>=1200?136:120:s>=1600?128:s>=1100?100:88,f=Math.max(44,Math.min(1===b?72:64,p-n-12,u-24));return{railW:u*b,colW:u,cols:b,per:p,circle:f,label:t,lineH:n,icon:Math.round(.46*f)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return l}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}],o=32;const l=s=>s.split('').join(' ')},1412,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1413,[34,102,794,840,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1414,[986,857,856,985]); +__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1415,[798,796,34,1338,1015,402,102,846,985,1007,1014,5,840,794,1282,974,2,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1416,[796,34,236,402,102,840,985,1045,2,25]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1417,[5,796,34,385,283,364,380,236,402,295,426,102,1418,1116,2,900,1100,15,865,794,840,1419,930,1433,1429,1430,1434,1117,1435,929,1436,1432,25,277]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"useAssistantUi",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AssistantFab",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AssistantSheet",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"AssistantPage",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AssistantSettings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"AssistantPlanCard",{enumerable:!0,get:function(){return c}});const t=!1,n={getState:()=>({open:!1,setOpen:t=>{}})},u=()=>null,s=()=>null,l=()=>null,o=()=>null,c=()=>null},1418,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${$[t.risk]}${O(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if(O(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(u.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const u=(0,l.searchHelp)(p.HELP,e,3);return u.length?{kind:'help',ids:u.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,$={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},O=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);if(!(e.staffId&&e.date&&a>t))return'That shift isn\u2019t complete.';const s=(0,n.leaveOn)(n.useOwner.getState().leave,String(e.staffId),String(e.date));return s?`${_(e.staffId)} has time off then (${N(s.from)} to ${N(s.to)}). Add the shift on the Rota yourself if they\u2019ve agreed to work.`:(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`)}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...c.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1419,[1420,1098,829,1423,1424,865,848,1014,1428,1429,1430,1426,1425,1431,1432,1012,1013]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1420,[1421,1422,1038]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1421,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1422,[34,846,1421,827,985,931]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1423,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1424,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1425,1423]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1425,[804,1098,829,1120,1199,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1426,1427]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1426,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1427,[808,815,818]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1428,[798,34,283,364,236,402,102,815,794,840,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1429,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1430,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1431,[800,865,989,836,1425,1032]); +__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1432,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1433,[865,800,1014]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1434,[815]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1435,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1436,[815]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=u(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),k=[],A=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);if(i.includes(c))continue;k.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0});const u='st-jack'===t?{auto:'rota'}:{};d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:f(d,23.5)}:void 0,...u}):d===y&&e<=m&&A.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:f(d,u.auto?e:e-.05),inSite:!0,...u})}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!k.some(e=>e.staffId===t.staffId&&e.date===t.date)),...k],attendance:[...S.attendance,...A]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:f(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:f((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,f=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1437,[848,800,865,1024,15,997,846]); +__d(function(e,s,o,p,t,a,n){"use strict";t.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1438,[]); +__d(function(s,o,p,e,d,t,c){"use strict";d.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1439,[]); +__d(function(o,s,p,e,d,t,f){"use strict";d.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1440,[]); +__d(function(o,s,p,d,e,t,n){"use strict";e.exports="/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1441,[]); +__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]})}},1442,[30,34,846,25]); +__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1443,[1444]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1444,[25,1445,591]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1445,[34,172]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1446,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1447,[25,499,34,270,651]); __r(501); __r(21); __r(0); \ No newline at end of file diff --git a/display-app/admin.html b/display-app/admin.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/admin.html +++ b/display-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer.html b/display-app/customer.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer.html +++ b/display-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage.html b/display-app/customer/anchorage.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage.html +++ b/display-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/book.html b/display-app/customer/anchorage/book.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/book.html +++ b/display-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/feedback.html b/display-app/customer/anchorage/feedback.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/feedback.html +++ b/display-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/gift.html b/display-app/customer/anchorage/gift.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/gift.html +++ b/display-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/lost.html b/display-app/customer/anchorage/lost.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/lost.html +++ b/display-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/loyalty.html b/display-app/customer/anchorage/loyalty.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/loyalty.html +++ b/display-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/merch.html b/display-app/customer/anchorage/merch.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/merch.html +++ b/display-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/offers.html b/display-app/customer/anchorage/offers.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/offers.html +++ b/display-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/refer.html b/display-app/customer/anchorage/refer.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/refer.html +++ b/display-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/waitlist.html b/display-app/customer/anchorage/waitlist.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/waitlist.html +++ b/display-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/anchorage/whatson.html b/display-app/customer/anchorage/whatson.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/anchorage/whatson.html +++ b/display-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/basket.html b/display-app/customer/basket.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/basket.html +++ b/display-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/customer/profile.html b/display-app/customer/profile.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/customer/profile.html +++ b/display-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/demo.html b/display-app/demo.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/demo.html +++ b/display-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/display.html b/display-app/display.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/display.html +++ b/display-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/index.html b/display-app/index.html index de57dfc5ea1d2dc7ed8bc516db05bda10cdf2694..451ea431bb034f04eb229406f1b9fb590e37cae3 100644 --- a/display-app/index.html +++ b/display-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/kitchen.html b/display-app/kitchen.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/kitchen.html +++ b/display-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/owner.html b/display-app/owner.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/owner.html +++ b/display-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/staff.html b/display-app/staff.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/staff.html +++ b/display-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/display-app/sw.js b/display-app/sw.js index fee89bc48e1c40b47f28cf90c82b67fc204adb49..b033c76f1550bd08768b11593058a055b72e1033 100644 --- a/display-app/sw.js +++ b/display-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Display service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-display-a05fa48efd"; +const V = "cc-display-6a3ad788e3"; const BASE = "/display-app/"; -const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=a05fa48efddfe0a5fd06f5fe626ed134ebf69c3eca3d5a9c6c47988871aff4d9"]; +const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=6a3ad788e300b7efc6d07a7c6465abb32f8032794eae0c52e1d9e55a03863194"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/display-app/team.html b/display-app/team.html index 6060cdea4ad68b50ed818a96abeb99c82d75b6d7..77752ade8fa2a10b72b9b9782ce00d0fc0c27582 100644 --- a/display-app/team.html +++ b/display-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/index.html b/index.html index 9db00477a3567f6c92ae694ec6d564ce09687c8c..6d43a265c131fffbfefe033dcb6b3da0855e5a02 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Cover Charge: try the apps (v0.3.12.120) +Cover Charge: try the apps (v0.3.12.121) @@ -63,7 +63,7 @@ footer{margin-top:28px;color:var(--muted);font-size:.8rem;text-align:center} Cover Charge logo

covercharge

All in one restaurant booking app

-

Cover Charge: try the apps (v0.3.12.120)

+

Cover Charge: try the apps (v0.3.12.121)

The Anchorage, Harbour View, Dunure

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

Cover Charge v0.3.12.120

+

Cover Charge v0.3.12.121

diff --git a/owner-app/_expo/static/js/web/bundle.js b/owner-app/_expo/static/js/web/bundle.js index 35d781bdcd16570a6410c63f6fb014f3686ed67d..47dab507fa3f0c6accb2f669b0e81fc02739a245 100644 --- a/owner-app/_expo/static/js/web/bundle.js +++ b/owner-app/_expo/static/js/web/bundle.js @@ -23,11 +23,11 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_VENUE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PITCH_TEAM",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_TEXT",{enumerable:!0,get:function(){return o}}),e.pitchText=function(a){let n=a;for(const[a,t]of o)a.test(n)?(a.lastIndex=0,n=n.replace(a,t)):a.lastIndex=0;return n};const a={name:'The Harbour Kitchen',tagline:'Harbourside seafood & seasonal plates',location:'12 Quay Street, Portmorran',phone:'01632 960 123',website:'harbourkitchen.example'},n={'st-tracy':{name:'Morgan',job:'Owner',hourlyPence:null,salaried:!0},'st-gordon':{name:'Alex',job:'General Manager',dept:'Management',hourlyPence:null,salaried:!0},'st-bisto':{name:'Ravi',job:'Head Chef',hourlyPence:null,salaried:!0},'st-agate':{name:'Priya',job:'Front of house supervisor',hourlyPence:1450},'st-lenny':{name:'Tom',job:'Commis Chef',hourlyPence:1325},'st-finn':{name:'Lewis',job:'Bar staff',hourlyPence:1290},'st-eilidh':{name:'Chloe',job:'Front of house',hourlyPence:1271},'st-emily':{name:'Ellie',job:'Front of house',hourlyPence:1271},'st-lillie':{name:'Jordan',job:'Kitchen porter (KP)',hourlyPence:1271},'st-jack':{name:'Sam',job:'Kitchen porter (KP)',hourlyPence:1271}},o=[['Harbour View, Dunure, South Ayrshire',a.location],['Harbour View, Dunure',a.location],['Harbour View mug','Harbour Kitchen mug'],['Harbour View','Quay Street'],['anchoragedunure.com',a.website],['01292 502826',a.phone],['Mini Anchors','Little Crew'],['The Anchorage',a.name],['Anchorage','Harbour Kitchen'],['ANCHORAGE','HARBOUR KITCHEN'],['South Ayrshire','the Firth coast'],['Ayrshire','the Firth coast'],['Dunure','Portmorran'],['Kittyfisher boat (Big Sean)','Coastal Fish Co'],['Kittyfisher','Coastal Fish Co'],['Big Sean','Coastal Fish Co'],['Example Fish Co.','Coastal Fish Co'],['Sample Dairy Ltd','Hillside Dairy'],['Sample Fruit & Veg','Fieldfare Veg'],['Mills milk','Hillside Dairy milk'],['Mills','Hillside Dairy'],['J. Pieroni & Sons','Fieldfare Veg'],["Pieroni's",'Fieldfare Veg'],['Pieroni','Fieldfare Veg'],['Alsons (drinks)','Drinks wholesaler'],['Alsons','the drinks wholesaler'],['Spes Bona','the deli wholesaler'],['Tarelgin','the butcher'],['Reids','the bakery'],['Reeds','the bakery'],['Example Butchers Ltd','Quayside Butchers'],['Example Dry Goods Wholesale','Dry goods wholesaler'],['Sample Brewing Co.','Harbourside Brewing'],['Example Cleaning Supplies','Cleaning supplies'],['Sample Packaging Ltd','Packaging supplier'],['Example Kitchen Repairs','Kitchen repairs'],['Preston','Ravi'],['Bisto','Ravi'],['Tracy','Morgan'],['James','Morgan'],['Gordon','Alex'],['Agate','Priya'],['Lenny','Tom'],['Finn','Lewis'],['Eilidh','Chloe'],['Emily','Ellie'],['Gabrielle','Ellie'],['Cameron Mc','Sam'],['Cameron','Sam'],['Lillie','Jordan'],['Lily','Jordan'],['Mia','Jordan'],['Jack','Sam'],['Harvey','Jordan'],['Anna','the supplier'],['(preview)',''],[' (example)','']].map(([a,n])=>[new RegExp(`${/^[A-Za-z]/.test(a)?'(?g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`](_),globalThis.__webpack_require__=o=>{const t=ErrorUtils.reportFatalError;_&&(ErrorUtils.reportFatalError=_=>{throw _});try{return g[`${__METRO_GLOBAL_PREFIX__}__r`](o)}finally{_&&(ErrorUtils.reportFatalError=t)}}},23,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1522,1525]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1526,1529]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},25,[26]); __d(function(g,r,i,a,m,e,d){ /** @@ -41,7 +41,7 @@ __d(function(g,r,i,a,m,e,d){ */ "use strict";var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(t,o,f){var l=null;if(void 0!==f&&(l=""+f),void 0!==o.key&&(l=""+o.key),"key"in o)for(var y in f={},o)"key"!==y&&(f[y]=o[y]);else f=o;return o=f.ref,{$$typeof:n,type:t,key:l,ref:void 0!==o?o:null,props:f}}e.Fragment=t,e.jsx=o,e.jsxs=o},26,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ctx",{enumerable:!0,get:function(){return t}});const t=r(d[0])},27,[28]); -__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1192,1193,1195,1197,1199,1206,1260,1261,1262,1263,1264,1265,1267,1268,1269,1270,1271,1272,1273,1274,1277,1335,1336,1337,1475,1479,1480,1521]); +__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1193,1194,1196,1198,1200,1207,1261,1262,1263,1264,1265,1266,1268,1269,1270,1271,1272,1273,1274,1275,1278,1336,1337,1338,1479,1483,1484,1525]); __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]})}},29,[30,34,792,846,988,25]); __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)},30,[31,32,782,783,785]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},31,[]); @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1159,1160,899,997,1161,1133,1162,1169,1174,1183,1176,1132,1185,1189,1156,848,1190,1130,985,1191,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1160,1161,899,997,1162,1133,1163,1170,1175,1184,1177,1132,1186,1190,1156,848,1191,1130,985,1192,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,899,927,924,840,928,25]); __d(function(g,_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 C.webLine}}),_e.T=R,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return T}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:l=!0,right:o,maxWidth:n=640,footer:s,scroll:c=!0}){const h=(0,S.jsxs)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===k.APP_VARIANT?(0,S.jsx)(D,{}):null]});return(0,S.jsxs)(x.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,S.jsx)(A,{title:t,subtitle:r,back:l,right:o})}),c?(0,S.jsx)(u.default,{contentContainerStyle:{paddingBottom:40},children:h}):(0,S.jsx)(f.default,{style:{flex:1},children:h}),s?(0,S.jsx)(f.default,{style:O.footer,children:(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=z,_e.Card=v,_e.Badge=function({label:e,kind:t="neutral"}){const r={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,S.jsx)(f.default,{style:[O.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:I?'center':'flex-start'}],children:(0,S.jsx)(R,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return E}}),_e.Row=V,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return $}}),_e.Field=function({label:e,...r}){return(0,S.jsxs)(f.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,S.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...r,style:[O.input,r.multiline&&{minHeight:70,textAlignVertical:'top'},r.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:l,sub:o,testID:n,accessibilityLabel:s}){return(0,S.jsxs)(c.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${s??e}${!s&&o?`, ${o}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:r,style:[O.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e.trim()}),o?(0,S.jsx)(R,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:o}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:l,disabled:o,a11y:n}){return(0,S.jsxs)(V,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,S.jsx)(R,{style:{flex:1,flexShrink:1},children:r}),(0,S.jsx)(b.default,{testID:l,disabled:o,accessibilityLabel:n??r,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:r=1,max:l=20,label:o,step:n=1,format:s,testID:u}){const h=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,S.jsxs)(V,{gap:10,children:[(0,S.jsx)(c.default,{testID:u?`${u}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${o??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[O.stepBtn,e<=r?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,S.jsx)(f.default,{testID:u?`${u}-value`:void 0,accessibilityLabel:o?`${o}: ${h}`:h,children:(0,S.jsx)(R,{weight:"semibold",size:p.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:h})}),(0,S.jsx)(c.default,{testID:u?`${u}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${o??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,b(e+n))),style:[O.stepBtn,e>=l?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:r,children:l,maxWidth:n,testID:h,footer:b}){const{height:j}=(0,y.default)(),C=o.default.useContext(x.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},w=Math.max(320,j-C.top-C.bottom-24);return(0,S.jsx)(s.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,S.jsx)(f.default,{style:[O.overlay,{padding:12,paddingTop:12+C.top,paddingBottom:12+C.bottom}],children:(0,S.jsxs)(f.default,{style:[O.sheet,{maxHeight:w},n?{maxWidth:n}:null],testID:h,children:[(0,S.jsxs)(V,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,S.jsx)(P,{style:{flex:1},children:r}),(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:B?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,S.jsx)(R,{size:B?18:24,colour:p.colours.text,children:B?'Close':'\u2715'})})]}),(0,S.jsx)(u.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:l}),b?(0,S.jsx)(f.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:h?`${h}-footer`:void 0,children:b}):null]})})})},_e.SectionTitle=function({children:e}){return(0,S.jsx)(R,{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 O}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),l=_r(d[3]),o=e(_r(d[4])),n=e(_r(d[5])),s=e(_r(d[6]));_r(d[7]);var c=e(_r(d[8])),u=e(_r(d[9])),h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=_r(d[14]),p=_r(d[15]),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),k=_r(d[19]),W=_r(d[20]),S=_r(d[21]);const B=['kirkton','abbotsford'].includes(w.VENUE_RID),I='display'!==k.APP_VARIANT;function R({children:e,style:r,size:l=p.font.body,weight:o="regular",colour:n=p.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:b,accessibilityLabel:f}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,w=h.default.flatten(r)||{},k=1===w.flex||1===w.flexGrow||'number'==typeof w.width||'left'===w.textAlign,W=c??(I&&('semibold'===o||'bold'===o)&&!k);return(0,S.jsx)(t.Text,{testID:u??(y?'cc-url':void 0),...W?{dataSet:{centre:'heading'}}:{},accessibilityRole:b,accessibilityLabel:f,numberOfLines:s,style:[{minWidth:0,fontFamily:p.fonts[o],fontSize:l,color:n,lineHeight:(0,j.lineFor)(l)},W&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},r,x,(0,C.webLine)(r,l),W&&'left'!==w.textAlign?{textAlign:'center'}:null],children:e})}const L=e=>(0,S.jsx)(R,{size:p.font.title,weight:"semibold",center:!0,...e}),P=e=>(0,S.jsx)(R,{size:p.font.large,weight:"semibold",center:!0,...e}),T=e=>(0,S.jsx)(R,{colour:p.colours.muted,size:p.font.small,...e,center:e.center??I});function A({title:e,back:t=!0,right:l,subtitle:o}){return(0,S.jsxs)(f.default,{style:O.brandBar,children:[(0,S.jsxs)(f.default,{style:O.row,children:[(0,S.jsx)(f.default,{style:O.brandSide,children:t?(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>r.router.canGoBack()?r.router.back():r.router.replace(k.ENTRY[k.APP_VARIANT]),style:O.backBtn,hitSlop:10,children:(0,S.jsx)(R,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,S.jsx)(c.default,{onPress:()=>r.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:O.brandCenter,children:(0,S.jsx)(W.RestaurantBrand,{size:W.HEADER_LOGO})}),(0,S.jsx)(f.default,{style:[O.brandSide,{alignItems:'flex-end'}],children:l?(0,S.jsx)(f.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,S.jsx)(L,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,S.jsx)(T,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function D(){const e=(0,r.useLocalSearchParams)().rid??w.VENUE_RID,t=(0,l.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,S.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{n.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,S.jsx)(R,{center:!0,size:14,colour:p.colours.gold,children:t})}):null}function z({label:e,sub:t,onPress:r,kind:l="primary",disabled:o,small:n,style:s,accessibilityLabel:u,accessibilityHint:h,testID:b}){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],x={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,S.jsxs)(c.default,{testID:b,accessibilityRole:"button",accessibilityLabel:u??e,accessibilityHint:h,accessibilityState:{disabled:!!o},disabled:o,onPress:r,style:({pressed:e})=>[O.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:x,opacity:o?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:j.control.min,minWidth:44},s],children:[(0,S.jsx)(R,{weight:"semibold",size:n?p.font.small:p.font.body,colour:y,center:!0,children:e.trim()}),t?(0,S.jsx)(R,{size:n?p.font.small-2:p.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function v({children:e,style:t,onPress:r,highlight:l}){const o=l===p.colours.gold||l===p.colours.accentBorder,n=(0,S.jsx)(f.default,{testID:"cc-card",style:[O.card,{alignItems:'stretch'},l?{borderColor:o?p.colours.accentBorder:l,borderWidth:o?1:2}:null,t],children:e});return r?(0,S.jsx)(c.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function F({kind:e="info",title:t,children:r}){const l={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,S.jsxs)(f.default,{accessibilityRole:"summary",style:[O.banner,{backgroundColor:l[0],borderLeftColor:l[1]}],children:[t?(0,S.jsx)(R,{weight:"semibold",colour:l[2],center:!0,children:t}):null,o.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,S.jsx)(R,{size:p.font.small,colour:l[2],center:!0,children:r}):r]})}T.statusLine=!0,z.centreRow=!0;const H=()=>(0,S.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."}),E=()=>(0,S.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function V({children:e,style:t,gap:r=8,wrap:l}){const n=o.default.Children.map(e,e=>{if(!o.default.isValidElement(e))return e;const t=e,r=h.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:o.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===v?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),s=h.default.flatten(t)||{},c=o.default.Children.toArray(n).filter(o.default.isValidElement),u=e=>e.type;if(I&&'space-between'===s.justifyContent&&1!==s.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,S.jsx)(f.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const b=I&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==s.justifyContent&&'space-between'!==s.justifyContent;return(0,S.jsx)(f.default,{...b?{dataSet:{centre:'buttons'}}:{},style:[O.row,{gap:r},b&&{justifyContent:'center',flexWrap:'wrap'},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:n})}const $=()=>(0,S.jsx)(f.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const O=h.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},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:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:j.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:j.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',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,boxSizing:'border-box',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:{maxWidth:'100%',flexShrink:0,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:j.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}})},794,[795,796,30,800,34,379,395,236,402,295,41,410,102,426,36,840,844,845,5,846,847,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -945,7 +945,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/asset __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},862,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},863,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},864,[]); -__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 h}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return g}}),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 S}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return v}}),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 D}}),_e.openShiftOf=T,_e.loggedBreakMins=$,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 U}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return x}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return F}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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',h=e=>!!e.out&&!!e.signOff,g={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},y=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return b(new Date(a,n-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),S=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),E=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],R=1271,v=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,D=[{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 T(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function $(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-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 B=()=>{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:{},chatRead:{},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:D.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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},U=(0,u.create)()((0,f.persist)((e,a)=>({...B(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:a,job:n,active:!0,level:q[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}: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,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}: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,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=y(t,e),o=y(n,e);i.shifts.filter(e=>e.date===a&&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 a=y(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,a)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??$({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=T(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:$({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),g.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,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>g.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};g.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(B()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=j().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,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=B();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}})),V=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,q={owner:'Owner',manager:'Manager',staff:'Staff'},x={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 K=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,a)=>a.indexOf(e)===t),W=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=K(e);return n.includes(a)||n.includes(a.split(' ')[0])},F=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return $}}),_e.openShiftOf=P,_e.loggedBreakMins=A,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return W}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return H}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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,t,a)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=a&&a<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,k={send:null},y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,I=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},w=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return y(new Date(a,n-1,i+t))},S=e=>w(e,-I(e)),E=(e,t)=>e.filter(e=>e.date===t),O=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),R=(e,t)=>t?e:e.filter(e=>e.published),v=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],_=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,$=[{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 P(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function A(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),M=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,N=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function C(){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,...B.includes(e.id)?{displayClock:!0}:{}}))}const B=['st-jack'];function U(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const V=()=>{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:{},chatRead:{},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:$.map(e=>({...e})),workEmail:'',staff:C(),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:U(),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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},q=(0,u.create)()((0,f.persist)((e,a)=>({...V(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:M('st'),name:t,role:a,job:n,active:!0,level:K[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:M('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:M('ph'),caption:t,tone:N[e.photos.length%N.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:M('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:M('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:M('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:M('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:M('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:I(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:I(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=w(t,e),o=w(n,e);i.shifts.filter(e=>e.date===a&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!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:I(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 a=w(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const a={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[a,...e.leave]})),a},setLeave:(t,n)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)}));const i=a().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:M('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??A({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:M('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=P(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:A({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:M('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),k.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:M('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:M('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};k.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(V()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=C().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,hourly:{...e.hourly,...U()},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=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=V();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=S(y(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:w(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}})),x=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,K={owner:'Owner',manager:'Manager',staff:'Staff'},W={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 F=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,a)=>a.indexOf(e)===t),G=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=F(e);return n.includes(a)||n.includes(a.split(' ')[0])},H=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},866,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},867,[]); __d(function(s,t,r,i,e,a,c){"use strict";e.exports={uri:"/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},868,[]); @@ -1065,7 +1065,7 @@ __d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModul __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},982,[804]); __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 u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).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 u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),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(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};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 u=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):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},983,[982]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return c.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const c=e.IS_CAR?b[n]:'nolink'===n&&'display'===e.APP_VARIANT?p:f[n];return(0,h.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${c}`,style:{borderRadius:16,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface,padding:14,gap:4},children:[(0,h.jsx)(u.T,{size:12,weight:"semibold",colour:l.colours.goldMuted,children:o.toUpperCase()}),(0,h.jsx)(u.T,{size:18,weight:"semibold",children:c})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]);const f={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},p="This Display isn't paired yet. Tap Not paired to pair it.",b={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when the car is back online.',nolink:'Not connected yet. Check the car has internet. If this stays, sign the car in again from Managers on your phone.'}},984,[846,34,102,985,2,840,794,25]); -__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return he}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),It(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=he.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Gt,i.readAccessLog=async function(){const e=he.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Qt}}),i.uploadOrderLogo=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Qt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=Jt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Qt).createSignedUrl(e,3600);if(t?.signedUrl)return Jt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Qt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return zt}}),i.claimInvite=ca,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(na,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ia,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=he.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=he.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(na),await T.kv.remove(ia),Se({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=he.getState().venueId;if(ae.PITCH||!s||'staff'!==he.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await ma('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'}}},i.claimInviteForSync=async function(e){const t=await ca(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return await ma('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return ma('staff_app_link_history',{p_venue:he.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await ma('revoke_staff_app_link',{p_venue:he.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=he.getState().venueId;if(!e||'staff'!==he.getState().kind)return{};try{const t=await ma('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return Number(await ma('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=he.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(sa,n),Sa(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(la,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:fa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(la,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(na,null);await T.kv.set(na,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||Sa()}return'revoked'!==i&&'unknown'!==i||await pa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await pa(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}Se({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await ma('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:fa(e)}}},i.carList=async function(){const e=he.getState().venueId;if(!e)return[];return(await ma('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await ma('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:fa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(sa),await ha();try{await _e().auth.signOut()}catch{}Se({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(na),await T.kv.remove(ia),await ha();try{await _e().auth.signOut()}catch{}Se({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Se({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ga,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return ma}}),i.mendSession=ya,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,wa=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,h.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,h.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Se({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 Ka(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void Se({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void Se({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];Se({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>Se({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>Se({mode:e?he.getState().venueId?'live':he.getState().mode:he.getState().venueId?'offline':he.getState().mode}))),await va()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ua}}),i.goLive=Ea,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ga}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Va.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Va.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),ma('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Ue(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Ue(a.from_time),to:Ue(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Va.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ga.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Va.get(a);e&&!e.ok&&Va.delete(a)}));const n=Va.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=he.getState().venueId;if(!n||'staff'!==he.getState().kind)throw new Error('Connect to your venue first.');const i=await ma('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),h=t(r[10]),S=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),D=t(r[21]),U=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),j=t(r[34]),B=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,U.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const he=(0,D.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Se=e=>he.setState(e),ye=e=>{const t=he.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=he.getState().mode;return'live'===e||'offline'===e||'connecting'===e};he.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),De=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Ue=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=De(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=De(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==he.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(j.useFloor.getState().plans[e]??(0,j.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:he.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&j.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>j.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>B.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>B.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>B.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>B.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(B.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==he.getState().kind&&('device'!==he.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>B.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>B.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(B.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={...B.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;B.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{B.useShellStore.getState().server[e]||B.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const je=new Set;function Be(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,h.isAnchorage)(e)&&(0,h.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,h.isAnchorage)(e)&&(s={...s,signOff:(0,h.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,h.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,h.isAnchorage)(e)&&(0,h.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,h.isAnchorage)(e)&&(0,h.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!je.has(e)){je.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){je.delete(e),Se({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,D.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==he.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,h.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${he.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=De(62),t=e=>ye('rota.manage')||e.staffId===he.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,S.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,S.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=De(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===he.getState().staffRef&&'open'===e.status,writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===he.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const gt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function mt(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function _t(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:j.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:gt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...St??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...St?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...St?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},St=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&j.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&mt(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=j.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,St=null;const yt=()=>new Date(Date.now()-2592e6).toISOString(),wt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},vt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},bt=()=>he.getState().perms.includes('*');function kt(){const e=()=>he.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!wt(t.ch)&&(t.from===e()||bt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('created_at',yt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=yt(),toRow:(e,t)=>{const a=wt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=vt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=vt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function It(e,t,a){const s=he.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':wt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Ot(e){const t=he.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':vt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function Rt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function At(e){const t=De(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===he.getState().staffRef,writable:()=>'staff'===he.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ut=e=>null==e||''===e?null:Number(e),Ct=e=>e.filter(e=>!e.startsWith('data:'));function Et(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',De(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Ct(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Tt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Ct(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Nt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function Mt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',De(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function xt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ut(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function Kt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function qt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Lt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function Pt(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===he.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:he.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function $t(e){const t=De(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,S.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Bt(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===he.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ft(e){const t=De(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=he.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===he.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Wt(e,t=!1){const a=De(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Ht(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Vt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Gt(){const e=he.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Qt='order-list-logos';const Jt=new Map;const zt=(0,D.create)(()=>({live:!1,known:!1}));async function Zt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const Xt=(e,t)=>Ee({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)}),ea='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function ta(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Xt(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function aa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ea).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Xt(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const sa='pair:v1',na='staff:v1',ia='staff:rejoin:v1';async function ra(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function oa(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ia,null);if(!e)return'none';try{await ua();const{data:t,error:a}=await ra(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ia),await T.kv.remove(na),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(na,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ia),'refused')}catch{return'offline'}}const da=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 ua(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}Se({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 ca(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ua();const{data:t,error:a}=await ra(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(na,n),await T.kv.set(ia,e),Re&&Sa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Se({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const la='car:request:v1',fa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function pa(){await T.kv.remove(na),await T.kv.remove(la),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ga(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ua(),!0}catch{return!1}}const ma=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let _a=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],_a&&(clearInterval(_a),_a=null)}async function Sa(){await ha(),await va()}async function ya(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ia,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await oa()&&(Sa(),!0)}catch{return!1}}(0,d.setSessionMender)(ya);let wa=o.VENUE_RID;async function va(){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 e=wa;try{if(Se({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Oa(e);const t=await T.kv.get(sa,null);let a=await T.kv.get(na,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await oa();if('offline'===t)return Se({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{wa===e&&Sa()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(na,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void Se({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await ma('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(sa):(await T.kv.remove(na),await T.kv.remove(ia)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))Se({mode:'offline'});else if(da(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await oa()&&setTimeout(()=>{wa===e&&Sa()},500)}i=he.getState().perms}Se({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await ka(n.venueId,e,n.kind)}catch(e){Se({mode:'local',lastError:String(e?.message??e)})}}const ba=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 ka(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ea(a),Oe.push(Ha(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[_t(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Wa()},onRemote:()=>{Wa()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[wa]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[wa],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&&V.useSetup.getState().patch(wa,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[wa]?.staffGrade!==a.sites[wa]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Be(a),La(a)];ye('wages.view')&&n.push(Pa(a)),'staff'===s&&(n.push(ut(),ct(),lt(),pt(a)),ft(e));const i='staff'===s&&await Yt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(kt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Vt('hr_questions')&&(n.push(ta(a)),ba.add('hr_questions'),aa(e,a)),'guest'!==s&&await Vt('sold_out_items')?(n.push(Wt(a,await Vt('sold_out_items','auto'))),ba.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Vt('sold_out_links')?(n.push(Ht(a)),ba.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Zt()&&(n.push(Rt(a)),'staff'===s&&n.push(At(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Vt('staff','nickname'),Ze=await Vt('staff','display_clock');const[e,t,s,i]=await Promise.all([Vt('scheduled_notifications'),Vt('order_lists'),Vt('venue_clock_area'),Vt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Bt(a),Ft(a)),ba.add('daily_tasks'),ba.add('daily_task_ticks')),e&&(n.push(qt(a)),Gt()),t&&n.push(Lt(a),Pt(a),$t(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ba.add(n)}if('guest'!==s&&await Vt('day_tips')){n.push(Mt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ba.add(e);await Vt('tips_pot_events')&&n.push(xt(a),Kt(a)),'staff'===s&&(n.push(Et(a),Tt(a),Nt(a)),ba.add('cash_ups'),ba.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Vt('scheduled_notifications')&&n.push(qt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Vt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ba.add('ingredient_prices'),await Vt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ba.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Vt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ba.add('specials_boards'));const c={onActivity:()=>Se({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Se({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Se({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await ma('whoami')??[]).some(t=>t.venue_id===e))return void(wa===a&&Sa());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await ma('whoami');if(!t?.some(t=>t.venue_id===e))return void(wa===a&&Sa())}catch(e){if(da(e)){const e=await oa();return void('ok'!==e&&'refused'!==e||wa===a&&Sa())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Ot(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(Se({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):Se({mode:'offline'}),!ye('wages.view')){const e=he.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ba.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const h=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);Se({lastSyncAt:(new Date).toISOString()})},e=>{Se({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(h)}),_a=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...he.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Ia='guest:sent:v1';async function Oa(e){Se({kind:'guest',venueSlug:e,perms:[]});try{const t=(await ma('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){Se({venueId:t.id,venueName:t.name}),await Ea(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),mt(e,t.app?.events)}await Ra(e),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Se({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Ra(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Aa(e)}async function Ra(e){const t=await ma('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Aa(e){let t=await T.kv.get(Ia,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ga())return;for(const a of n)try{const s=(await ma('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await ma('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Order: ${e?.message}`}))}await T.kv.set(Ia,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await ma('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Ia,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await ma('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Se({mode:(0,E.isOnline)()?he.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),_a=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ua={bridges:()=>Ie,restart:Sa},Ca='golive:v1:';async function Ea(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await Ka(e):(await T.kv.get(Ca+e,!1)||await Ka(e),await T.kv.get(Ma+e,!1)||(xa(e),await T.kv.set(Ma+e,!0)),await T.kv.get(Ta+e,!1)||(Na(),await T.kv.set(Ta+e,!0)))}const Ta='golive:v3:';function Na(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 Ma='golive:v2:';function xa(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 Ka(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,h.isDemoCard)(e)),log:m.log.filter(e=>!(0,h.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ca+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),j.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:[],swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ca+e,!0)}const qa=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function La(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(j.useFloor.getState().live[e]??{}).map(([e,t])=>qa(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===he.getState().kind||ye('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:he.getState().staffRef??ve}),fromRow:e=>qa(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>j.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>j.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Pa(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const $a='staff-avatars',ja=new Map;let Ba=!1;const Fa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Wa(){if(!Ba){Ba=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===he.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from($a).download(t);if(n||!s)continue;const i=await Fa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ba=!1}}}function Ha(e){const t=async()=>{const t=he.getState().staffRef,a=t?Ye.get(t)??he.getState().staffUuid:void 0;if(!t||!a||'staff'!==he.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from($a).remove([t]).catch(()=>{})};if(!s)return void(n&&(await ma('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Se({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 _e().storage.from($a).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await ma('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Se({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==he.getState().staffRef){const e=s[t].path;ja.set(t,null),ma('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from($a).remove([e])).catch(()=>{})}});return t(),s}const Va=new Map,Ga=(0,D.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),Ot(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=Se.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(Zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Qt,i.readAccessLog=async function(){const e=Se.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Jt}}),i.uploadOrderLogo=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Jt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=zt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Jt).createSignedUrl(e,3600);if(t?.signedUrl)return zt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Jt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return Zt}}),i.claimInvite=la,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(ia,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ra,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(ia),await T.kv.remove(ra),he({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Se.getState().venueId;if(ae.PITCH||!s||'staff'!==Se.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await _a('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'}}},i.claimInviteForSync=async function(e){const t=await la(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return _a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return await _a('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),_a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return _a('staff_app_link_history',{p_venue:Se.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await _a('revoke_staff_app_link',{p_venue:Se.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=Se.getState().venueId;if(!e||'staff'!==Se.getState().kind)return{};try{const t=await _a('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return Number(await _a('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=Se.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(na,n),ya(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(fa,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:pa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(fa,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(ia,null);await T.kv.set(ia,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||ya()}return'revoked'!==i&&'unknown'!==i||await ga(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await ga(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}he({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await _a('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:pa(e)}}},i.carList=async function(){const e=Se.getState().venueId;if(!e)return[];return(await _a('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await _a('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:pa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(na),await ha();try{await _e().auth.signOut()}catch{}he({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(ia),await T.kv.remove(ra),await ha();try{await _e().auth.signOut()}catch{}he({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}he({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ma,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return _a}}),i.mendSession=wa,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,va=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,S.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,S.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void he({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 qa(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void he({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void he({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];he({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>he({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>he({mode:e?Se.getState().venueId?'live':Se.getState().mode:Se.getState().venueId?'offline':Se.getState().mode}))),await ba()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ca}}),i.goLive=Ta,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Qa}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Ga.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Ga.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),_a('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:De(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:De(a.from_time),to:De(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Ga.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Qa.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ga.get(a);e&&!e.ok&&Ga.delete(a)}));const n=Ga.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Se.getState().venueId;if(!n||'staff'!==Se.getState().kind)throw new Error('Connect to your venue first.');const i=await _a('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),U=t(r[21]),D=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),B=t(r[34]),j=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,D.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const Se=(0,U.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),he=e=>Se.setState(e),ye=e=>{const t=Se.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=Se.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Se.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),Ue=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),De=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=Ue(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=Ue(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Se.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(B.useFloor.getState().plans[e]??(0,B.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:Se.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&B.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>B.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>j.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>j.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>j.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>j.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(j.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Se.getState().kind&&('device'!==Se.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>j.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>j.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(j.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={...j.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;j.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{j.useShellStore.getState().server[e]||j.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const Be=new Set;function je(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,S.isAnchorage)(e)&&(0,S.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,S.isAnchorage)(e)&&(s={...s,signOff:(0,S.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,S.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,S.isAnchorage)(e)&&(0,S.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,S.isAnchorage)(e)&&(0,S.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!Be.has(e)){Be.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Be.delete(e),he({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,U.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==Se.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,S.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${Se.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=Ue(62),t=e=>ye('rota.manage')||e.staffId===Se.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,h.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,h.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=Ue(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===Se.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.leaveRemote.decide=t=>!(!ye('rota.manage')||!(0,z.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(K.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),Oe.push(()=>{J.leaveRemote.decide=null})}function pt(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function gt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Se.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const mt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function _t(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function St(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:B.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...yt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...yt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...yt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},yt=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&B.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&_t(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=B.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,yt=null;const wt=()=>new Date(Date.now()-2592e6).toISOString(),vt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},bt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},kt=()=>Se.getState().perms.includes('*');function It(){const e=()=>Se.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!vt(t.ch)&&(t.from===e()||kt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('created_at',wt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=wt(),toRow:(e,t)=>{const a=vt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=bt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=bt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Ot(e,t,a){const s=Se.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':vt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Rt(e){const t=Se.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':bt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function At(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Ut(e){const t=Ue(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===Se.getState().staffRef,writable:()=>'staff'===Se.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ct=e=>null==e||''===e?null:Number(e),Et=e=>e.filter(e=>!e.startsWith('data:'));function Tt(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',Ue(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Et(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Nt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Et(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Mt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function xt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',Ue(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.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:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ct(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function qt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Lt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Pt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function $t(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Se.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Se.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Bt(e){const t=Ue(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,h.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Ft(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===Se.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Wt(e){const t=Ue(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Se.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===Se.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Ht(e,t=!1){const a=Ue(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Vt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Gt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Qt(){const e=Se.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();Zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Jt='order-list-logos';const zt=new Map;const Zt=(0,U.create)(()=>({live:!1,known:!1}));async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Xt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const ea=(e,t)=>Ee({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)}),ta='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function aa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ea(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function sa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ta).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ea(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const na='pair:v1',ia='staff:v1',ra='staff:rejoin:v1';async function oa(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function da(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ra,null);if(!e)return'none';try{await ca();const{data:t,error:a}=await oa(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ra),await T.kv.remove(ia),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(ia,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ra),'refused')}catch{return'offline'}}const ua=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 ca(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}he({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 la(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ca();const{data:t,error:a}=await oa(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(ia,n),await T.kv.set(ra,e),Re&&ya(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return he({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const fa='car:request:v1',pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function ga(){await T.kv.remove(ia),await T.kv.remove(fa),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ma(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ca(),!0}catch{return!1}}const _a=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let Sa=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],Sa&&(clearInterval(Sa),Sa=null)}async function ya(){await ha(),await ba()}async function wa(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ra,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await da()&&(ya(),!0)}catch{return!1}}(0,d.setSessionMender)(wa);let va=o.VENUE_RID;async function ba(){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 e=va;try{if(he({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Ra(e);const t=await T.kv.get(na,null);let a=await T.kv.get(ia,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await da();if('offline'===t)return he({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{va===e&&ya()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(ia,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void he({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await _a('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(na):(await T.kv.remove(ia),await T.kv.remove(ra)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))he({mode:'offline'});else if(ua(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await da()&&setTimeout(()=>{va===e&&ya()},500)}i=Se.getState().perms}he({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await Ia(n.venueId,e,n.kind)}catch(e){he({mode:'local',lastError:String(e?.message??e)})}}const ka=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 Ia(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ta(a),Oe.push(Va(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[St(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ha()},onRemote:()=>{Ha()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[va]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[va],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&&V.useSetup.getState().patch(va,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[va]?.staffGrade!==a.sites[va]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},je(a),Pa(a)];ye('wages.view')&&n.push($a(a)),'staff'===s&&(n.push(ut(),ct(),lt(),gt(a)),pt(e)),'staff'===s&&await Gt('staff_leave')&&(n.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Se.getState().staffRef&&'pending'===e.status||ye('rota.manage')),writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:Ee(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),ka.add('staff_leave'),ft(e));const i='staff'===s&&await Xt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(It(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Gt('hr_questions')&&(n.push(aa(a)),ka.add('hr_questions'),sa(e,a)),'guest'!==s&&await Gt('sold_out_items')?(n.push(Ht(a,await Gt('sold_out_items','auto'))),ka.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Gt('sold_out_links')?(n.push(Vt(a)),ka.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Yt()&&(n.push(At(a)),'staff'===s&&n.push(Ut(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Gt('staff','nickname'),Ze=await Gt('staff','display_clock');const[e,t,s,i]=await Promise.all([Gt('scheduled_notifications'),Gt('order_lists'),Gt('venue_clock_area'),Gt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Ft(a),Wt(a)),ka.add('daily_tasks'),ka.add('daily_task_ticks')),e&&(n.push(Lt(a)),Qt()),t&&n.push(Pt(a),$t(a),Bt(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ka.add(n)}if('guest'!==s&&await Gt('day_tips')){n.push(xt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ka.add(e);await Gt('tips_pot_events')&&n.push(Kt(a),qt(a)),'staff'===s&&(n.push(Tt(a),Nt(a),Mt(a)),ka.add('cash_ups'),ka.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Gt('scheduled_notifications')&&n.push(Lt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Gt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ka.add('ingredient_prices'),await Gt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ka.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Gt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ka.add('specials_boards'));const c={onActivity:()=>he({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>he({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{he({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await _a('whoami')??[]).some(t=>t.venue_id===e))return void(va===a&&ya());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await _a('whoami');if(!t?.some(t=>t.venue_id===e))return void(va===a&&ya())}catch(e){if(ua(e)){const e=await da();return void('ok'!==e&&'refused'!==e||va===a&&ya())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Rt(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(he({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):he({mode:'offline'}),!ye('wages.view')){const e=Se.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ka.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);he({lastSyncAt:(new Date).toISOString()})},e=>{he({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(S)}),Sa=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...Se.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Oa='guest:sent:v1';async function Ra(e){he({kind:'guest',venueSlug:e,perms:[]});try{const t=(await _a('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){he({venueId:t.id,venueName:t.name}),await Ta(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),_t(e,t.app?.events)}await Aa(e),he({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{he({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Aa(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Ua(e)}async function Aa(e){const t=await _a('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Ua(e){let t=await T.kv.get(Oa,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ma())return;for(const a of n)try{const s=(await _a('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await _a('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Order: ${e?.message}`}))}await T.kv.set(Oa,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await _a('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Oa,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await _a('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),he({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{he({mode:(0,E.isOnline)()?Se.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),Sa=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ca={bridges:()=>Ie,restart:ya},Ea='golive:v1:';async function Ta(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await qa(e):(await T.kv.get(Ea+e,!1)||await qa(e),await T.kv.get(xa+e,!1)||(Ka(e),await T.kv.set(xa+e,!0)),await T.kv.get(Na+e,!1)||(Ma(),await T.kv.set(Na+e,!0)))}const Na='golive:v3:';function Ma(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 xa='golive:v2:';function Ka(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 qa(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,S.isDemoCard)(e)),log:m.log.filter(e=>!(0,S.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ea+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),B.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:e.leave.filter(e=>(0,z.isUuid)(e.id)),swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ea+e,!0)}const La=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Pa(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(B.useFloor.getState().live[e]??{}).map(([e,t])=>La(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Se.getState().kind||ye('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:Se.getState().staffRef??ve}),fromRow:e=>La(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>B.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>B.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function $a(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ba='staff-avatars',ja=new Map;let Fa=!1;const Wa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ha(){if(!Fa){Fa=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Se.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from(Ba).download(t);if(n||!s)continue;const i=await Wa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Fa=!1}}}function Va(e){const t=async()=>{const t=Se.getState().staffRef,a=t?Ye.get(t)??Se.getState().staffUuid:void 0;if(!t||!a||'staff'!==Se.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from(Ba).remove([t]).catch(()=>{})};if(!s)return void(n&&(await _a('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void he({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 _e().storage.from(Ba).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await _a('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){he({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Se.getState().staffRef){const e=s[t].path;ja.set(t,null),_a('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from(Ba).remove([e])).catch(()=>{})}});return t(),s}const Ga=new Map,Qa=(0,U.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=O,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return b}}),_e.useGpCalcView=function(){const e=b();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...O(e)}:e,[e])},Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return v}}),_e.gpSyncItems=E,_e.gpSyncFromRow=P,_e.mergeGpItems=w,_e.gpSyncSpec=function(e,t){const i='ing'===e?'ingredient_prices':'card_costs';return{name:i,table:i,deletes:!1,list:()=>E(b.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:C(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>P(e,t),apply:(t,i)=>b.setState(n=>w(n,e,t,i)),subscribe:t=>b.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i.cardCosts===n.cardCosts)||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),r=(e=a)&&e.__esModule?e:{default:e},d=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,t,i,n,s,a=0,r=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:a,allergens:r}),m=e=>new Date(Date.now()-864e5*e).toISOString(),S={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},k=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...h('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...h('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(S[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:m(7*(i.length-t))}))})),y=(e,t,i,n,s,a,r,d="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:a,status:r,description:d,allergens:[]}),I=[y('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),y('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),y('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),y('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),y('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),y('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function O(e){const t=e=>I.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),a=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),r=e=>{const t=k.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},d=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(d).forEach(e=>e.lines.forEach(e=>a.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>a.has(e.id)||!r(e)),cardCosts:d}}const b=(0,d.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:k,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),a=n.ingredients.map(e=>e.id===t.id?t:e);let r=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,a,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(d(t)-d(s))/d(s)*100;i.length&&(r=[{id:f('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...r].slice(0,20))}const d=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:d?a.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):a,alerts:r})},addPricePaid:(e,t,n)=>{const s=i(),a=s.ingredients.find(t=>t.id===e);if(!(a&&t>0))return;const r=[...a.prices?.length?a.prices:[{p:a.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),d={...a,prices:r};i().saveIngredient({...d,packPrice:(0,o.costingPrice)(d,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=f('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)}))}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>r.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...O({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&b.persist.rehydrate()});const v='1970-01-01T00:00:00.000Z',C=e=>JSON.parse(JSON.stringify(e));function E(e,t){const i=O(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??v,doc:C({...e,updatedAt:e.updatedAt??v})})):Object.entries(i.cardCosts).map(([e,t])=>({id:e,updatedAt:t.updatedAt??v,doc:C({...t,updatedAt:t.updatedAt??v})})),s=new Set(n.map(e=>e.id)),a=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...a]}function P(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('card'!==e||Array.isArray(s.lines))?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function w(e,t,i,n){const s={...e.gone??{}},a=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e.cardCosts??{})),r=[];for(const e of i){const i=`${t}:${e.id}`,n=a.get(e.id),d=n?n.updatedAt??v:void 0,c=s[i];if(e.deletedAt){if(n&&d>e.deletedAt)continue;a.delete(e.id),(!c||ce.updatedAt)continue;if(n&&d>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?a.set(e.id,o):r.push([e.id,o]),delete s[i]}for(const e of n)a.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...a.values(),...r.map(([,e])=>e)],gone:s}}return{cardCosts:Object.fromEntries([...a.entries(),...r]),gone:s}}},986,[806,34,807,5,808,815,818,987,832,839]); __d(function(_g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return i}}),e.priceStats=c,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return o}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return l}}),e.convert=function(t,n,i){const c=u[n],o=u[i];return c&&o&&c.dim===o.dim?t*c.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return d}}),e.perBaseUnit=function(t){const n=u[t.packUnit];if(!(n&&t.packSize>0))return null;const i=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/i*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/i*1e3,per:'litre'}:{pence:t.packPrice/i,per:'item'}},Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return g}}),e.lineCost=m,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return p}}),e.suggestAllergens=function t(n,i,c=[],o=0){const s=new Set;for(const u of n.lines)if(u.ingId.startsWith('dish:')){const n=c.find(t=>t.id===u.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>s.add(t)),t(n,i,c,o+1).forEach(t=>s.add(t)))}else i.find(t=>t.id===u.ingId)?.allergens?.forEach(t=>s.add(t));return[...s]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:h(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return S}}),e.suggestForMultiple=function(t,n,i,c,o){const s=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?b(Math.ceil(s)):Math.ceil(s)},e.amountLabel=k,e.cardCostSummary=function(t,n,i,c){const o=(t?.lines??[]).map(t=>{const i=n.find(n=>n.id===t.ingId);return{line:t,name:i?.name??'Removed ingredient',cost:m(t,n),label:k(t,i)}}),s=o.reduce((t,n)=>t+n.cost,0),u=Math.max(1,t?.portions||1),a=s/u,l=t?.target??i.defaultTarget??70,f=a>0?y(a,l,i.vatPct,i.pricePoints):null,d=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,g=d??(c&&c>0?c:f),p=g&&a>0?P(a,g,i.vatPct):null;return{lines:o,batch:s,perPortion:a,target:l,suggested:f,price:g,priceIsSuggested:!(d||c&&c>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,l):null,missing:o.filter(t=>t.cost<=0).length}};var t=r(_d[0]);const n=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],i=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function c(t,n=5){const c=i(t),o=c.slice(-Math.max(1,n)),s=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:s,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",i=5)=>'average'===n?c(t,i).avg:c(t,i).latest;const s={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},u={kg:{dim:'mass',f:s.kg},g:{dim:'mass',f:s.g},oz:{dim:'mass',f:s.oz},lb:{dim:'mass',f:s.lb},stone:{dim:'mass',f:s.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=['kg','g','stone','lb','oz','L','ml','each'],l=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const f=(t,n)=>[...'mass'===u[t].dim?['g','kg','oz','lb']:'vol'===u[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],d=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;const g=(t,n)=>{const i=(t?.servingName||'serving').trim().toLowerCase();return 1===n?i:/(s|sh|ch|x)$/.test(i)?`${i}es`:`${i}s`};function m(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?p(o,n,i,c+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=d(o);return null==n?0:t.qty*n}const s=u[o.packUnit],a=u[t.unit];if(!a||s.dim!==a.dim)return 0;const l=o.packPrice/(o.packSize*s.f),f=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*a.f*l/(1-f/100)}const p=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+m(o,n,i,c),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,i){const c=h(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}}function b(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}function y(t,n,i,c){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+i/100);return c?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const S=t=>`${t.toFixed(1)}x`;function k(t,n){const i=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${i} ${g(n,t.qty)}`:'each'===t.unit?`${i} ${1===t.qty?'item':'items'}`:`${i} ${l(t.unit,t.qty)}`}},987,[982]); __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 f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});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:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},988,[]); @@ -1088,7 +1088,7 @@ __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1006,[975]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1007,[1003,975,1008]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1009,[]); __d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return v}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class v{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=c(t),this.saveKnown())})}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=s.get(e);if(!this.pending(e)){if(f){const t=c(f);if(this.rev(f)===this.rev(h)){this.known[e]=l,t!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(h),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,h.length>l&&!f)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||e.syncable(s)&&e.writable()&&this.known[n]!==t&&!this.pending(n)&&this.write(s)}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1010,[1005,931,1003,975,1007]); __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 b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);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??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`: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}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},1011,[829,808,839,815,818,827,1012,1013]); @@ -1122,7 +1122,7 @@ __d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},1038,[1039]); __d(function(g,r,i,a,m,e,d){function n(n,t){const o=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o,s){const u=()=>r.importAll(t,s);{const l=o?.[String(t)];if(Array.isArray(l)){const c=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(c?.isReady?.(l))return u();const f=n(t,o);if(null!=f)return f.then(u);throw new Error(`Cannot import module ${s??t}: the async bundle loader is unavailable. Load the initial Expo bundle before importing these chunks: ${l.join(', ')}`)}try{return u()}catch(s){const l=n(t,o);if(null!=l)return l.then(u);throw s}}const l=n(t,o);return null!=l?l.then(u):u()}function o(n,o,s){const u=t(n,o,s),l=Promise.resolve(u);return l._result=u,l}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},1039,[]); __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)},1040,[34]); __d(function(_g,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,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return p}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[w,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(p,Math.ceil(f.w)+4),j=e&&l>0&&l-2*vu(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.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 t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const w=()=>f(e=>e.layers.some(e=>e.own)),p=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1041,[34,236,402,102,815,840,794,1040,25]); -__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.120'},1042,[]); +__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.121'},1042,[]); __d(function(_g,_r,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'},1043,[796,991,34,379,402,102,794,840,1021,1022,865,1025,1026,1027,992,1044,985,1045,994,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1044,[]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1045,[1046,931,985,846]); @@ -1179,7 +1179,7 @@ __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return z}}),_e.useTableNames=B,_e.resetTableLive=N,_e.seatBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'seated'),N(e,t.table)},_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=M,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return F}}),_e.TablePicker=A,_e.WalkInSheet=R,_e.AssignTableSheet=W,_e.undoNotice=E,_e.NewBookingSheet=_,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[n,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,O.jsxs)(O.Fragment,{children:[s?(0,O.jsx)(R,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:E}):null,l?(0,O.jsx)(_,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,i.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,O.jsx)(W,{booking:n.b,combine:n.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),O=_r(_d[27]);const z=Array.from({length:12},(e,t)=>String(t+1));function B(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function N(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function M(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=B(e),a=(0,S.useFloor)(t=>t.live[e])??{},n=(0,S.usePlan)(e),i=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(i,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[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,S.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,x.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 F=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function A({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=n?6:8,y=n?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(i??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,O.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],i=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!i,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,O.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:i?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,O.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,O.jsx)(T.T,{weight:"bold",size:22,colour:i?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,O.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,O.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,O.jsx)(T.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const L=[1,2,3,4,5,6,7,8];function R({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:y,r:w,now:C}=(0,p.useCtx)(15e3),D=M(y,C),[I,$]=(0,r.useState)(2),[P,z]=(0,r.useState)(!1),[B,F]=(0,r.useState)(i??null),R=(0,S.usePlan)(y),W=(0,f.useBookings)(y),E=(0,v.useBlocks)(e=>e.blocks),_=(0,v.closedAreasAt)(E,y,(0,x.ymd)(C),(0,x.hm)(C)),H=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(D).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(R,W.filter(e=>e.date===(0,x.ymd)(C)),e,I,C,(0,k.turnFor)(I,w.settings.turnMins),90,void 0,{closed:_})?.table??null},[R,W,D,I,_.size,C.getTime()]);(0,r.useEffect)(()=>{B&&(0,S.tablesOf)(B).some(e=>'Closed'===D[e]?.label)&&F(null)},[B,_.size]);const[U,q]=(0,r.useState)(!1),[V,Y]=(0,r.useState)(''),G=(e,t=String(e),s=()=>{z(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,O.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,O.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},K=(0,O.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),Q=(0,O.jsxs)(b.default,{style:{gap:8,width:n?256:void 0},children:[(0,O.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,O.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[L.map(e=>G(e)),G(9,'9+',()=>{z(!0),$(e=>e>=9?e:9)})]}),P?K:null]}),[X,J]=(0,r.useState)(!1),Z=async(t=B)=>{if(!X){J(!0);try{const s=await f.repo.bookings.seatWalkIn(y,I,t??void 0,V);N(y,t??void 0),a(s),e()}finally{J(!1)}}},ee=(0,O.jsxs)(b.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,O.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,O.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),B?(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>F(null)}):null]}),(0,O.jsx)(A,{use:D,value:B,onPick:e=>{D[e]&&!D[e].busy?Z(e):F(B===e?null:e)},big:n,dense:n,best:H,bestSet:(0,u.bestTables)(R)}),(0,O.jsxs)(T.Muted,{children:["Tap a free table to seat them there",H&&!B?` (suggested for ${I}: ${(0,l.tableNumbers)(H)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(C)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,O.jsx)(T.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${B?` \xb7 ${(0,l.tableNumbers)(B)}`:''}`,disabled:X,onPress:()=>{Z()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,O.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[Q,ee]}):(0,O.jsxs)(O.Fragment,{children:[Q,ee]}),(0,O.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[U?(0,O.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>q(!0)}),(0,O.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,O.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function W({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,p.useCtx)(15e3),i=M(o,n),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(n)),t,e.partySize,n,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,n.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),B=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&N(o,l),t()},R=C?(0,O.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,O.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,O.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,O.jsx)(b.default,{testID:"combine-short",children:(0,O.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,O.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>L(I)}),(0,O.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,O.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${F(e)}`,testID:"assign-table-sheet",footer:R,children:[v&&!C?(0,O.jsx)(b.default,{testID:"assign-suggested",children:(0,O.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,O.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,O.jsx)(A,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await L([e])}})]})}function E(e){(0,i.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${F(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function _({date:e,onClose:t,wide:i,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:B}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,F]=(0,r.useState)(ee.blocks),[R,W]=(0,r.useState)(!1),[E,_]=(0,r.useState)(''),[H,U]=(0,r.useState)(2),[q,V]=(0,r.useState)(null),[Y,G]=(0,r.useState)(''),[K,Q]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ne=(0,S.usePlan)(u),ie=(0,P.dogSetUp)(ne),re=!0===te.dog&&ie,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(H,c.settings.turnMins),be=A.filter(e=>e.date===M),ge=e=>(0,k.freeTablesAt)(ne,be,H,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(L,u,M,e)}),he=re&&q?ge(q):[];(0,r.useEffect)(()=>{ae(null)},[re,q,H]);const pe=(0,y.bookingSlots)(c,ue,e=>A.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),H,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0)),me=(0,w.ukPhone)(K),[fe,ye]=(0,r.useState)(!1),ke=q?pe.find(e=>e.time===q):void 0,xe=ke&&ke.left=2&&!!q&&(!xe||fe)&&(0,o.validParty)(H)&&me.ok&&(0,w.emailOk)(X)&&(!je||we&&R)&&(!re||he.length>0)&&!Te,ve=te.wheelchair>0||te.stepFree;return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:i?760:void 0,testID:"booking-sheet",children:[(0,O.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:H,audience:"staff"}),te.dog&&!ie?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(F(e),V(null),W(!1))}}),(0,O.jsxs)(T.Row,{gap:6,children:[(0,O.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,O.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,O.jsx)(T.Field,{label:"Name",value:E,onChangeText:_,placeholder:"e.g. Reid",testID:"nb-name"}),(0,O.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:K,onChangeText:Q,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&K?(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,O.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,O.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(T.T,{center:!0,children:"Covers"}),(0,O.jsx)(s.PartySizeInput,{value:H,onChange:e=>{U(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!ge(e.time).length||!(0,D.dogTimeOk)(c,A,M,e.time,de);return(0,O.jsx)(T.Chip,{label:e.time,sub:(0,v.blockAt)(L,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':e.left>0?`${e.left} left`:'Full',disabled:(e.past??!e.available)||t,selected:q===e.time,onPress:()=>{V(e.time),W(!1),ye(!1)}},e.time)})}),xe?(0,O.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(H,xe.left,xe.time)}),(0,O.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&q?(0,O.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,O.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,O.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ne.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),he.length?(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:he.slice(0,10).map((e,t)=>(0,O.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${ve&&(0,P.accessibleSetUp)(ne)&&!(0,P.isAccessible)(ne,e.table)?' \xb7 not step-free':''}`,selected:(le??he[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",H," at ",q,". Try another time."]})]}):null,je?(0,O.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",je.from,"\u2013",je.to,je.reason?` (${je.reason})`:'']}),we?(0,O.jsx)(T.Chip,{label:R?'Manager override on':'Override and book anyway',selected:R,onPress:()=>W(e=>!e)}):(0,O.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,O.jsx)(b.default,{testID:"nb-closed",children:(0,O.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,O.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:H,date:M,time:q,today:(0,x.ymd)(h),bookings:A,audience:"staff",showTables:!1!==c.settings.tableRequests}),ve&&!(0,P.accessibleSetUp)(ne)?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(T.Field,{label:"Notes (optional)",value:Y,onChangeText:G,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,n.depositDue)((0,n.depositOf)(c.settings),H)?(0,O.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(c.settings),H))," (",(0,a.gbp)((0,n.depositOf)(c.settings).perPersonPence)," per person for ",(0,n.depositOf)(c.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,O.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),Te?(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",q,". Try another time: dogs are very welcome then."]}):null,(0,O.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Se,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||he.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:H,date:M,time:q,notes:Y.trim(),security:(0,n.depositDue)((0,n.depositOf)(c.settings),H)?'deposit':'none',depositPaid:0,...(0,n.depositDue)((0,n.depositOf)(c.settings),H)?{depositDue:(0,n.depositDue)((0,n.depositOf)(c.settings),H),depositPolicy:(0,n.depositWords)((0,n.depositOf)(c.settings),H,c.name).join(' '),depositRefundable:(0,n.depositOf)(c.settings).refundable,depositCutoffHours:(0,n.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??he[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,B)).catch(()=>{}),d?.({date:M,time:q,name:E.trim()}),t()}})]})}},1096,[796,1097,1098,829,836,14,1099,34,828,402,102,846,1100,848,1104,1079,827,840,833,794,1014,1011,1105,1106,1111,1081,1075,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1097,[34,402,412,102,1098,840,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const f=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(f)?f:u))},f=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),b=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`},1098,[]); -__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{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]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); +__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); __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 c.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return c.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return D}}),_e.useShiftManager=b,_e.useSignedIn=h,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(w),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),c=h(),m=o||'staff'===s.APP_VARIANT,y=(0,t.useContext)(D),O=b(),S=m?y&&O?'manager':'staff':c?p(i,l(c)):i,M=(0,r.useOwner)(e=>e.staff),A=(0,n.useRestaurant)(u),P=(0,n.useNow)(e),I=c?c.id:m&&f?f:d[S],R=M.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:A,now:P,role:S,me:R,meId:I,today:(0,a.venueYmd)(P),signedIn:!!c}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return S}}),_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()-O(n));const c=(0,a.ymd)(f),d=(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===O(t)&&e.date>=c&&e.date<=d&&!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,c=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,...c})})}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 M}}),_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()-O(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=h(),t=(0,r.useOwner)(e=>e.hourly);return e?t:A};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]),c=_r(_d[10]);const d={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=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,p=(e,t)=>m[e]>m[t]?t:e,w=(0,t.createContext)(!1),y=()=>(0,t.useContext)(w),D=(0,t.createContext)(!1);function b(){const e=(0,t.useContext)(w)||'staff'===s.APP_VARIANT,n=h(),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 h(){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 O=e=>(e.getDay()+6)%7,S=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const M=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const A={}},1100,[806,34,848,865,827,846,985,1101,997,15,1103]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); __d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[1103]); @@ -1222,7 +1222,7 @@ __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1139,[931,974,985,975]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1140,[1129,982,34,379,102,794,865,988,836,840,1100,1124,1018,1141,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1141,[796,804,982,34,379,236,402,102,794,1016,981,983,836,1017,840,1124,25]); -__d(function(g,_r,_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:u,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),f=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,o.useLiveState)();if('ready'!==$)return(0,p.jsx)(o.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,p.jsxs)(n.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface,padding:u?10:12,gap:6},b],children:[(0,p.jsxs)(r.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:u?1:void 0},children:[(0,p.jsxs)(i.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:["LIVE \xb7 ",I]}),(0,p.jsx)(i.T,{size:12,colour:c.colours.muted,children:"Tap to update \u203a"})]}),(0,p.jsx)(i.Row,{gap:u?14:18,style:{flex:u?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,p.jsx)(i.T,{size:u?42:34,weight:"bold",colour:s<=0?c.colours.red:o?c.colours.amber:c.colours.text,style:{lineHeight:u?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,p.jsxs)(i.T,{size:13,colour:o?c.colours.amber:c.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!u&&L.length?(0,p.jsxs)(n.default,{testID:"shellfish-low",style:{backgroundColor:c.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,p.jsxs)(i.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.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,p.jsx)(i.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,u||L.length||!h?null:(0,p.jsx)(r.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,p.jsx)(i.T,{size:13,colour:c.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,p.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:u=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,f]=(0,s.useState)(!1);if(!h.items.length)return null;const x=u>=80,w=Math.max(28,Math.min(52,Math.round(.6*u))),C=Math.max(22,Math.min(34,Math.round(.42*u)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.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:()=>f(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:u,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,r=b[t.key]??0,d=Math.max(0,o-r),y=d<=0,f=y||h.isLow(t.key);return(0,p.jsxs)(n.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:f?'rgba(255,107,94,0.07)':'transparent',...l.look.web(f?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,p.jsx)(i.T,{size:C,children:t.icon}),(0,p.jsx)(i.T,{size:w,weight:"bold",colour:f?'#FF8E82':c.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,p.jsxs)(n.default,{style:{gap:0},children:[(0,p.jsx)(i.T,{size:x?15:13,weight:"semibold",colour:f?'#FFB3AA':c.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),f&&u>=60?(0,p.jsx)(i.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,p.jsxs)(i.T,{size:x?14:12,weight:"semibold",colour:r?c.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,r)]})]})]},t.key)})}),y?(0,p.jsx)(j,{rid:e,by:t,app:o,onClose:()=>f(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=w,_e.SundayRoastChip=function(e){return(0,p.jsx)(w,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_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]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]);const f=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,u.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:r,onOrder:u,group:h}){const b=(0,d.useShellfish)(e,o,l,h),y='roast'===h,[k,j]=(0,s.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,k[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):k,[C,S]=(0,s.useState)(null),$=x(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&j(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=k[e.key]&&k[e.key]!==Math.round(b.counts[e.key]??0));return(0,p.jsxs)(i.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,p.jsx)(i.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,p.jsxs)(n.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface2},children:[(0,p.jsxs)(i.T,{center:!0,size:13,colour:c.colours.muted,children:[s.icon," ",s.plural]}),(0,p.jsx)(i.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?c.colours.amber:c.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,p.jsx)(i.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,p.jsx)(i.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,p.jsx)(n.default,{style:{minHeight:52}})]},s.key)})}),(0,p.jsx)(i.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,a.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,a.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,p.jsx)(i.Banner,{kind:"success",title:C}):null,(0,p.jsxs)(n.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:c.colours.gold,backgroundColor:c.colours.goldTint},children:[(0,p.jsx)(i.T,{weight:"semibold",colour:c.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,p.jsxs)(i.Row,{gap:10,children:[(0,p.jsxs)(i.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,p.jsx)(i.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,w[s.key]||0)}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,p.jsx)(i.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=k[e.key]&&b.recount(e.key,Math.max(0,Math.round(k[e.key])))}),j({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,p.jsx)(i.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),j({})},style:{minHeight:54}})]}),u?(0,p.jsx)(i.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:u}):null,(0,p.jsxs)(n.default,{style:{gap:2},children:[(0,p.jsx)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,p.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(i.T,{size:13,style:{flex:1},children:(0,a.describe)(e,b.itemOf(e.kind))}),(0,p.jsxs)(i.Muted,{children:[f(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,p.jsx)(i.Row,{wrap:!0,gap:6,children:b.synced?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"ok",label:"Shared live"}),(0,p.jsx)(i.Muted,{children:"Every paired device sees the same count."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"neutral",label:"Saved on this device"}),(0,p.jsx)(i.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function w({rid:e,by:t,app:o,size:u="m",group:b}){const y=(0,d.useShellfish)(e,t,o,b),f=k(e),[x,w]=(0,s.useState)(!1),C=(0,h.useNow)(3e4);if(!y.items.length)return null;if('roast'===b&&!(0,a.isSundayIn)(C))return null;const S='m'===u?20:17,$='xs'!==u;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.default,{testID:'roast'===b?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===b?'Sunday roast: ':''}${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(y.counts[t.key]??0)-(f[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>w(!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:y.items.map((t,s)=>{const o=y.counts[t.key]??0,l=f[t.key]??0,r=Math.max(0,o-l),d=r<=0,u=d||y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,r)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:u?'rgba(255,107,94,0.10)':'transparent'},children:[(0,p.jsx)(i.T,{size:S-2,children:t.icon}),(0,p.jsx)(i.T,{size:S,weight:"bold",colour:d?c.colours.red:u?c.colours.amber:c.colours.text,style:{lineHeight:S+4},children:(0,a.fmtStockCount)(e,t,r)}),$&&(l||d||u)?(0,p.jsx)(i.T,{size:10,weight:"semibold",colour:d||u?'#FFB3AA':c.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),x?(0,p.jsx)(j,{rid:e,by:t,app:o,group:b,onClose:()=>w(!1)}):null]})}},1142,[982,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); +__d(function(g,_r,_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=x,_e.ShellfishTile=function({rid:e,by:t,app:s,big:r,onOrder:c,style:b}){const y=(0,u.useShellfish)(e,t,s),p=x(e),[k,C]=(0,o.useState)(!1),S=j(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,l.useLiveState)();if('ready'!==$)return(0,f.jsx)(l.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(i.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface,padding:r?10:12,gap:6},b],children:[(0,f.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:r?1:void 0},children:[(0,f.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:["LIVE \xb7 ",I]}),(0,f.jsx)(a.T,{size:12,colour:h.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(a.Row,{gap:r?14:18,style:{flex:r?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)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(a.T,{size:r?42:34,weight:"bold",colour:s<=0?h.colours.red:o?h.colours.amber:h.colours.text,style:{lineHeight:r?50:42},children:(0,d.fmtStockCount)(e,t,s)}),(0,f.jsxs)(a.T,{size:13,colour:o?h.colours.amber:h.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.goldLight,children:["Reserved: ",(0,d.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,d.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!r&&L.length?(0,f.jsxs)(i.default,{testID:"shellfish-low",style:{backgroundColor:h.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.map(t=>`${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,d.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),c?(0,f.jsx)(a.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:c}):null]}):null,r||L.length||!c?null:(0,f.jsx)(n.default,{accessibilityRole:"button",onPress:c,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(a.T,{size:13,colour:h.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),k?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>C(!1),onOrder:c?()=>{C(!1),c()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:l=76}){const c=(0,u.useShellfish)(e,t,s),b=x(e),[y,p]=(0,o.useState)(!1);if(!c.items.length)return null;const k=l>=80,j=Math.max(28,Math.min(52,Math.round(.6*l))),C=Math.max(22,Math.min(34,Math.round(.42*l)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${c.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,c.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:l,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...r.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:c.items.map((t,s)=>{const o=c.counts[t.key]??0,n=b[t.key]??0,u=Math.max(0,o-n),y=u<=0,p=y||c.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,u)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:k?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...r.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)(a.T,{size:C,children:t.icon}),(0,f.jsx)(a.T,{size:j,weight:"bold",colour:p?'#FF8E82':h.colours.text,style:{lineHeight:Math.round(1.15*j),letterSpacing:-.5,minWidth:Math.round(.85*j),textAlign:'center'},children:(0,d.fmtStockCount)(e,t,u)}),(0,f.jsxs)(i.default,{style:{gap:0},children:[(0,f.jsx)(a.T,{size:k?15:13,weight:"semibold",colour:p?'#FFB3AA':h.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&l>=60?(0,f.jsx)(a.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,d.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(a.T,{size:k?14:12,weight:"semibold",colour:n?h.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,d.fmtStockCount)(e,t,n)]})]})]},t.key)})}),y?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=w,_e.ShellfishChip=C,_e.SundayRoastChip=function(e){return(0,f.jsx)(C,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),r=_r(_d[4]),n=e(_r(_d[5])),i=e(_r(_d[6])),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]),f=_r(_d[15]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function x(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.ymd)((0,b.useNow)(6e4));return(0,y.reservedOn)(t,o,(0,y.reservablesOf)(s))}function j(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function w({rid:e,by:s,app:l,onClose:r,onOrder:n,group:c}){const b=(0,u.useShellfish)(e,s,l,c),y='roast'===c,[p,x]=(0,o.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,p[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):p,[C,S]=(0,o.useState)(null),$=j(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&x(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=p[e.key]&&p[e.key]!==Math.round(b.counts[e.key]??0));return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,f.jsx)(a.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,f.jsxs)(i.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(a.T,{center:!0,size:13,colour:h.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(a.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?h.colours.amber:h.colours.text,style:{lineHeight:56},children:(0,d.fmtStockCount)(e,s,o)}),(0,f.jsx)(a.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(a.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(i.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(a.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,d.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,d.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,f.jsx)(a.Banner,{kind:"success",title:C}):null,(0,f.jsxs)(i.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,f.jsx)(a.T,{weight:"semibold",colour:h.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsxs)(a.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(a.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,d.fmtStockCount)(e,s,w[s.key]||0)}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,f.jsx)(a.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=p[e.key]&&b.recount(e.key,Math.max(0,Math.round(p[e.key])))}),x({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,f.jsx)(a.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,d.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),x({})},style:{minHeight:54}})]}),n?(0,f.jsx)(a.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:n}):null,(0,f.jsxs)(i.default,{style:{gap:2},children:[(0,f.jsx)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,style:{flex:1},children:(0,d.describe)(e,b.itemOf(e.kind))}),(0,f.jsxs)(a.Muted,{children:[k(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:b.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(a.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(a.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function C({rid:e,by:t,app:l,size:c="m",group:y}){const p=(0,u.useShellfish)(e,t,l,y),k=x(e),[j,C]=(0,o.useState)(!1),S=(0,b.useNow)(3e4);if(!p.items.length)return null;if('roast'===y&&!(0,d.isSundayIn)(S))return null;const $='m'===c?20:17,L='xs'!==c;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:'roast'===y?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===y?'Sunday roast: ':''}${p.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,Math.max(0,(p.counts[t.key]??0)-(k[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>C(!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)',...r.look.web({cursor:'pointer'})}),children:p.items.map((t,o)=>{const l=p.counts[t.key]??0,r=k[t.key]??0,n=Math.max(0,l-r),u=n<=0,c=u||p.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,n)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(a.T,{size:$-2,children:t.icon}),(0,f.jsx)(a.T,{size:$,weight:"bold",colour:u?h.colours.red:c?h.colours.amber:h.colours.text,style:{lineHeight:$+4},children:(0,d.fmtStockCount)(e,t,n)}),!L||!(r||u||c)||u&&s.IS_CAR?null:(0,f.jsx)(a.T,{size:10,weight:"semibold",colour:u||c?'#FFB3AA':h.colours.goldLight,children:u?'none left':r?`${(0,d.fmtStockCount)(e,t,r)} res`:'low'})]},t.key)})}),j?(0,f.jsx)(w,{rid:e,by:t,app:l,group:y,onClose:()=>C(!1)}):null]})}},1142,[982,846,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); __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}},1143,[5,797,841,798,236,844]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,x.jsxs)(r.default,{style:{gap:12},children:[(0,x.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,x.jsx)(y,{}):'take'===t?(0,x.jsx)(j,{}):(0,x.jsx)(f,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]);function y(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[y,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===y?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,x.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,x.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,x.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,x.jsx)(p.Seg,{value:y,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,x.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,x.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,x.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,x.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,x.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,x.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,x.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function j(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[y,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=y[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,x.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,x.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,x.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,x.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,x.jsx)(o.T,{size:16,children:e.name}),(0,x.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,x.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:y[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(y[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:y[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,x.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,x.jsx)(o.Muted,{children:"\u2014"}):(0,x.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,x.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,x.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,x.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function f(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,x.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,x.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,x.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,x.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,x.jsx)(v,{id:e.id,me:t}):null]},e.id)})]})}function v({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[y,j]=(0,l.useState)(b.lines.map(e=>({...e}))),f=(e,t)=>j(i=>i.map(i=>i.ing===e?{...i,...t}:i)),v='expected'!==b.status,k=(0,l.useMemo)(()=>y.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),w=k.filter(e=>Math.abs(e.pct)>=.5),$=y.reduce((e,t)=>e+t.received*t.price,0);return(0,x.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[k.map(({l:e,i:i,short:l,pct:d})=>(0,x.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,x.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,x.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,x.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>f(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!v?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>f(e.ing,{price:100*(Number(t.replace(',','.'))||0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,x.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,x.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round($))]}),S.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[S.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,w.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[w.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,v?(0,x.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,x.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,y,i,[S.length?`${S.length} short`:'',w.length?`${w.length} price changes`:''].filter(Boolean).join(', '))})]})}},1144,[796,1016,1129,982,34,402,102,794,865,836,840,1124,1018,25]); __d(function(g,_r,_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,100][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:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,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))]})}},1145,[796,1146,34,402,102,426,794,865,836,827,840,1147,1100,1050,25]); @@ -1235,378 +1235,382 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1152,[34,402,102,1153,840,794,25]); __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])},1153,[34,900,25]); __d(function(g,_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 M}}),_e.allocate=O,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:T,now:C,today:S,role:k,meId:v,me:D}=(0,x.useCtx)(6e4),B=(0,u.useOwner)(e=>e.staff),F=(0,u.useOwner)(e=>e.attendance),N=(0,u.useOwner)(e=>e.shifts),R=(0,u.useOwner)(e=>e.tronc),E=(0,u.useOwner)(e=>e.troncCash),L=(0,u.useOwner)(e=>e.troncHistory),z=(0,u.useOwner)(e=>e.troncLog),_=(0,c.useOrders)(T),V=(0,j.useVenuePay)(T).pay,[q,H]=(0,i.useState)(-1),[U,W]=(0,i.useState)(''),[Y,K]=(0,i.useState)(!1),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(R.text),[Z,ee]=(0,i.useState)(null),te='staff'!==k,se='owner'===k,{s:oe,e:ie,key:ne}=(0,j.venueRange)(V,'tips',q,C),re=`${(0,h.niceDate)(oe)} \u2013 ${(0,h.niceDate)(ie)} ${ie.getFullYear()}`,le=L.find(e=>e.key===ne),ae=e=>u.useOwner.getState().setOwner({tronc:{...R,...e}}),de=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ce=Math.round((ie.getTime()-oe.getTime())/864e5)+1,ue=(0,i.useMemo)(()=>{let e=_.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(oe)&&e.createdAt.slice(0,10)<=(0,h.ymd)(ie)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!de)for(let t=0;tC)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ne,_.length,de]),pe=E[ne]??0,he=le?le.pot:ue+pe,me=(0,i.useMemo)(()=>{const e={};for(let t=0;tS)break;const o=(0,h.ymd)(s);B.forEach(t=>{const s=F.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ne,F.length,N.length,B.length]),fe=B.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&R.includeManagers||'owner'===e.role&&R.includeOwner)),ye=(0,i.useMemo)(()=>{if(le)return le.rows;const e=fe.map(e=>{const t=(me[e.id]?.paid??0)/60,s=R.points[M(e)]??1;return'hours'===R.method?t:'points'===R.method?t*s:'equal'===R.method?t>0?1:0:R.custom[e.id]??0}),{amounts:t}=O(he,e),s=e.reduce((e,t)=>e+t,0);return fe.map((o,i)=>({staffId:o.id,hours:(me[o.id]?.paid??0)/60,points:R.points[M(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[le,fe.map(e=>e.id).join(),me,R,he]),ge=ye.reduce((e,t)=>e+t.amount,0),xe=le?0:(()=>{const e=ye.map(e=>e.pct);return O(he,e).remainder})(),je=Object.entries(R.custom).filter(([e])=>fe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),be='custom'===R.method&&Math.abs(je-100)>.01,we=new Date(ie.getFullYear(),ie.getMonth()+2,0),Te=[...L].sort((e,t)=>t.end.localeCompare(e.end))[0],Ce=0!==L.length&&(0,h.parseYmd)(Te.end)<(0,h.addMins)(C,-89280),Se=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return`${I(t.name)},${M(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return te?(0,P.jsxs)(l.default,{style:{gap:10},children:[(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,P.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>H(q-1)}),(0,P.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,P.jsx)(d.T,{weight:"semibold",children:re}),le?(0,P.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${le.lockedAt}`}):q>=0?(0,P.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,P.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:q>=0,onPress:()=>H(q+1)})]}),(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Card tips on orders"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.card:ue)})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Cash tips"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.cash:pe)})]}),le?null:(0,P.jsxs)(d.Row,{gap:6,children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:U,onChangeText:W,style:[d.styles.input,{flex:1}]}),(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(U)>=0)||''===U.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...E,[ne]:Math.round(100*Number(U))}}),W('')}})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,P.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(he)})]}),(0,P.jsx)(d.Muted,{children:de?'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).'})]}),le?(0,P.jsxs)(d.Muted,{children:["Locked with method: ",$[le.method],"."]}):(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,P.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,P.jsx)(d.Chip,{label:$[e],selected:R.method===e,onPress:()=>se&&ae({method:e})},e))}),se?null:(0,P.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===R.method?Object.entries(R.points).map(([e,t])=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:e}),(0,P.jsx)(d.Row,{gap:6,children:(0,P.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>se&&ae({points:{...R.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===R.method?(0,P.jsxs)(P.Fragment,{children:[fe.map(e=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,P.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(R.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ae({custom:{...R.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ae({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,P.jsxs)(d.T,{size:13,colour:be?m.colours.red:m.colours.ok,children:["Total ",je.toFixed(1),"%",be?' (must be 100%)':' \u2713']})]}):null,(0,P.jsx)(d.Toggle,{label:"Include managers",value:R.includeManagers,onChange:e=>se&&ae({includeManagers:e})}),(0,P.jsx)(d.Toggle,{label:"Include owner",value:R.includeOwner,onChange:e=>se&&ae({includeOwner:e})}),R.includeOwner?(0,P.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,P.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,P.jsxs)(d.T,{center:!0,children:["Points: ",'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013']}),(0,P.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,P.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,P.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(ge)]})]}):(0,P.jsx)(r.default,{horizontal:!0,children:(0,P.jsxs)(l.default,{children:[(0,P.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,P.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,P.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,P.jsx)(d.T,{size:13,style:{width:54},children:'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013'}),(0,P.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,P.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,P.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,P.jsx)(d.T,{size:13,weight:"bold",colour:ge===he?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(ge)})]})]})}),(0,P.jsxs)(d.Muted,{children:[ge===he?`\u2713 Total equals the pot (${(0,p.gbp)(he)}).`:'\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."]}),le?null:(0,P.jsx)(d.Button,{label:"Approve & lock period",disabled:!se||q>=0||be||ge!==he||he<=0,onPress:()=>{const e=`${(0,h.niceDate)(C)} ${C.toTimeString().slice(0,5)}`,t={id:`tp-${ne}`,key:ne,label:re,end:(0,h.ymd)(ie),pot:he,card:ue,cash:pe,method:R.method,rows:ye,lockedAt:e,by:D};u.useOwner.getState().setOwner({troncHistory:[t,...L],troncLog:[{id:`tl-${Date.now()}`,at:C.toISOString(),text:`${D} approved & locked tips for ${re}: ${(0,p.gbp)(he)} split ${$[R.method].toLowerCase()} between ${ye.filter(e=>e.amount>0).length} staff`},...z]})}}),!le&&q>=0?(0,P.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,se||le?null:(0,P.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),le?(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:le.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!le.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${re} approved: ${(0,p.gbp)(le.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:L.map(e=>e.id===le.id?{...e,shared:(0,h.niceDate)(C)}:e)}),ee('Posted to All staff chat.')}}):null]}),Z?(0,P.jsx)(d.Banner,{kind:"info",title:Z}):null,(0,P.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,P.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(he)} = allocated ${(0,p.gbp)(ge)}`],[R.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Ce,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(we)} ${we.getFullYear()}`],[!0,'Tip records kept for 3 years',`${L.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,P.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,P.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,P.jsxs)(l.default,{style:{flex:1},children:[(0,P.jsx)(d.T,{size:14,children:t}),(0,P.jsx)(d.Muted,{children:s})]})]},String(t))),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{X(R.text),Q(!0)}})]}),(0,P.jsx)(y.SectionHead,{title:"Tip history & audit log"}),L.map(e=>(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"semibold",children:e.label}),(0,P.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,P.jsxs)(d.Muted,{children:[$[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,P.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),L.length||z.length?null:(0,P.jsx)(d.Muted,{children:"No approved periods yet."}),(0,P.jsxs)(d.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,P.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,P.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Se.map((e,t)=>(0,P.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,P.jsxs)(d.Muted,{children:[re," \xb7 ",$[le?.method??R.method]]})]}),(0,P.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tipping policy",children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:se,value:J,onChangeText:X,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),se?(0,P.jsx)(d.Button,{label:"Save policy",onPress:()=>{ae({text:J}),Q(!1)}}):null,(0,P.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,P.jsx)(A,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||B()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${D(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${D(i)}`;return(0,P.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(R,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,P.jsx)(R,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=A;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},M=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',I=e=>(e??'').replace(' (example)','');function O(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const D=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function B(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const F={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,k.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),B()?{pot:F.pot,today:F.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function R({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${D(s)}`;return(0,P.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,P.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,P.jsx)(d.Muted,{center:!0,children:o}):(0,P.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:D(s)})]})}function A(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,P.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,P.jsx)(R,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,P.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,P.jsx)(R,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1154,[798,796,806,34,402,295,102,426,794,848,865,836,827,840,1135,1147,1100,1050,1119,985,1024,1048,13,1049,2,25]); -__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,D.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,D.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),w=(0,f.useOwner)(e=>e.swaps),[v,$]=(0,l.useState)(0),[M,O]=(0,l.useState)(null),[R,P]=(0,l.useState)(null),[z,A]=(0,l.useState)('week'),[N,F]=(0,l.useState)(''),[K,U]=(0,l.useState)(''),[G,X]=(0,l.useState)(''),J='staff'!==t,Q=(0,y.addMins)(_(e),7*v*1440);Q.setHours(0,0,0,0);const Z=q(Q),ee=Z.sales,te='none'===Z.mode,se=Array.from({length:7},(e,t)=>{const s=new Date(Q);return s.setDate(Q.getDate()+t),(0,y.ymd)(s)}),ne=(0,f.visibleShifts)(i,J).filter(e=>e.date>=se[0]&&e.date<=se[6]),ae=(()=>{const e=new Date(Q);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),oe=ne.filter(e=>!e.published||e.changed).length,ie=i.filter(e=>e.date>=ae&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),re=se.map(e=>ne.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(h[s.staffId]??0);var s},0)),de=re.reduce((e,t)=>e+t,0),ce=ee.reduce((e,t)=>e+t,0),ue=(e,t)=>t?Math.round(e/t*100):0,he=J?o:o.filter(e=>e.id===n),fe=(0,a.useNarrow)(),me=Math.max(0,se.indexOf((0,y.ymd)(e))),[pe,xe]=(0,l.useState)(null),ge=pe??me,je=(e,t)=>!fe||t===ge,be=fe?150:74;return(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(u.Chip,{label:`Swaps & leave (${w.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(u.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(v-1),O(null)}}),(0,H.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(Q)]}),(0,H.jsxs)(u.Muted,{children:[0===v?'This week':1===v?'Next week':-1===v?'Last week':v>0?`In ${v} weeks`:-v+" weeks ago",J?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(v+1),O(null)}})]}),J?(0,H.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ie?` (${ie})`:''),disabled:!ie,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(ae,se[0]);O(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,H.jsx)(u.Button,{small:!0,kind:"success",label:oe?`Publish ${oe} ${1===oe?'change':'changes'}`:'Week published',disabled:!oe,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(se[0]);O(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),oe?(0,H.jsx)(u.Badge,{kind:"amber",label:`${oe} unpublished`}):ne.length?(0,H.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,M?(0,H.jsx)(u.Banner,{kind:"success",title:M}):null,fe?(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(u.Chip,{label:`${e} ${(0,y.parseYmd)(se[t]).getDate()}`,selected:t===ge,onPress:()=>xe(t)},e))}):null,(0,H.jsx)(d.default,{horizontal:!fe,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(c.default,{style:{gap:4},children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsxs)(u.T,{size:12,weight:"semibold",colour:se[s]===(0,y.ymd)(e)?S.colours.gold:S.colours.text,children:[t," ",(0,y.parseYmd)(se[s]).getDate()]})},t)).filter(je)]}),he.map(e=>(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(ne,e.id,se[s]),a=(m[e.id]??[]).includes(s),o=le(e.id,se[s]);return(0,H.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!J,onPress:()=>P({staffId:e.id,date:se[s],shift:n}),style:{width:be,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?S.colours.gold:S.colours.amber:S.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:o?'Leave':a?'Unavail.':J?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(u.T,{size:9,colour:S.colours.red,children:o?'on leave!':'unavailable'}):n&&J&&(!n.published||n.changed)?(0,H.jsx)(u.T,{size:9,colour:S.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(je)]},e.id)),J?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour"})}),re.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:'example'===Z.mode?'Fcst sales (ex.)':'Fcst sales'})}),ee.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour %"})}),re.map((e,t)=>{const s=ue(e,ee[t]);return(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,weight:"semibold",colour:ee[t]?s>32?S.colours.red:s>26?S.colours.amber:S.colours.ok:S.colours.muted,children:ee[t]?`${s}%`:'\u2013'})},t)}).filter(je)]})]}):null]})}),!J&&n?(0,H.jsx)(c.default,{testID:"rota-team-on",children:(0,H.jsx)(u.Card,{children:se.map((e,t)=>(0,H.jsx)(x.TeamOnDay,{date:e,meId:n,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(je)})}):null,J&&te?(0,H.jsx)(u.Card,{children:(0,H.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(c.default,{testID:"labour-week-cost",children:(0,H.jsx)(u.T,{weight:"semibold",children:(0,k.gbp)(de)})})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===Z.weeks?'1 week':`${Z.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),Z.booked?(0,H.jsx)(c.default,{testID:"labour-booked",children:(0,H.jsxs)(u.T,{children:["Booked so far: ",Z.booked," Covers this week"]})}):null]})}):null,J&&!te?(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(u.Row,{gap:6,children:['example'===Z.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(u.Badge,{kind:ue(de,ce)>30?'red':'ok',label:`${ue(de,ce)}% this week`})]})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(ce)," forecast sales. Target 25\u201330%. ",'example'===Z.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=ue(re[5],ee[5]);return e&&e<24?(0,H.jsxs)(u.T,{size:14,colour:S.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,J?(0,H.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>J||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,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(e=>L(s,e)).map(t=>(0,H.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,H.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,I.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),J?null:(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(u.Muted,{testID:"swap-dept-note",children:(0,j.isAnchorageVenue)(b.VENUE_RID)?j.ANCHORAGE_SWAP_NOTE:Y(o.find(e=>e.id===n))?j.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ne.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,I.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>L(o.find(e=>e.id===n),e)).map(t=>(0,H.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)}),ne.some(e=>e.staffId===n)?null:(0,H.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(C.SectionHead,{title:"Holiday & leave"}),p.filter(e=>J||e.staffId===n).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,H.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)((0,y.parseYmd)(e.from))," \u2013 ",(0,y.niceDate)((0,y.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Request leave",J?' (as yourself)':'']}),(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:N,onChangeText:F,style:[u.styles.input,{flex:1}]}),(0,H.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:K,onChangeText:U,style:[u.styles.input,{flex:1}]})]}),(0,H.jsx)(u.Field,{label:"Reason",value:G,onChangeText:X}),(0,H.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(N)||!/^\d{4}-\d{2}-\d{2}$/.test(K)||K{f.useOwner.getState().addLeave({staffId:n,from:N,to:K,reason:G.trim()||'Holiday'}),F(''),U(''),X('')}})]})]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",J?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),he.filter(e=>'owner'!==e.role||!J).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{gap:8,children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(u.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,H.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,D.useCtx)(5e3),x=((0,v.useClockArea)(e=>e.areas[m]),(0,v.areaOf)(m));const j=(0,$.privateClockVenue)(m),[b,w]=(0,l.useState)(!1),k=(0,f.useOwner)(e=>e.consent[a]),C=(0,f.useOwner)(e=>e.attendance),I=(0,f.useOwner)(e=>e.shifts),[B,z]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,N]=(0,l.useState)(null),[F,E]=(0,l.useState)(void 0),[W,_]=(0,l.useState)(null),[q,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=C.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)(I,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,M.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),N(null),E(void 0);const l=await(0,O.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(_(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&_(null),!0):(N(l.message),E(l.fix),(0,R.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 k?(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(T.StaffAvatar,{id:a,size:48}),(0,H.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,H.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(c.default,{testID:"clock-area-line",children:(0,H.jsx)(u.T,{size:14,colour:S.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,H.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(c.default,{testID:"on-break",children:(0,H.jsxs)(u.T,{size:15,weight:"semibold",colour:S.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.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,H.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,H.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'):(N(null),z(!0))}})]}):(0,H.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(c.default,{testID:"clock-message",children:(0,H.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===F?(0,H.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===F?(0,H.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===F?(0,H.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,M.areaSet)(x)?(0,H.jsx)(c.default,{testID:"clock-area-warning",children:(0,H.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,H.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(u.T,{size:14,colour:S.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.T,{weight:"semibold",colour:S.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(u.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.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,H.jsx)(u.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(c.default,{style:{gap:12},children:[(0,H.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,H.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,H.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:()=>{w(!1),ae('in')}}),(0,H.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:m,today:t,now:e}):null,G?(0,H.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,H.jsx)(u.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,M.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.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,H.jsx)(c.default,{style:{gap:10},children:(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.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,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.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,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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]),S=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),v=_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]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const Y=e=>(0,j.deptKey)(e?.dept),L=(e,t)=>(0,j.canSwapWith)(e,t,b.VENUE_RID),N=2650,F=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,z.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,w.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*N+t.restOfDay.takeaway*F:0})}},[s,a,o,i,r,(0,y.ymd)(e)])}function V({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,H.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,H.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,H.jsx)(u.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{children:"Start"}),(0,H.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:"End"}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:i,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.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,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:D.fmtH,label:"Break time"}),(0,H.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,H.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,H.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,H.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,H.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({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,D.useSignedIn)(),{me:i,meId:r}=(0,D.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),w=s=>{if(!d)return;const a=(0,O.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,R.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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,b]=(0,l.useState)(h?Math.round(60*h.start):720),[w,k]=(0,l.useState)(h?Math.round(60*h.end):1200),[C,I]=(0,l.useState)(''),[T,v]=(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&&w<=j,P=(e,t)=>(0,H.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return T?(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.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,H.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,D.fmtH)(h.start)}\u2013${(0,D.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,y.hm)(new Date(c.in))}\u2013${c.out?(0,y.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,O?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(u.Field,{label:"Note for your manager (optional)",value:C,onChangeText:I,placeholder:"e.g. phone died",maxLength:200}),(0,H.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,w):void 0,note:C.trim(),at:t.toISOString()}),v(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.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,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(c.default,{children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(u.T,{size:28,weight:"bold",colour:S.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(u.T,{size:18,weight:"semibold",colour:w?S.colours.amber:S.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.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,H.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(C.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsxs)(u.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.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,H.jsx)(C.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,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(u.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.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,H.jsxs)(u.T,{size:13,colour:S.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,H.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,D.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,j]=(0,l.useState)(s),[b,w]=(0,l.useState)(null),[I,v]=(0,l.useState)(!1),$=!!(0,D.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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),B=P.filter(f.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),Y=B.reduce((t,s)=>t+(0,D.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(B.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,D.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,D.fmtH)(a.start)}-${(0,D.fmtH)(a.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.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,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(u.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(u.T,{size:13,colour:S.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(u.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(a.WideTable,{children:(0,H.jsxs)(c.default,{style:{gap:2},children:[(0,H.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:S.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(u.T,{size:12,weight:"semibold",colour:S.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,D.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(T.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:l?`${(0,D.fmtH)(l.start)}\u2013${(0,D.fmtH)(l.end)}`:'\u2013'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?S.colours.ok:'open'===(0,f.attStatus)(t)?S.colours.blue:S.colours.amber,children:(0,m.statusLabel)(t)}),(0,H.jsx)(u.T,{size:11,style:{width:140},colour:c.length?S.colours.amber:S.colours.ok,children:c.join(', ')||'OK'}),(0,H.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(u.T,{size:12,colour:S.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?S.colours.muted:S.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,H.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>v(!0)}),(0,H.jsx)(C.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(u.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(m.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(u.Sheet,{visible:I,onClose:()=>v(!1),title:"Payroll export",children:[(0,H.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(u.T,{size:10,colour:t?S.colours.text:S.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,796,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); +__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:s}=(0,D.useCtx)(6e4),a=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,h.useOwner)(e=>e.shifts),u=(0,D.useHourly)(),f=(0,h.useOwner)(e=>e.availability),m=(0,h.useOwner)(e=>e.leave),w=(0,h.useOwner)(e=>e.swaps),[T,$]=(0,i.useState)(0),[O,M]=(0,i.useState)(null),[R,P]=(0,i.useState)(null),[z,A]=(0,i.useState)('week'),[F,Y]=(0,i.useState)(!1),K=(0,D.useSignedIn)()?.name??'',U='staff'!==t,G=(0,y.addMins)(_(e),7*T*1440);G.setHours(0,0,0,0);const X=q(G),J=X.sales,Q='none'===X.mode,Z=Array.from({length:7},(e,t)=>{const s=new Date(G);return s.setDate(G.getDate()+t),(0,y.ymd)(s)}),ee=(0,h.visibleShifts)(o,U).filter(e=>e.date>=Z[0]&&e.date<=Z[6]),te=(()=>{const e=new Date(G);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),se=ee.filter(e=>!e.published||e.changed).length,ne=o.filter(e=>e.date>=te&&e.date!!(0,h.leaveOn)(m,e,t),oe=Z.map(e=>ee.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(u[s.staffId]??0);var s},0)),ie=oe.reduce((e,t)=>e+t,0),le=J.reduce((e,t)=>e+t,0),re=(e,t)=>t?Math.round(e/t*100):0,de=U?a:a.filter(e=>e.id===s),ce=(0,n.useNarrow)(),ue=Math.max(0,Z.indexOf((0,y.ymd)(e))),[he,fe]=(0,i.useState)(null),me=he??ue,pe=(e,t)=>!ce||t===me,xe=ce?150:74;return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(c.Chip,{label:`Swaps & time off (${w.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(c.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[!U&&s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-time-off"}):null,(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(T-1),M(null)}}),(0,H.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(c.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(G)]}),(0,H.jsxs)(c.Muted,{children:[0===T?'This week':1===T?'Next week':-1===T?'Last week':T>0?`In ${T} weeks`:-T+" weeks ago",U?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(T+1),M(null)}})]}),U?(0,H.jsxs)(c.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ne?` (${ne})`:''),disabled:!ne,testID:"rota-copy",onPress:()=>{const e=h.useOwner.getState().copyWeek(te,Z[0]);M(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,H.jsx)(c.Button,{small:!0,kind:"success",label:se?`Publish ${se} ${1===se?'change':'changes'}`:'Week published',disabled:!se,testID:"rota-publish",onPress:()=>{const e=h.useOwner.getState().publishWeek(Z[0]);M(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),se?(0,H.jsx)(c.Badge,{kind:"amber",label:`${se} unpublished`}):ee.length?(0,H.jsx)(c.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,O?(0,H.jsx)(c.Banner,{kind:"success",title:O}):null,ce?(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(c.Chip,{label:`${e} ${(0,y.parseYmd)(Z[t]).getDate()}`,selected:t===me,onPress:()=>fe(t)},e))}):null,(0,H.jsx)(r.default,{horizontal:!ce,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(d.default,{style:{gap:4},children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsxs)(c.T,{size:12,weight:"semibold",colour:Z[s]===(0,y.ymd)(e)?I.colours.gold:I.colours.text,children:[t," ",(0,y.parseYmd)(Z[s]).getDate()]})},t)).filter(pe)]}),de.map(e=>(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsxs)(c.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(c.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,h.shiftOf)(ee,e.id,Z[s]),a=(f[e.id]??[]).includes(s),o=ae(e.id,Z[s]);return(0,H.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!U,onPress:()=>P({staffId:e.id,date:Z[s],shift:n}),style:{width:xe,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?I.colours.gold:I.colours.amber:I.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(c.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:o?'Off':a?'Unavail.':U?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(c.T,{size:9,colour:I.colours.red,children:o?'on leave!':'unavailable'}):n&&U&&(!n.published||n.changed)?(0,H.jsx)(c.T,{size:9,colour:I.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(pe)]},e.id)),U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour"})}),oe.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:'example'===X.mode?'Fcst sales (ex.)':'Fcst sales'})}),J.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour %"})}),oe.map((e,t)=>{const s=re(e,J[t]);return(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,weight:"semibold",colour:J[t]?s>32?I.colours.red:s>26?I.colours.amber:I.colours.ok:I.colours.muted,children:J[t]?`${s}%`:'\u2013'})},t)}).filter(pe)]})]}):null]})}),!U&&s?(0,H.jsx)(d.default,{testID:"rota-team-on",children:(0,H.jsx)(c.Card,{children:Z.map((e,t)=>(0,H.jsx)(p.TeamOnDay,{date:e,meId:s,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(pe)})}):null,U&&Q?(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(d.default,{testID:"labour-week-cost",children:(0,H.jsx)(c.T,{weight:"semibold",children:(0,k.gbp)(ie)})})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(c.Muted,{children:`Forecasts start once CoverCharge has ${1===X.weeks?'1 week':`${X.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),X.booked?(0,H.jsx)(d.default,{testID:"labour-booked",children:(0,H.jsxs)(c.T,{children:["Booked so far: ",X.booked," Covers this week"]})}):null]})}):null,U&&!Q?(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(c.Row,{gap:6,children:['example'===X.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(c.Badge,{kind:re(ie,le)>30?'red':'ok',label:`${re(ie,le)}% this week`})]})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(le)," forecast sales. Target 25\u201330%. ",'example'===X.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=re(oe[5],J[5]);return e&&e<24?(0,H.jsxs)(c.T,{size:14,colour:I.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,U?(0,H.jsx)(c.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>U||e.fromId===s||e.toId===s).map(e=>{const t=o.find(t=>t.id===e.shiftId),s=a.find(t=>t.id===e.fromId),n=a.find(t=>t.id===e.toId);return(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(c.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:a.filter(e=>L(s,e)).map(t=>(0,H.jsx)(c.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{h.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,H.jsx)(c.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{h.useOwner.getState().setSwap(e.id,'approved');const s=e=>(a.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,C.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),U?null:(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(c.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(c.Muted,{testID:"swap-dept-note",children:(0,x.isAnchorageVenue)(j.VENUE_RID)?x.ANCHORAGE_SWAP_NOTE:N(a.find(e=>e.id===s))?x.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ee.filter(e=>e.staffId===s).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(d.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(c.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Ask for cover",onPress:()=>{h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,kind:'cover',note:'Can anyone cover?'}),(0,C.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(a.find(e=>e.id===s)?.name??'').replace(' (example)','')})`)}}),a.filter(e=>L(a.find(e=>e.id===s),e)).map(t=>(0,H.jsx)(c.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),ee.some(e=>e.staffId===s)?null:(0,H.jsx)(c.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(S.SectionHead,{title:"Holiday & time off"}),U?(0,H.jsx)(c.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>Y(!0)}):s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-requests-time-off"}):null,m.filter(e=>U||e.staffId===s).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,H.jsx)(c.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,H.jsxs)(c.Muted,{children:[(0,b.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,style:{justifyContent:'center'},children:[(0,H.jsx)(c.Button,{small:!0,label:"Approve",onPress:()=>h.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),U&&s?(0,H.jsx)(b.TimeOffSheet,{visible:F,onClose:()=>Y(!1),meId:s,me:K,manager:!0}):null]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Muted,{children:["Days each person can\u2019t work. ",U?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),de.filter(e=>'owner'!==e.role||!U).map(e=>(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{gap:8,children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(c.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(c.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(f[e.id]??[]).includes(s);return(0,H.jsx)(c.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>h.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:n,meId:r,me:u,r:f,rid:p}=(0,D.useCtx)(5e3),x=((0,T.useClockArea)(e=>e.areas[p]),(0,T.areaOf)(p));const j=(0,$.privateClockVenue)(p),[b,w]=(0,i.useState)(!1),k=(0,h.useOwner)(e=>e.consent[r]),S=(0,h.useOwner)(e=>e.attendance),C=(0,h.useOwner)(e=>e.shifts),[B,z]=(0,i.useState)(!1),[A,N]=(0,i.useState)(null),[L,F]=(0,i.useState)(null),[Y,E]=(0,i.useState)(void 0),[W,_]=(0,i.useState)(null),[q,V]=(0,i.useState)(!1),[G,X]=(0,i.useState)(null),J=S.filter(t=>t.staffId===r&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,h.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,h.visibleShifts)(C,'staff'!==n).find(e=>e.staffId===r&&e.date===t),ee='staff'!==n,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,O.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{N(s),F(null),E(void 0);const i=await(0,M.clockAction)(s,{rid:p,staffId:r,date:t,at:new Date(e.getTime()).toISOString(),...n});return N(null),i.ok?('out'===s&&i.att&&(_(i.att),(0,o.hrSettingsOf)(f.settings?.hr).on&&!a.useHr.getState().hasAnswered(p,i.att.id)&&X(i.att)),'in'===s&&_(null),!0):(F(i.message),E(i.fix),(0,R.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:i.message.split('. ')[0]+'.',body:i.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(v.StaffAvatar,{id:r,size:48}),(0,H.jsx)(c.T,{weight:"semibold",style:{flex:1},children:u})]}),(0,H.jsx)(c.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(c.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(d.default,{testID:"clock-area-line",children:(0,H.jsx)(c.T,{size:14,colour:I.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${f.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${f.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,H.jsxs)(c.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(c.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(d.default,{testID:"on-break",children:(0,H.jsxs)(c.T,{size:15,weight:"semibold",colour:I.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,h.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.jsx)(c.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,H.jsx)(c.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,H.jsx)(c.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),z(!0))}})]}):(0,H.jsx)(c.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(c.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,h.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(d.default,{testID:"clock-message",children:(0,H.jsx)(c.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===Y?(0,H.jsx)(c.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,O.areaSet)(x)?(0,H.jsx)(d.default,{testID:"clock-area-warning",children:(0,H.jsx)(c.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,H.jsx)(l.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(c.T,{size:14,colour:I.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(m.BreakRoomCard,{staffId:r,name:u,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.T,{weight:"semibold",colour:I.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(c.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.jsx)(c.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,H.jsx)(c.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(d.default,{style:{gap:12},children:[(0,H.jsxs)(c.T,{children:["We check once that you are at ",f.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,H.jsx)(c.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,H.jsx)(c.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{w(!1),ae('in')}}),(0,H.jsx)(c.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:p,today:t,now:e}):null,G?(0,H.jsx)(s.ShiftCheckout,{rid:p,shiftKey:G.id,day:G.date,meId:r,onClose:()=>X(null)}):null,(0,H.jsx)(c.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(d.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(c.Chip,{testID:`forgot-break-${e}`,label:(0,O.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.jsx)(c.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,H.jsx)(d.default,{style:{gap:10},children:(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",f.name,", within about ",x.radius," m."]}),(0,H.jsx)(c.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(c.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.jsx)(c.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 ",f.name," (within about ",x.radius," m)."]}),(0,H.jsx)(c.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.jsx)(c.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,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.jsx)(c.Button,{label:"I understand \u2014 continue",onPress:()=>h.useOwner.getState().giveConsent(r,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),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]),I=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const N=e=>(0,x.deptKey)(e?.dept),L=(e,t)=>(0,x.canSwapWith)(e,t,j.VENUE_RID),F=2650,Y=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,u.useBookings)(t),o=(0,u.useOrders)(t),l=(0,u.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,i.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),i=(0,z.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:i,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:i,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:i,booked:n,sales:t.map(e=>{const t=(0,w.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*F+t.restOfDay.takeaway*Y:0})}},[s,a,o,l,r,(0,y.ymd)(e)])}function V({init:e,onClose:t}){const s=(0,h.useOwner)(e=>e.staff),[n,a]=(0,i.useState)(e.shift?.start??12),[o,l]=(0,i.useState)(e.shift?.end??20),[r,u]=(0,i.useState)(e.shift?.breakAt),f=void 0===r||r>n&&rt.id===e.staffId),p=(0,h.leaveOn)((0,h.useOwner)(e=>e.leave),e.staffId,e.date);return(0,H.jsxs)(c.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[p?(0,H.jsx)(c.Banner,{kind:"warn",title:`${(m?.name??'').replace(' (example)','')} has time off: ${(0,b.rangeLabel)(p.from,p.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,H.jsx)(c.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,H.jsx)(c.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),l(s)}},e))}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{children:"Start"}),(0,H.jsx)(c.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:"End"}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:l,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(c.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(c.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.jsx)(c.Chip,{label:"Set a break time",onPress:()=>u(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,H.jsxs)(c.Row,{gap:6,children:[(0,H.jsx)(c.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:u,format:D.fmtH,label:"Break time"}),(0,H.jsx)(c.Chip,{label:"No set time",onPress:()=>u(void 0)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=h.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:f?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&f?{breakAt:r}:{}}),t()}}),(0,H.jsx)(c.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,H.jsx)(c.Button,{kind:"danger",label:"Remove shift",onPress:()=>{h.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({rid:e,today:t,now:s}){const n=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,h.useOwner)(e=>e.attendance),o=(0,D.useSignedIn)(),{me:l,meId:r}=(0,D.useCtx)(3e4),[d,u]=(0,i.useState)(null),[f,m]=(0,i.useState)(''),[p,x]=(0,i.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,h.isOnBreak)(j),w=s=>{if(!d)return;const a=(0,M.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??l},f);if(!a.ok)return void x(a.message);const i=n.find(e=>e.id===d)?.name??'them';(0,R.notify)({id:'mgr-clock',title:`Recorded for ${i}`,body:`Reason kept with the record: ${f.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Record it for someone"}),(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(c.Chip,{label:e.name,selected:d===e.id,onPress:()=>u(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Field,{label:"Reason (kept with the record)",value:f,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(c.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,h.useOwner)(e=>e.attendance),o=(0,h.useOwner)(e=>e.shifts),l=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),[r,d]=(0,i.useState)(s),u=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],m=(0,h.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,i.useState)(u&&!u.out?'out':'in'),[j,b]=(0,i.useState)(m?Math.round(60*m.start):720),[w,k]=(0,i.useState)(m?Math.round(60*m.end):1200),[S,C]=(0,i.useState)(''),[v,T]=(0,i.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,O='out'!==p,M='in'!==p,R=O&&M&&w<=j,P=(e,t)=>(0,H.jsx)(c.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return v?(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.jsx)(c.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,H.jsx)(c.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(c.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(c.Muted,{children:[m?`Your rota that day: ${(0,D.fmtH)(m.start)}\u2013${(0,D.fmtH)(m.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,y.hm)(new Date(u.in))}\u2013${u.out?(0,y.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(c.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(c.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),O?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,M?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(c.Field,{label:"Note for your manager (optional)",value:S,onChangeText:C,placeholder:"e.g. phone died",maxLength:200}),(0,H.jsx)(c.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{h.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:u?.id,kind:p,suggestedIn:O?(0,f.isoAt)(r,j):void 0,suggestedOut:M?(0,f.isoAt)(r,w):void 0,note:S.trim(),at:t.toISOString()}),T(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.useCtx)(3e4),n=(0,h.useOwner)(e=>e.attendance),a=(0,h.useOwner)(e=>e.shifts),o=(0,h.useOwner)(e=>e.timeRequests),[l,r]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),p=(0,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(h.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(d.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(d.default,{children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(c.T,{size:28,weight:"bold",colour:I.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(c.T,{size:18,weight:"semibold",colour:w?I.colours.amber:I.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(S.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsxs)(c.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(c.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,H.jsx)(S.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,h.shiftOf)((0,h.visibleShifts)(a,!1),t.staffId,t.date),n=(0,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(c.Card,{onPress:()=>m(u===t.id?null:t.id),children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(c.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.jsx)(c.Badge,{kind:(0,f.statusKind)(t),label:'awaiting'===(0,h.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,f.statusLabel)(t)})]}),o?(0,H.jsxs)(c.T,{size:13,colour:I.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(c.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,u===t.id?(0,H.jsx)(f.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(c.Muted,{children:"No clocked shifts yet."}),l?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const a=(0,h.useOwner)(e=>e.staff),o=(0,h.useOwner)(e=>e.shifts),r=(0,D.useHourly)(),u=(0,h.useOwner)(e=>e.attendance),m=(0,h.useOwner)(e=>e.timeRequests),p=(0,h.useOwner)(e=>e.attLog),[x,j]=(0,i.useState)(s),[b,w]=(0,i.useState)(null),[C,T]=(0,i.useState)(!1),$=!!(0,D.useSignedIn)(),O=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),M=u.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!M.some(t=>t.staffId===e.staffId)),P=u.filter(e=>O.includes(e.date)&&e.out),B=P.filter(h.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),N=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(B.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=a.find(e=>e.id===t.staffId),n=(0,h.shiftOf)(o,t.staffId,t.date),i=(0,D.paidMins)(t,e),l=r[t.staffId]??0;return`${s?.name},${t.date},${n?`${(0,D.fmtH)(n.start)}-${(0,D.fmtH)(n.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.hm)(new Date(t.out))},${i.brk},${(i.paid/60).toFixed(2)},${(l/100).toFixed(2)},${(i.paid/60*l/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:O.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(c.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(c.T,{size:13,colour:I.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(c.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(N))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(n.WideTable,{children:(0,H.jsxs)(d.default,{style:{gap:2},children:[(0,H.jsx)(n.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:I.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(c.T,{size:12,weight:"semibold",colour:I.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),M.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,h.shiftOf)(o,t.staffId,x),d=(0,D.paidMins)(t,e),u=(0,f.flagsFor)(t,r,e,s,m).map(e=>e.label);return(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(c.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(v.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(c.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:r?`${(0,D.fmtH)(r.start)}\u2013${(0,D.fmtH)(r.end)}`:'\u2013'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(c.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(c.T,{size:11,style:{width:120},colour:'confirmed'===(0,h.attStatus)(t)?I.colours.ok:'open'===(0,h.attStatus)(t)?I.colours.blue:I.colours.amber,children:(0,f.statusLabel)(t)}),(0,H.jsx)(c.T,{size:11,style:{width:140},colour:u.length?I.colours.amber:I.colours.ok,children:u.join(', ')||'OK'}),(0,H.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(c.T,{size:12,colour:I.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(c.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(c.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?I.colours.muted:I.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),M.length||R.length?null:(0,H.jsx)(c.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(c.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,H.jsx)(S.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(c.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(c.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(f.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(c.Sheet,{visible:C,onClose:()=>T(!1),title:"Payroll export",children:[(0,H.jsxs)(c.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(d.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(c.T,{size:10,colour:t?I.colours.text:I.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(c.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(c.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1159,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); __d(function(g,_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)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1156,[796,34,402,102,794,840,865,800,850,998,999,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),H=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),N=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(N.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),N.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(N.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:H.length?`Confirm all unflagged (${H.length})`:'Nothing unflagged to confirm',disabled:!H.length,onPress:()=>Y(H.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[H,N]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[H,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:H===e,onPress:()=>N(H===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:H?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),N=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),H=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(H.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),H.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(H.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:N.length?`Confirm all unflagged (${N.length})`:'Nothing unflagged to confirm',disabled:!N.length,onPress:()=>Y(N.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[N,H]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[N,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:N===e,onPress:()=>H(N===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:N?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:p}){const b=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.staff),f=(0,s.useMemo)(()=>(0,c.teamOnDay)(b,j,e,t),[b,j,e,t]);return(0,h.jsxs)(l.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(p,f),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",p]}),f.length?f.map(e=>(0,h.jsxs)(l.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,h.jsxs)(n.T,{size:13,center:!0,children:[e.name,e.job?(0,h.jsxs)(n.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,h.jsx)(n.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6])},1158,[34,102,794,865,1102,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1159,[34,102,794,865,840,1100,1103,1158,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1160,[34,102,1100,840,794,25]); -__d(function(g,r,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]})}},1161,[796,34,402,102,794,1019,840,928,25]); -__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1162,[796,1163,804,865,34,336,402,102,794,1019,1020,840,899,928,1164,1167,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1163,[34,1019,865,804]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1164,[798,796,1163,804,865,34,336,402,102,900,794,899,1019,1020,1165,840,928,1166,25]); -__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1165,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1166,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1167,[34,379,236,102,794,865,1019,1166,1020,1168,840,928,1163,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1168,[1020]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1169,[34,402,102,794,989,830,990,840,928,1170,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1170,[798,34,336,395,402,295,102,1171,794,989,830,990,827,840,1034,25,1173]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1171,[34,1172,102,830,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1172,[2,985]); -__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1173,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1174,[829,34,236,402,102,900,848,840,794,1175,1099,1176,25]); -__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1175,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); -__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1176,[1177,1178,1180,1179,1181,1033,1182]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1177,[]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1178,[808,5,815,818,846,1033,1179]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1179,[829,236,846,1177]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1180,[34,848,830,838,836,1178,1177]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1181,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1182,[34,1178,985,931]); -__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1183,[34,402,102,426,848,830,840,794,1174,1099,1184,25]); -__d(function(g,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}},1184,[34,102,426,848,830,1176,1033,840,794,1099,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1185,[34,236,402,102,853,794,840,994,1186,1187,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1186,[846,6,931,974,994,1176,1187]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1187,[808,1188,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1188,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1189,[34,846,1186]); -__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1190,[796,1163,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1191,[34,402,346,102,426,840,1153,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1192,[30,34,792,846,25]); -__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1193,[829,1097,851,30,34,1194,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); -__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])},1194,[796,34,236,102,25]); -__d(function(_g,_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"})]})]})}},1195,[30,34,336,102,1171,1196,794,830,836,848,856,840,25]); -__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])},1196,[30,34,402,848,840,794,25]); -__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1197,[30,34,794,1198,848,1185,25]); -__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])},1198,[34,402,840,794,25]); -__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1199,[806,30,34,1200,794,836,848,840,1201,1205,25]); -__d(function(_g,r,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])},1200,[34,385,102,848,836,840,794,25]); -__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}},1201,[34,102,794,836,1202,1203,1204,840,25]); -__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})},1202,[]); -__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})},1203,[]); -__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()})},1204,[931,985,1203]); -__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}},1205,[815,931,974,985,2,1202]); -__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1206,[1207,1216,5,1217,1218,1219,1222,829,30,34,236,402,102,1171,1196,794,830,836,852,848,840,1223,1185,846,865,1170,989,990,997,1224,1205,25]); -__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1207,[34,379,794,847,1208,1209,1215,848,5,6,25]); -__d(function(g,r,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])},1208,[34,379,102,794,991,992,1044,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1209,[6,34,931,794,1210,25]); -__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]})]})}},1210,[6,1211,1212,1213,34,102,796,794,840,11,1214,25]); -__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1212,[4,11]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1213,[11]); -__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.'}},1214,[6,931]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1215,[34,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1216,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1217,[34,102,794,1210,25]); -__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1218,[34,379,931,794,847,1208,1210,4,25]); -__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1219,[34,379,794,1208,847,1209,8,1220,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1220,[34,102,794,1221,25]); -__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1221,[]); -__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1222,[34,794,847,1208,1209,848,9,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1223,[34,402,102,426,794,840,1153,25]); -__d(function(g,_r,_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)})]})}},1224,[34,102,1225,794,848,997,1202,1205,840,25]); -__d(function(g,r,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])},1225,[34,102,1226,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1226,[1227]); -__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1227,[34,900,1228,1257,1258,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1228,[1229]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1229,[1230,1231,1254,1256]); -__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1230,[]); -__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1231,[1232,1233,1234,1235,1236,1237,1238,1239,1240,1243,1247,1244,1248]); -__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1232,[]); -__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1233,[]); -__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1234,[]); -__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1235,[]); -__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1240,[1241]); -__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1244,[1245,1246]); -__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1245,[]); -__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1246,[]); -__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1249,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1250,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1252,[1244,1232]); -__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1253,[]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1254,[1255]); -__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1256,[1255]); -__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1257,[]); -__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1258,[34,900,1259,25]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1259,[]); -__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1260,[30,34,794,848,865,25]); -__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1261,[806,30,34,102,1225,794,836,848,840,1224,1205,25]); -__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1262,[806,30,34,102,1200,794,848,865,836,827,840,1201,1205,25]); -__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1263,[806,30,34,794,848,865,827,840,1224,1205,25]); -__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1264,[806,30,34,794,848,865,840,1224,1205,25]); -__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1265,[30,34,794,827,1120,1266,848,840,25]); -__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}},1266,[]); -__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1267,[30,1075,34,402,102,794,827,848,840,25]); -__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1268,[829,30,34,1194,995,102,1200,794,830,836,1104,827,848,800,840,833,25]); -__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1269,[30,34,102,1196,794,830,852,848,840,1223,5,25]); -__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)}})]})}},1270,[829,30,34,102,1200,1198,794,830,836,827,848,840,25]); -__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1271,[829,1205,30,34,102,794,830,836,827,848,853,25]); -__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]})}},1272,[30,34,846,25]); -__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}},1273,[806,30,34,794,848,5,1205,25]); -__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."})})}},1274,[30,34,794,1275,1131,1205,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1275,[796,829,34,102,794,830,836,1131,1276,848,840,25]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1276,[931,985,1131]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1277,[30,34,846,1278,1333,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"})]}),qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1278,[1121,5,6,1279,798,822,1094,829,1120,1280,1281,1282,1091,1115,1283,1284,1286,1287,1288,1130,977,1099,1289,34,1073,1148,1033,1087,1116,1290,380,402,295,102,426,36,794,1185,1189,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1291,1107,1292,1295,1297,1300,1303,1299,1304,1306,1307,1112,1093,1095,852,1309,1174,1310,1184,1176,1011,1315,1323,1325,1076,1114,1327,1328,1329,1143,1330,1142,1136,838,1331,1332,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1280,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1281,[1012,1100]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1282,[34,102,1079,794,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1283,[829,34,102,794,848,1131,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1284,[34,395,402,426,102,1225,794,1143,1014,1285,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1285,[]); -__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}))},1286,[815]); -__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1287,[798,34,379,395,402,102,794,1143,840,25]); -__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return v}}),_e.SoldOutStrip=function({rid:e,now:k,by:w,onOpen:F}){const I=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[C,_]=(0,n.useState)(0),[A,H]=(0,n.useState)(!1),L=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{O()},[]);const D=k??(0,p.nowFrom)(z),W=(0,S.activeSoldOut)(I,e,D);if(!W.length)return null;const E=W.map(e=>(0,x.withReason)(e.name,L.reason(e.itemId))),M=(0,S.stripText)(E),P=C>0&&(0,S.stripNeedsTicker)(E,C,v),R=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=R);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>F?F():H(!0),onLayout:e=>_(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:b.colours.accentBorder},children:[(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:b.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,j.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,j.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&T?{whiteSpace:'nowrap'}:{},fontFamily:b.fonts.medium,fontSize:v,lineHeight:20,color:b.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!T?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:12,color:b.colours.muted},children:"Tap for all"}):null]}),F?null:(0,j.jsxs)(c.Sheet,{visible:A,onClose:()=>H(!1),title:(0,S.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[w?(0,j.jsx)(u.SoldOutList,{rid:e,by:w,hideLinks:!0}):(0,j.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,j.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:b.colours.border},children:[(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.semibold,fontSize:17,color:b.colours.text},children:e.name}),L.reason(e.itemId)?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.medium,fontSize:14,color:b.colours.amber},children:L.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted},children:["Since ",$(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${$(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const T='undefined'!=typeof document,k=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let w=!1;function O(){if(!T||w)return;w=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=k,document.head.appendChild(e)}const $=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},v=15},1288,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,978,840,25]); -__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])},1289,[798,34,102,840,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1290,[34,102,900,840,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1291,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1292,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1293,1294,1014,865,1107,25]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1293,[798,829,34,1294,102,828,840,794,1108,25]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1294,[828]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1295,[34,236,402,102,840,794,1143,1296,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1296,[]); -__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1297,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1298,840,794,1299,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1298,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1299,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1300,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1286,1301,2,1302,1303,848,827,25]); -__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1301,[236]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1303,[34,815,931,985,1302]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1304,[829,14,1014,1305]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1305,[830]); -__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1306,[34,102,900,840,25]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1307,[829,1014,34,102,794,1096,848,1308,1304,1095,1093,1112,1113,1114,840,1281,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1308,[1014,1079]); -__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1309,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1299,848,1014,830,1089,1079,1266,840,1281,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1310,[796,34,236,402,102,794,848,1014,1311,840,1312,1314,25]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1311,[]); -__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1312,[815,848,1014,1311,1313,1314]); -__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1313,[829]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1314,[236,1313]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1315,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1316,1319,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1316,[1317,839,829,34,281,395,402,295,102,848,1011,1014,1318,827,840,1041,794,1319,1320,985,1281,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1317,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1318,[852,827,851]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1319,[5,1014,931,985]); -__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})},1320,[815,931,985,1321,2,1322]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1321,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1322,[15]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1323,[34,102,900,794,1143,827,840,798,1324,1325,1326,25]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1324,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1325,[]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1326,[1079]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1327,[829,1305]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1328,[34,402,102,794,1327,840,1290,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1329,[34,102,899,794,1143,827,840,25]); -__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1330,[34,1143,402,102,426,794,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1331,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1320,985,25]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1332,[34,1021,865,1001,800,1022,994,1320,1070]); -__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1333,[5,798,847,34,236,402,102,426,985,840,794,1286,1334,25]); -__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}})()},1334,[]); -__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]})}},1335,[30,34,846,25]); +__d(function(g,_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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1159,[34,402,102,794,865,827,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1160,[34,102,794,865,840,1100,1103,1158,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1161,[34,102,1100,840,794,25]); +__d(function(g,r,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]})}},1162,[796,34,402,102,794,1019,840,928,25]); +__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1163,[796,1164,804,865,34,336,402,102,794,1019,1020,840,899,928,1165,1168,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1164,[34,1019,865,804]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1165,[798,796,1164,804,865,34,336,402,102,900,794,899,1019,1020,1166,840,928,1167,25]); +__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1166,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1167,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1168,[34,379,236,102,794,865,1019,1167,1020,1169,840,928,1164,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1169,[1020]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1170,[34,402,102,794,989,830,990,840,928,1171,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1171,[798,34,336,395,402,295,102,1172,794,989,830,990,827,840,1034,25,1174]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1172,[34,1173,102,830,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1173,[2,985]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1174,[]); +__d(function(g,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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1175,[829,34,236,402,102,900,848,840,794,1176,1099,1177,25]); +__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1176,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); +__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1177,[1178,1179,1181,1180,1182,1033,1183]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1178,[]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1179,[808,5,815,818,846,1033,1180]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1180,[829,236,846,1178]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1181,[34,848,830,838,836,1179,1178]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1182,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1183,[34,1179,985,931]); +__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1184,[34,402,102,426,848,830,840,794,1175,1099,1185,25]); +__d(function(g,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}},1185,[34,102,426,848,830,1177,1033,840,794,1099,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1186,[34,236,402,102,853,794,840,994,1187,1188,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1187,[846,6,931,974,994,1177,1188]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1188,[808,1189,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1189,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1190,[34,846,1187]); +__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1191,[796,1164,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1192,[34,402,346,102,426,840,1153,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1193,[30,34,792,846,25]); +__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1194,[829,1097,851,30,34,1195,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); +__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])},1195,[796,34,236,102,25]); +__d(function(_g,_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"})]})]})}},1196,[30,34,336,102,1172,1197,794,830,836,848,856,840,25]); +__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])},1197,[30,34,402,848,840,794,25]); +__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1198,[30,34,794,1199,848,1186,25]); +__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])},1199,[34,402,840,794,25]); +__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1200,[806,30,34,1201,794,836,848,840,1202,1206,25]); +__d(function(_g,r,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])},1201,[34,385,102,848,836,840,794,25]); +__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}},1202,[34,102,794,836,1203,1204,1205,840,25]); +__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})},1203,[]); +__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})},1204,[]); +__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()})},1205,[931,985,1204]); +__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}},1206,[815,931,974,985,2,1203]); +__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1207,[1208,1217,5,1218,1219,1220,1223,829,30,34,236,402,102,1172,1197,794,830,836,852,848,840,1224,1186,846,865,1171,989,990,997,1225,1206,25]); +__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1208,[34,379,794,847,1209,1210,1216,848,5,6,25]); +__d(function(g,r,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])},1209,[34,379,102,794,991,992,1044,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1210,[6,34,931,794,1211,25]); +__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]})]})}},1211,[6,1212,1213,1214,34,102,796,794,840,11,1215,25]); +__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1213,[4,11]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1214,[11]); +__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.'}},1215,[6,931]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1216,[34,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1217,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1218,[34,102,794,1211,25]); +__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1219,[34,379,931,794,847,1209,1211,4,25]); +__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1220,[34,379,794,1209,847,1210,8,1221,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1221,[34,102,794,1222,25]); +__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1222,[]); +__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1223,[34,794,847,1209,1210,848,9,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1224,[34,402,102,426,794,840,1153,25]); +__d(function(g,_r,_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)})]})}},1225,[34,102,1226,794,848,997,1203,1206,840,25]); +__d(function(g,r,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])},1226,[34,102,1227,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1227,[1228]); +__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1228,[34,900,1229,1258,1259,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1229,[1230]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1230,[1231,1232,1255,1257]); +__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1231,[]); +__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1232,[1233,1234,1235,1236,1237,1238,1239,1240,1241,1244,1248,1245,1249]); +__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1233,[]); +__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1234,[]); +__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1235,[]); +__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1236,[]); +__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1241,[1242]); +__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1245,[1246,1247]); +__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1246,[]); +__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1247,[]); +__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1250,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1251,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1253,[1245,1233]); +__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1254,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1255,[1256]); +__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1257,[1256]); +__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1258,[]); +__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1259,[34,900,1260,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1260,[]); +__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1261,[30,34,794,848,865,25]); +__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1262,[806,30,34,102,1226,794,836,848,840,1225,1206,25]); +__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1263,[806,30,34,102,1201,794,848,865,836,827,840,1202,1206,25]); +__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1264,[806,30,34,794,848,865,827,840,1225,1206,25]); +__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1265,[806,30,34,794,848,865,840,1225,1206,25]); +__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1266,[30,34,794,827,1120,1267,848,840,25]); +__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}},1267,[]); +__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1268,[30,1075,34,402,102,794,827,848,840,25]); +__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1269,[829,30,34,1195,995,102,1201,794,830,836,1104,827,848,800,840,833,25]); +__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1270,[30,34,102,1197,794,830,852,848,840,1224,5,25]); +__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)}})]})}},1271,[829,30,34,102,1201,1199,794,830,836,827,848,840,25]); +__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1272,[829,1206,30,34,102,794,830,836,827,848,853,25]); +__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]})}},1273,[30,34,846,25]); +__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}},1274,[806,30,34,794,848,5,1206,25]); +__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."})})}},1275,[30,34,794,1276,1131,1206,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1276,[796,829,34,102,794,830,836,1131,1277,848,840,25]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1277,[931,985,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1278,[30,34,846,1279,1334,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"}),G]}),Le,qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1279,[1121,5,6,1280,798,822,1094,829,1120,1281,1282,1283,1091,1115,1284,1285,1287,1288,1289,1130,977,1099,1290,34,1073,1148,1033,1087,1116,1291,380,402,295,102,426,36,794,1186,1190,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1292,1107,1293,1296,1298,1301,1304,1300,1305,1307,1308,1112,1093,1095,852,1310,1175,1311,1185,1177,1011,1316,1324,1326,1076,1114,1328,1329,1330,1143,1331,1142,1136,838,1332,1333,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1281,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1282,[1012,1100]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1283,[34,102,1079,794,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1284,[829,34,102,794,848,1131,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1285,[34,395,402,426,102,1226,794,1143,1014,1286,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1286,[]); +__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}))},1287,[815]); +__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1288,[798,34,379,395,402,102,794,1143,840,25]); +__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return F}}),_e.SoldOutStrip=function({rid:e,now:w,by:O,onOpen:I}){const C=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[_,A]=(0,n.useState)(0),[H,L]=(0,n.useState)(!1),D=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{$()},[]);const R=w??(0,p.nowFrom)(z),W=(0,b.activeSoldOut)(C,e,R);if(!W.length)return null;const E=W.map(e=>{const t=D.reason(e.itemId);return(0,x.withReason)(e.name,S.IS_CAR&&'none left'===t?'':t)}),M=(0,b.stripText)(E),P=_>0&&(0,b.stripNeedsTicker)(E,_,F),B=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=B);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>I?I():L(!0),onLayout:e=>A(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:j.colours.accentBorder},children:[(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:j.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,T.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,T.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&k?{whiteSpace:'nowrap'}:{},fontFamily:j.fonts.medium,fontSize:F,lineHeight:20,color:j.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!k?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:12,color:j.colours.muted},children:"Tap for all"}):null]}),I?null:(0,T.jsxs)(c.Sheet,{visible:H,onClose:()=>L(!1),title:(0,b.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[O?(0,T.jsx)(u.SoldOutList,{rid:e,by:O,hideLinks:!0}):(0,T.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,T.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.colours.border},children:[(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.semibold,fontSize:17,color:j.colours.text},children:e.name}),D.reason(e.itemId)?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.medium,fontSize:14,color:j.colours.amber},children:D.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted},children:["Since ",v(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${v(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]),T=r(_d[17]);const k='undefined'!=typeof document,w=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let O=!1;function $(){if(!k||O)return;O=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=w,document.head.appendChild(e)}const v=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},F=15},1289,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,846,978,840,25]); +__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])},1290,[798,34,102,840,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1291,[34,102,900,840,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1292,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1293,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1294,1295,1014,865,1107,25]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1294,[798,829,34,1295,102,828,840,794,1108,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1295,[828]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1296,[34,236,402,102,840,794,1143,1297,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1298,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1299,840,794,1300,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1299,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1300,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1301,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1287,1302,2,1303,1304,848,827,25]); +__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1302,[236]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1304,[34,815,931,985,1303]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1305,[829,14,1014,1306]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1306,[830]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1307,[34,102,900,840,25]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1308,[829,1014,34,102,794,1096,848,1309,1305,1095,1093,1112,1113,1114,840,1282,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1309,[1014,1079]); +__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1310,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1300,848,1014,830,1089,1079,1267,840,1282,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1311,[796,34,236,402,102,794,848,1014,1312,840,1313,1315,25]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1312,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1313,[815,848,1014,1312,1314,1315]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1314,[829]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1315,[236,1314]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1316,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1317,1320,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1317,[1318,839,829,34,281,395,402,295,102,848,1011,1014,1319,827,840,1041,794,1320,1321,985,1282,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1318,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1319,[852,827,851]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1320,[5,1014,931,985]); +__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})},1321,[815,931,985,1322,2,1323]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1322,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1323,[15]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1324,[34,102,900,794,1143,827,840,798,1325,1326,1327,25]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1325,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1326,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1327,[1079]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1328,[829,1306]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1329,[34,402,102,794,1328,840,1291,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1330,[34,102,899,794,1143,827,840,25]); +__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1331,[34,1143,402,102,426,794,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1332,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1321,985,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1333,[34,1021,865,1001,800,1022,994,1321,1070]); +__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1334,[5,798,847,34,236,402,102,426,985,840,794,1287,1335,25]); +__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}})()},1335,[]); __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]})}},1336,[30,34,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1337,[30,34,1338,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1338,[34,846,1339,1470,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnerApp=function(){return(0,ie.isDesktop)()?(0,de.jsx)(le.DesktopShell,{}):(0,de.jsx)(he,{})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),n=_r(d[3]),r=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),x=_r(d[13]),j=e(_r(d[14])),w=e(_r(d[15])),y=e(_r(d[16])),S=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),I=_r(d[24]),L=_r(d[25]),E=_r(d[26]),B=_r(d[27]),O=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var M=_r(d[33]),H=_r(d[34]),V=_r(d[35]),D=_r(d[36]),W=_r(d[37]),$=_r(d[38]),z=_r(d[39]),U=_r(d[40]),F=_r(d[41]),G=_r(d[42]),K=_r(d[43]),Y=_r(d[44]);_r(d[45]);var q=_r(d[46]),J=_r(d[47]),Q=_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]),ne=_r(d[55]),re=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]),de=_r(d[60]);const ce=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ue=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:I.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],fe={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function he(){const{rid:e,r:ie,role:le,today:he,now:ge,meId:me,me:pe}=(0,O.useCtx)(3e4);(0,h.useTipsPosted)(e,he,'staff'!==le);const be=(0,O.useSignedIn)();(0,l.useSoldOutLink)(!0,(be?.name??pe).replace(' (example)',''));const xe=(0,T.useOrders)(e),[je,we]=(0,x.useState)('home'),[ye,Se]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Te=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,O.ensureAttendance)(he,ge),(0,J.ensureChat)(ge)},[he]),globalThis.__ccNow=ge.getTime();const Ie=(0,J.useChatUnread)().total,Le=(0,x.useRef)({t:'home',s:null});Le.current={t:je,s:ye};const Ee=(0,x.useRef)([]),Be=(0,a.useScrollMemory)(Te),Oe=(0,x.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.s===s||(Ee.current=[...Ee.current,{...t,y:Be.leave()}].slice(-30),Be.restore(0)),we(e),Se(s)},[]),Pe=(0,x.useCallback)(()=>{if((0,c.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Be.leave(),we(t.t),Se(t.s),Be.restore(t.y??0),!0},[]);(0,c.useWebBack)(Pe);const Ne=(0,c.useInnerBackShown)();(0,x.useEffect)(()=>(oe.useVoiceNav.setState({go:Oe}),()=>oe.useVoiceNav.setState({go:null})),[Oe]),(0,x.useEffect)(()=>{u.PITCH&&(globalThis.__pitchGo=Oe)},[Oe]),(0,x.useEffect)(()=>{const e=j.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ue.find(e=>e.id===je);e?.can&&!e.can(le)&&Oe('home');const s=(0,K.pageFor)(ye);s?.can&&!s.can(le)&&Se(null)},[le]);const Me='more'===je?(0,K.pageFor)(ye):void 0,He=xe.filter(e=>(0,B.LIVE)(e)&&'new'===e.status).length,{unread:Ve,list:De,read:We}=(0,q.useNotifications)();(0,se.useAlertWatcher)(e,{nag:'staff'!==le}),(0,te.useReviewAlerts)(e),(0,ne.useScheduledNotices)({rid:e,staffId:be?.id??'',name:pe,onOpen:()=>Oe('more','orderlists')}),(0,re.useOffRotaAlerts)({enabled:'staff'!==le&&!!be});const $e=be?.role??le,ze='owner'===$e?'OWNER':'manager'===$e?'MANAGER':'STAFF',Ue=(0,se.useAlerts)(s=>s.history.filter(t=>t.rid===e&&(0,se.isUnread)(s,t)&&!(0,se.isCleared)(s,t)&&t.at>(s.seenAt[e]??0)).length),Fe=(0,se.useAlerts)(s=>s.todoSeen[e]),Ge=Math.max(0,Ve-De.filter(e=>!We[e.id]&&(Fe??[]).includes(e.id)).length)+Ue;(0,se.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:Ge})},[Ge]);const Ke=(0,T.useBookings)(e).filter(e=>'pending'===e.status).length,Ye=s.IS_ISOLATED_VENUE?[{id:e,name:ie.name,place:ie.location||ie.address||''}]:ce,qe=Ye.find(s=>s.id===e)??Ye[0],Je=be?.ownerAccess&&'owner'!==be.role?'owner privileges':be?.managerAccess&&'staff'===be.role?'manager privileges':'',Qe=(0,H.ownerHomeLayout)(le,be);(0,A.default)().width;return(0,de.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:L.colours.bg},edges:['top','left','right','bottom'],children:[(0,de.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:L.colours.border,gap:6},children:[(0,de.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Oe('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(U.Icon,{name:"search",colour:L.colours.text})}),(0,de.jsx)(y.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:Ge?`Notifications, ${Ge} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Oe('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsxs)(k.default,{children:[(0,de.jsx)(U.Icon,{name:"bell",colour:L.colours.text}),Ge?(0,de.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:L.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(C.T,{size:10,weight:"bold",children:Ge})}):null]})}),(0,de.jsx)(X.VoiceSlot,{size:44})]}),(0,de.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,de.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,de.jsx)(y.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${pe}. Account and role${Je?`, ${Je}`:''}`,disabled:'owner'!==V.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,de.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,de.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,de.jsxs)(k.default,{style:{flexShrink:1},children:[(0,de.jsxs)(C.T,{size:13,weight:"semibold",colour:L.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[be?`${pe} \xb7 ${be.level??I.ROLE_LABEL[be.role]}`:`${pe} \xb7 ${I.ROLE_LABEL[le]}`,'owner'===V.APP_VARIANT?' \u25be':'']}),Je?(0,de.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:Je}):null]})]})})})}),(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,de.jsx)(v.VenueHeaderBlock,{rid:e,name:ie.name,badge:ze,place:`${'staff'===le?'Staff preview \xb7 ':'Managers \xb7 '}${qe.place}`})}),le!==(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner')&&'owner'===V.APP_VARIANT?(0,de.jsx)(y.default,{onPress:()=>I.useOwner.getState().setPreviewRole(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,de.jsx)(C.T,{size:12,colour:L.colours.gold,children:'staff'===le?`Staff app preview: what staff see in the Staff app. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`:`Previewing the ${I.ROLE_LABEL[le].toLowerCase()} view. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`})}):null]}),(0,de.jsxs)(S.default,{ref:Te,...Be.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,de.jsx)(c.BackTitleRow,{back:!('home'===je&&!ye||Ne),onBack:Pe,title:Me?Me.title:'staff'===le&&'home'===je?'Staff app preview':fe[je]}),'home'===je&&be&&'staff'===be.role&&'owner'===V.APP_VARIANT?(0,de.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",colour:L.colours.gold,children:"Your manager access is off"}),(0,de.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,de.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Oe('more','clock')})]}):null,'home'!==je||Qe?null:(0,de.jsx)(r.WhoBar,{}),'home'===je&&!Qe&&be?(0,de.jsx)(ae.MyShiftCard,{go:Oe}):null,'home'===je&&!Qe&&be?(0,de.jsx)(f.MyTasksToday,{rid:e,staffId:be.id,name:be.name,onShift:(0,p.shiftNow)(be.id,Date.now()).on}):null,'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TodaysTipsCard,{rid:e,today:he}),'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TipsPotCard,{rid:e,today:he}),'home'===je?'staff'===le?(0,de.jsx)($.StaffHome,{go:Oe}):(0,de.jsx)(M.Dashboard,{go:Oe,ownerHome:Qe}):null,'orders'===je?(0,de.jsx)(Y.Orders,{}):null,'bookings'===je?(0,de.jsx)(E.Bookings,{go:Oe}):null,'forecast'===je?(0,de.jsx)(z.Forecasts,{go:Oe}):null,'chat'===je?(0,de.jsx)(J.Chat,{go:Oe}):null,'more'===je?Me?(0,de.jsx)(Me.C,{go:Oe}):(0,de.jsx)(K.MoreMenu,{go:Oe}):null]}),(0,de.jsx)(b.SeatAllergenReminder,{rid:e}),'staff'!==le?(0,de.jsx)(ee.PrintHost,{rid:e}):null,'staff'!==le?(0,de.jsx)(Z.AlertHost,{variant:"managers",rid:e,me:pe,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,de.jsx)(Q.AssistantSheet,{}),(0,de.jsx)(F.BottomTabs,{background:(0,t.soutersSurface)('#0d0d0d'),active:je,onPress:e=>Oe(e),tabs:ue.filter(e=>!e.can||e.can(le)).map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ie?{text:String(Ie),bg:L.colours.red}:'bookings'===e.id&&Ke?{text:String(Ke),bg:L.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&He?{text:String(He),bg:L.colours.red}:null}))}),(0,de.jsx)(w.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ye.filter(e=>!Re||'saltmarsh'!==e.id).map(s=>(0,de.jsx)(y.default,{accessibilityRole:"button",onPress:()=>{I.useOwner.getState().setSite(s.id),ke(!1),Oe('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:s.id===e?L.colours.gold:L.colours.border},children:(0,de.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,de.jsxs)(k.default,{children:[(0,de.jsx)(C.T,{weight:"medium",children:s.name}),(0,de.jsx)(C.Muted,{children:s.place})]}),s.id===e?(0,de.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},s.id)),(0,de.jsx)(C.Muted,{children:s.IS_ISOLATED_VENUE?`This app belongs only to ${ie.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,de.jsx)(w.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[be?(0,de.jsxs)(C.Row,{gap:10,children:[(0,de.jsx)(_.StaffAvatar,{id:be.id,size:44}),(0,de.jsxs)(k.default,{style:{flex:1},children:[(0,de.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",be.name]}),(0,de.jsx)(C.Muted,{children:(0,N.levelJob)(be.level??I.ROLE_LABEL[be.role],be.job)})]})]}):(0,de.jsxs)(k.default,{style:{gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,de.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,de.jsx)(P.SignInWithLink,{})]}),s.IS_QUEUED_VENUE||s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_GREENSIDE||!be?null:(0,de.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=s.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():s.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,de.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!be||(0,O.clampRole)(e,be.ownerAccess?'owner':be.managerAccess?'manager':be.role)===e).map(e=>(0,de.jsx)(C.Button,{kind:e===le?'primary':'secondary',label:'staff'===e?'Staff app preview':`${I.ROLE_LABEL[e]} view`,onPress:()=>{I.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,de.jsx)(D.OnboardingHost,{go:Oe}),(0,de.jsx)(W.CoachHost,{})]})}},1339,[5,798,985,1172,1160,1040,977,1041,2,1047,1048,1070,1087,34,373,395,402,295,426,102,36,794,847,848,865,840,1340,1147,1100,899,1348,997,236,1355,13,846,1384,1390,1391,1392,1153,1191,1393,1378,1394,1395,1376,1135,1410,1116,1174,1310,1176,1189,1400,1085,1086,1159,1460,1461,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1340,[5,1341,11,1342,796,806,1112,1113,1091,1115,1114,1327,1328,1100,1281,1012,1089,14,1343,1185,1344,1315,1081,1075,1090,34,102,794,1290,848,830,836,827,1266,840,1147,1096,1014,1345,1346,1136,1347,1176,985,1149,1323,852,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1341,[34,794,25]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1342,[6,34,102,794,985,1214,25]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1343,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1344,[34,402,1143,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1345,[34,102,848,1014,794,840,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1346,[34,402,102,794,840,25]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1347,[34,102,853,848,833,840,794,25]); -__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1348,[5,1349,1350,1351,1352,1353,34,236,41,102,846,997,840,1354,794,985,2,1072,996,865,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1349,[34,102,847,794,5,6,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1350,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1351,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1352,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1353,[34,102,847,794,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1354,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:a=!1}){const{rid:n,r:b,now:O,role:te,me:le,today:oe}=(0,S.useCtx)(5e3),ae=(0,p.useOrders)(n),ne=(0,p.useBookings)(n),ie=(0,p.useWaitlist)(n),de=(0,p.useEvents)(n),ue=(0,p.useRatings)(n),he=(0,k.useOwner)(e=>e.staff),ge=(0,k.useOwner)(e=>e.attendance),xe=(0,k.useOwner)(e=>e.shifts),ye=(0,P.useRealHistory)(n,O),be=(0,o.useMemo)(()=>(0,t.forecastToday)(b,ne,ae,de,O,ye??void 0),[b,ne,ae,de,ye,O.getTime()/6e4|0]),fe=(0,N.useExamples)(),me=(0,M.useCashUp)(e=>e.cashUps),je=ne.filter(e=>e.date===oe),pe=ae.filter(A.LIVE),ke=ie.filter(e=>'waiting'===e.status||'notified'===e.status),we=je.filter(e=>['seated','finished'].includes((0,T.shownStatus)(e))).reduce((e,s)=>e+s.partySize,0),$e=(0,ee.coversSplit)(je,oe),ve=$e.walkIns,Ce=$e.bookings,Ie=pe.filter(e=>(0,G.chainNeedsAction)(e,ne)),Te=je.filter(e=>['confirmed','seated'].includes(e.status)&&(0,G.bookingNeedsAction)(e,pe)),Be=pe.flatMap(e=>(0,C.readinessFor)(e,b,O).map(s=>({...s,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),De=be.nextHour,Ae=(0,A.busyLevel)(De?.coversHigh??0,be.busy.busy),Se=(0,A.restOfDayLevel)(be,b),Le=ae.filter(e=>e.paid>0).reduce((e,s)=>e+s.paid,0)+(fe?186e3:0),Pe=(0,I.ymd)(new Date(O.getTime()-6048e5)),Ne=me.find(e=>e.rid===n&&e.date===Pe),Me=Ne?(0,F.takings)(Ne.vals):null,Fe=fe?(0,L.revenueHistory)(b,O,7).filter(e=>e.date.getDay()===O.getDay()).pop():null!=Me?{date:(0,I.parseYmd)(Pe),total:Math.round(100*Me)}:void 0,Oe=(0,o.useMemo)(()=>(0,L.insights)(b,ne,ae,de,ue,O,we),[b.id,ne.length,ue.length,we]),Re=((0,S.weekday)(O),ge.filter(e=>e.date===oe&&e.in&&!e.out)),He=(0,X.useFrontDoor)(oe),We=(0,h.useBookingWrite)(),Ee=(0,w.useOutstanding)(),ze=(0,r.useTravelDay)('owner',oe),Ge=(0,S.useSignedIn)(),Ue=(0,S.useInStaffApp)(),qe=(0,F.canSeeMonthTakings)(te,Ge,{inStaffApp:Ue,live:(0,H.isLive)()}),Ye=(0,R.homeSetupNagsHidden)(n),Ke=(0,k.useOwner)(e=>e.socialPosts.reduce((e,s)=>e+('awaiting approval'===s.status?1:0),0)),[Qe,Ve]=(0,o.useState)(!1),Xe=le.replace(' (example)',''),Ze=k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return ze?(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(r.DayView,{rid:n,day:ze,today:oe,app:"owner"})]}):a?(0,se.jsxs)(m.default,{style:{gap:12},testID:"owner-home",children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),k.CAN.takings(te)?(0,se.jsx)(j.Row,{wrap:!0,gap:10,children:(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})})}):null,(0,se.jsx)(Q.TodaysTipsCard,{rid:n,today:oe}),(0,se.jsx)(Q.TipsPotCard,{rid:n,today:oe}),k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(Y.WhoBar,{}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ge&&'owner'!==Ge.role?(0,se.jsx)(_.MyShiftCard,{go:e}):null,Ge?(0,se.jsx)(K.MyTasksToday,{rid:n,staffId:Ge.id,name:Ge.name,onShift:(0,V.shiftNow)(Ge.id,Date.now()).on}):null,k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]}):(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,k.CAN.takings(te)?(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ie,_e.MonthTakingsCard=re,_e.WalkInSplitCard=ce;var s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),o=_r(_d[3]),a=_r(_d[4]),n=e(a),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),x=_r(_d[11]),y=_r(_d[12]),b=e(_r(_d[13])),f=e(_r(_d[14])),m=e(_r(_d[15])),j=_r(_d[16]),p=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),T=_r(_d[24]),B=_r(_d[25]),D=_r(_d[26]),A=_r(_d[27]),S=_r(_d[28]),L=_r(_d[29]),P=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),F=_r(_d[33]),O=_r(_d[34]),R=_r(_d[35]),H=_r(_d[36]),W=_r(_d[37]),E=_r(_d[38]),z=_r(_d[39]),G=_r(_d[40]),U=_r(_d[41]),q=_r(_d[42]),Y=_r(_d[43]),_=_r(_d[44]),K=_r(_d[45]),Q=_r(_d[46]),V=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]);const te=18,le=18,oe=150,ae=34;function ne(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const s=e.length,t=[],l=[];for(let l=0;l9){const n=3/Math.sqrt(a);l[e]=n*s*t[e],l[e+1]=n*o*t[e]}}let o=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let t=0;tte+(s-1)/Math.max(1,e-1)*t,o=[1,5,10,15,20,25].filter(s=>s=36)&&a.push(e);for(;a.length&&l(e)-l(a[a.length-1])<36;)a.pop();return[...a,e]}function re({rid:e,today:s}){const t=(0,M.useCashUp)(e=>e.cashUps),[l,i]=(0,o.useState)(s.slice(0,7)),[r,d]=(0,o.useState)(0),[c,u]=(0,o.useState)(null),h=(0,o.useMemo)(()=>(0,F.monthTakings)(t,e,l,s),[t,e,l,s]),x=(0,o.useMemo)(()=>(0,F.firstTakingsMonth)(t,e),[t,e]),y=!!x&&xte+(e-1)/Math.max(1,k-1)*w,I=e=>$-e/v*128,T=[];h.days.forEach((e,s)=>{if('recorded'!==e.state)return;const t={x:C(e.day),y:I(e.value)};s&&'recorded'===h.days[s-1].state?T[T.length-1].push(t):T.push([t])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),S=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===s):void 0)??A??B[B.length-1],L=e=>{const s=B.findIndex(e=>e.date===S?.date),t=B[Math.max(0,Math.min(B.length-1,s+e))];t&&(u(t.date),b.default.announceForAccessibility?.(P(t)))},P=e=>`${(0,F.longDay)(e.date)}, ${'recorded'===e.state?(0,F.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,N=h.current?`so far in ${h.month}`:`in ${h.month} ${l.slice(0,4)}`,R=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,F.monthName)((0,F.addMonths)(l,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,H=h.recorded?`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. ${(0,F.poundsWhole)(h.total)} ${N}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,F.longDay)(h.best.date)}, ${(0,F.poundsWhole)(h.best.value)}.${R?` ${R.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,W=r?ie(k,r):[],E=(e,s,t,o,a)=>(0,se.jsx)(f.default,{testID:a,accessibilityRole:"button",accessibilityLabel:s,accessibilityState:{disabled:!t},disabled:!t,onPress:()=>{i((0,F.addMonths)(l,o)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:t?e?.6:1:.25}),children:(0,se.jsx)(j.T,{size:24,colour:D.colours.gold,center:!0,children:e})});return(0,se.jsx)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center',gap:6},children:(0,se.jsxs)(m.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),y||p?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[E('\u2039',`Previous month, ${(0,F.monthName)((0,F.addMonths)(l,-1))}`,y,-1,'mt-prev'),(0,se.jsxs)(j.T,{center:!0,colour:D.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",l.slice(0,4)]}),E('\u203a',`Next month, ${(0,F.monthName)((0,F.addMonths)(l,1))}`,p,1,'mt-next')]}):null,(0,se.jsx)(m.default,{accessible:!0,accessibilityLabel:H,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(j.T,{size:38,weight:"bold",colour:D.colours.gold,center:!0,testID:"mt-total",children:(0,F.poundsWhole)(h.total)}),(0,se.jsx)(j.T,{center:!0,colour:D.colours.goldLight,children:N}),(0,se.jsxs)(j.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,F.shortDay)(h.best.date)," \xb7 ",(0,F.poundsWhole)(h.best.value)]}),R?(0,se.jsx)(j.Muted,{center:!0,testID:"mt-vs",children:R}):null]}):(0,se.jsx)(j.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,se.jsxs)(m.default,{style:{width:'100%',minWidth:0},children:[(0,se.jsxs)(m.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:oe,width:'100%',overflow:'visible'},children:[r?(0,se.jsxs)(n.default,{width:r,height:oe,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,se.jsx)(a.Defs,{children:(0,se.jsxs)(a.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,se.jsx)(a.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,se.jsx)(a.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,se.jsx)(a.Line,{x1:te,y1:$,x2:r-le,y2:$,stroke:D.colours.hairline,strokeWidth:1}),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:`${ne(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${s}`)),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:ne(e),stroke:D.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${s}`)),T.filter(e=>1===e.length).map((e,s)=>(0,se.jsx)(a.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:D.colours.gold},`s${s}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,se.jsx)(a.Circle,{cx:C(e.day),cy:$,r:2,fill:"none",stroke:D.colours.muted,strokeWidth:1},e.date)),S&&'recorded'===S.state?(0,se.jsx)(a.Line,{x1:C(S.day),y1:10,x2:C(S.day),y2:$,stroke:D.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===s);return(0,se.jsx)(a.Circle,{cx:C(e.day),cy:'recorded'===e.state?I(e.value):$,r:4.5,fill:D.colours.gold,stroke:D.colours.surface,strokeWidth:1.5})})():null,S&&'recorded'===S.state&&S.date!==s?(0,se.jsx)(a.Circle,{cx:C(S.day),cy:I(S.value),r:5,fill:D.colours.surface,stroke:D.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,se.jsx)(f.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:P(e),accessibilityState:{selected:S?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:oe,left:C(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,se.jsx)(m.default,{testID:"mt-axis",style:{height:O.AXIS_BAND+6,minHeight:O.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:W.map(e=>(0,se.jsx)(j.T,{size:O.AXIS_FONT,colour:D.colours.muted,style:{position:'absolute',left:C(e)-17,width:ae,top:0,textAlign:'center'},children:String(e)},e))})]}),S&&B.length?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,se.jsx)(f.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===S.date,onPress:()=>L(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u2039"})}),(0,se.jsxs)(m.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:P(S),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,se.jsx)(j.Muted,{center:!0,children:S.date===s?`Today \xb7 ${(0,F.shortDay)(S.date)}`:(0,F.shortDay)(S.date)}),(0,se.jsx)(j.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===S.state?D.colours.goldLight:D.colours.muted,children:'recorded'===S.state?(0,F.poundsWhole)(S.value):'pending'===S.state?'Not cashed up yet':'No cash-up'})]}),(0,se.jsx)(f.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===S.date,onPress:()=>L(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,se.jsx)(j.Muted,{center:!0,size:13,children:"From confirmed cash ups: gross takings, or card + cash. \u25cb = no cash up that day."})]})})}const de='#3A2F1E';function ce({split:e}){return(0,se.jsx)(j.Card,{style:{alignItems:'center',gap:8},children:(0,se.jsxs)(m.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,se.jsx)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,se.jsx)(j.Muted,{center:!0,children:"No Covers yet"}):(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",colour:D.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,se.jsxs)(m.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:de,borderWidth:1,borderColor:D.colours.gold},children:[(0,se.jsx)(m.default,{style:{width:`${e.walkInPct}%`,backgroundColor:D.colours.gold}}),(0,se.jsx)(m.default,{style:{flex:1,backgroundColor:de}})]})]})]})})}},1355,[829,1120,1356,34,900,1073,1148,1077,1078,1344,1281,851,1081,281,402,102,794,848,865,1157,830,836,1134,827,1075,855,840,1147,1100,1119,1125,1126,1024,13,1324,925,985,1365,1366,1136,838,1369,1151,1160,1159,1047,1048,1070,1096,1315,1130,1280,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:m,rid:L,today:P,me:O}=(0,R.useCtx)(6e4),Y=O.replace(" (example)",""),Z=m.settings,J=e=>k.useStore.getState().updateSettings(L,e),[X,se]=(0,b.useState)(()=>(0,d.takeAdvancedPrefill)()),[te,oe]=(0,b.useState)(null),ae=e=>{if(e.onReset)return e.onReset(),void oe(`${e.title}: back to the defaults.`);J(Object.fromEntries(e.reset.map(e=>[e,void 0]))),oe(`${e.title}: back to the defaults.`)},ne=(0,D.useBookings)(L),le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,N.jsx)(y.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,N.jsx)(y.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,N.jsx)(y.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,S.dogQuestionOn)(m),onChange:e=>J({dogQuestion:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,N.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:Z.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>J({maxDogsPerSlot:e||void 0})})]}),(0,N.jsx)(y.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,S.accessQuestionOn)(m),onChange:e=>J({accessQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,S.dietQuestionOn)(m),onChange:e=>J({dietQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==Z.tableRequests,onChange:e=>J({tableRequests:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),re=(0,S.dwellBands)(m),ie=(e,s)=>J({dwellBands:re.map((t,o)=>o===e?{...t,mins:s}:t)}),de=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),re.map((e,s)=>{const t=(0,S.dwellFor)(m,9999===e.upTo?20:e.upTo,ne);return(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:(0,S.bandLabel)(re,s)}),(0,N.jsx)(K,{label:`table time for ${(0,S.bandLabel)(re,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>ie(s,e)})]}),t.learned&&t.mins!==e.mins?(0,N.jsxs)(y.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,N.jsx)(y.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==Z.dwellLearn,onChange:e=>J({dwellLearn:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),he=Z.reservables??(0,C.reservablesOf)(m),ue=Z.reservables??('anchorage'===L?he:[]),ce=(e,s)=>J({reservables:ue.map(t=>t.id===e?{...t,...s}:t)}),pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[ue.length?ue.map(e=>(0,N.jsxs)(f.default,{style:{gap:4},children:[(0,N.jsx)(y.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>ce(e.id,{active:s})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.Muted,{children:"Price"}),(0,N.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>ce(e.id,{price:100*s})})]}),(0,N.jsxs)(y.Muted,{size:12,children:["Uses: ",e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')," from the counted stock. Held from the Display count and shown as \u201cReserved\u201d."]})]},e.id)):(0,N.jsx)(y.Muted,{children:"No reservable dishes yet."}),(0,N.jsx)(y.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==Z.reserveStock,onChange:e=>J({reserveStock:e})}),(0,N.jsx)(y.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),ge=(0,S.regularEventsOf)(m),[be,me]=(0,b.useState)(null),xe=e=>J({regularEvents:e}),fe=be?be.name.trim()?be.time&&!W.test(be.time)?'Start time looks wrong (use 20:00).':be.lastFood&&!W.test(be.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==be.rule.kind||U.test(be.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',ye=(0,N.jsxs)(f.default,{style:{gap:8},children:[ge.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,N.jsx)(y.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,N.jsx)(y.Badge,{kind:"neutral",label:"OFF"})]}),(0,N.jsxs)(y.Muted,{children:[(0,S.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,N.jsxs)(y.Muted,{size:12,children:["Next: ",(0,S.nextOccurrence)(e,P)??'\u2014']}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>me({...e})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>xe(ge.filter(s=>s.id!==e.id))})]})]},e.id)),be?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Name"}),(0,N.jsx)(q,{label:"Event name",width:220,value:be.name,onChange:e=>me({...be,name:e}),placeholder:"Open Mic Night"})]}),(0,N.jsx)(y.Muted,{children:"Repeats"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(y.Chip,{label:"Last \u2026 of the month",selected:'last'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'last',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"Every week",selected:'weekly'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'weekly',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"One-off date",selected:'once'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'once',date:P}})})]}),'weekday'in be.rule?(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:_.map(e=>(0,N.jsx)(y.Chip,{label:G[e],selected:be.rule.weekday===e,onPress:()=>me({...be,rule:{...be.rule,weekday:e}})},e))}):(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Event date",width:130,value:be.rule.date,onChange:e=>me({...be,rule:{kind:'once',date:e}}),placeholder:"2026-12-31"})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts (optional)"}),(0,N.jsx)(q,{label:"Start time",value:be.time??'',onChange:e=>me({...be,time:e||void 0}),placeholder:"20:00",bad:!!be.time&&!W.test(be.time)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Last food orders (optional)"}),(0,N.jsx)(q,{label:"Last food orders",value:be.lastFood??'',onChange:e=>me({...be,lastFood:e||void 0}),placeholder:"19:00",bad:!!be.lastFood&&!W.test(be.lastFood)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Notes"}),(0,N.jsx)(q,{label:"Notes",width:240,value:be.notes??'',onChange:e=>me({...be,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,N.jsx)(y.Toggle,{label:"Expect busier (raises the forecast)",value:be.busier,onChange:e=>me({...be,busier:e})}),(0,N.jsx)(y.Toggle,{label:"On",value:be.active,onChange:e=>me({...be,active:e})}),fe?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:fe}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save event",disabled:!!fe,testID:"event-save",onPress:()=>{const e={...be,name:be.name.trim()};xe(ge.some(s=>s.id===e.id)?ge.map(s=>s.id===e.id?e:s):[...ge,e]),me(null),oe(`Saved ${e.name}.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>me(null)})]})]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>me({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,N.jsx)(y.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),je=(0,v.hourSetsOf)(m),we=(0,v.seasonOn)(m,new Date),[ke,ve]=(0,b.useState)(null),[Ce,Se]=(0,b.useState)(null),Te=Z.hourOverrides??[],Re=ke?ke.start&&!H.test(ke.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ke.hours&&Object.values(ke.hours).some(e=>e&&(!W.test(e[0])||!W.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',De=Object.values(Z.lastFoodByDay??{}).some(e=>e&&!W.test(e)),Me=[];je.some(e=>!e.hours)&&Me.push(`${je.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);je.filter(e=>e.hours).length>=1&&je.length>1&&je.some(e=>!e.start)&&Me.push('the date each season starts');const Le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Me.length?(0,N.jsxs)(y.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Me.join(' and '),". Until then the app uses ",we?.name??'your weekly'," hours all year."]}):null,we?(0,N.jsxs)(y.T,{colour:T.colours.goldLight,children:["In use today: ",we.name]}):null,je.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",children:e.name}),we?.id===e.id?(0,N.jsx)(y.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,N.jsx)(y.Badge,{kind:"amber",label:"NOT SET"})]}),(0,N.jsx)(y.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,N.jsx)(y.Muted,{size:13,children:_.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,N.jsx)(y.Muted,{size:13,children:"No hours yet."}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>ve({...e,hours:e.hours?{...e.hours}:{...je.find(e=>e.hours)?.hours??m.kitchenHours}})})]},e.id)),ke?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.T,{weight:"semibold",children:[ke.name," hours"]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts every year on (MM-DD)"}),(0,N.jsx)(q,{label:"Season start date",value:ke.start??'',onChange:e=>ve({...ke,start:e||void 0}),placeholder:"04-01",bad:!!ke.start&&!H.test(ke.start)})]}),_.map(e=>{const s=ke.hours?.[e]??null,t=s=>ve({...ke,hours:{...ke.hours,[e]:s}});return(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.T,{style:{width:44},children:G[e]}),(0,N.jsx)(y.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:`${S.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!W.test(s[0])}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!W.test(s[1])||s[0]>=s[1]})]}):null]},e)}),Re?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:Re}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save hours",disabled:!!Re,testID:"season-save",onPress:()=>{var e;e=je.map(e=>e.id===ke.id?ke:e),J({hourSets:e}),ve(null),oe(`Saved ${ke.name} hours.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ve(null)})]})]}):null,(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,N.jsx)(y.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Te.map(e=>(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(y.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>J({hourOverrides:Te.filter(s=>s.date!==e.date)})})]},e.date)),Ce?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Special day date",width:130,value:Ce.date,onChange:e=>Se({...Ce,date:e}),placeholder:"2026-12-31",bad:!U.test(Ce.date)})]}),(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Chip,{label:Ce.hours?'Open':'Closed',selected:!!Ce.hours,onPress:()=>Se({...Ce,hours:Ce.hours?null:['12:00','19:00']})}),Ce.hours?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:"Opens",width:74,value:Ce.hours[0],onChange:e=>Se({...Ce,hours:[e,Ce.hours[1]]})}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:"Last food orders",width:74,value:Ce.hours[1],onChange:e=>Se({...Ce,hours:[Ce.hours[0],e]})})]}):null]}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Note"}),(0,N.jsx)(q,{label:"Note",width:220,value:Ce.note??'',onChange:e=>Se({...Ce,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=U.test(Ce.date)?Ce.hours&&(!W.test(Ce.hours[0])||!W.test(Ce.hours[1])||Ce.hours[0]>=Ce.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,N.jsxs)(N.Fragment,{children:[e?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:e}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{J({hourOverrides:[...Te.filter(e=>e.date!==Ce.date),Ce].sort((e,s)=>e.date.localeCompare(s.date))}),Se(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Se(null)})]})]})})()]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Se({date:P,hours:null})}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,N.jsx)(y.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:_.map(e=>(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.Muted,{size:12,children:G[e]}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,width:74,value:Z.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!Z.lastFoodByDay?.[e]&&!W.test(Z.lastFoodByDay[e]),onChange:s=>J({lastFoodByDay:{...Z.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),De?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,N.jsx)(y.Muted,{children:"After last food orders, booking times are\u2026"}),(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'drinks'})}),(0,N.jsx)(y.Chip,{label:"Not offered",selected:'block'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'block'})})]})]}),Pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,S.coversCounterOn)(m),onChange:e=>J({coversCounter:e})}),(0,N.jsx)(y.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,S.nextTableOn)(m),onChange:e=>J({nextTableFree:e})}),(0,N.jsx)(y.Toggle,{label:"Show takeaway on home screens",value:(0,S.showTakeaway)(m),onChange:e=>J({showTakeaway:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,N.jsx)(y.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),Oe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!Z.holidayFullNames,onChange:e=>J({holidayFullNames:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[ze,Ie]=(0,b.useState)(null),$e=ze??Z.whatsapp??'',Be=!$e.trim()||!!(0,M.waNumber)($e),Ae=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.T,{children:"The venue\u2019s WhatsApp number"}),(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:$e,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{Ie(e),e.trim()?(0,M.waNumber)(e)&&J({whatsapp:e.trim()}):J({whatsapp:void 0})}}),$e.trim()&&Be?(0,N.jsx)(y.Badge,{kind:"gold",label:`wa.me/${(0,M.waNumber)($e)}`}):null]}),Be?null:(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,N.jsx)(y.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Fe=(0,E.soldOutSettingsOf)(Z.soldOut),Ee=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Fe.auto,onChange:e=>J({soldOut:{...Fe,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,N.jsx)(y.Muted,{size:13,children:Fe.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,N.jsx)(y.T,{children:"Clear sold out dishes by themselves"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-soldout-${e}`,label:E.SOLD_OUT_CLEAR_LABEL[e],selected:Fe.clear===e,onPress:()=>J({soldOut:{...Fe,clear:e}})},e))}),'manual'!==Fe.clear?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(y.T,{children:"Next morning means"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,N.jsx)(y.Chip,{label:e,selected:Fe.morningAt===e,onPress:()=>J({soldOut:{...Fe,morningAt:e}})},e))})]}):null,(0,N.jsx)(y.Muted,{size:13,children:'close'===Fe.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Fe.clear?`Dishes go back on at ${Fe.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),Ne=(0,s.venueBusy)(m,ne,new Date),We=(0,F.clampWeeks)(Z.forecastMinWeeks),He=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(f.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:Ne.words,children:[(0,N.jsx)(y.T,{center:!0,size:20,weight:"semibold",children:Ne.words}),(0,N.jsx)(y.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:Z.busyCoversPerHour??30,min:1,max:200,onChange:e=>J({busyCoversPerHour:e,busyLearning:!1})}),(0,N.jsx)(y.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,N.jsx)(y.Toggle,{label:"Learn the busy level from our real history",value:!1!==Z.busyLearning,onChange:e=>J({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),Ne.enough?null:(0,N.jsx)(y.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,N.jsx)(y.T,{children:"History needed before forecasts show"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:We===e,onPress:()=>J({forecastMinWeeks:e})},e))}),(0,N.jsx)(y.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===We?'1 week':`${We} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,N.jsx)(n.ForecastDaySettings,{r:m,set:J})]}),Ue=(0,j.depositOf)(Z),Ge=e=>J({deposit:{...Ue,...e}}),qe=t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ue.on,onChange:e=>Ge({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Amount per person"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-amount",value:Ue.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"From a party of"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-party",value:Ue.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from party size"})]}),(0,N.jsx)(y.T,{children:"Refundable?"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:8,children:[(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ue.refundable,onPress:()=>Ge({refundable:!0})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ue.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ue.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ue.refundable?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Refunded if cancelled this many hours before"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-cutoff",value:Ue.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,N.jsx)(y.T,{children:"Words guests see (optional)"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ue.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:T.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,padding:10,fontSize:15}}),(0,N.jsx)(y.Muted,{size:13,children:Ue.on&&Ue.perPersonPence>0?`Guests booking for ${Ue.fromParty} or more see: \u201c${(0,j.depositWords)(Ue,Ue.fromParty,m.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,N.jsx)(y.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ue.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ue.wixLinksOn?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Link works for"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-linkhours",value:Ue.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,N.jsx)(y.Muted,{size:13,children:Ue.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,N.jsx)(w.LoyaltySettingsPanel,{}),Qe=(0,N.jsx)(ee,{rid:L}),Ye=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:le,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:de,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:pe,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:ye,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Le,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Pe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsx)(l.TableOrderSettings,{rid:L,me:Y}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Ae,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>V(L)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,N.jsx)(B.NotificationsSettings,{rid:L}),help:'adv-notifications',onReset:()=>A.useNotifs.getState().resetSeeds(L)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,N.jsx)(B.OrderListsSettings,{rid:L}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(L)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,N.jsx)(u.TaskLibrarySettings,{rid:L}),help:'adv-tasks',onReset:()=>g.useDailyTasks.getState().resetLibrary(L)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,N.jsx)(c.CashUpSettings,{rid:L}),help:'adv-cashup',onReset:()=>p.useCashUp.getState().resetFields(L)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,N.jsx)(c.TipsSettings,{rid:L}),help:'adv-tips',onReset:()=>p.useCashUp.getState().setShow(L,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,N.jsx)(B.ClockAreaSettings,{rid:L,me:Y}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(L,Y)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,N.jsx)(h.HrSettingsCard,{rid:L}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:He,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ee,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,N.jsx)(z.GridSettings,{rid:L,me:Y}),help:'adv-tablegrid',onReset:()=>{const e=$.useFloor.getState().settings[L];$.useFloor.getState().setSettings(L,{...$.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,N.jsx)(I.PrintersSettings,{rid:L,go:e}),help:'adv-printers',onReset:()=>{const e=$.useFloor.getState().settings[L];e&&$.useFloor.getState().setSettings(L,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,N.jsx)(i.BlockSettings,{rid:L}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,N.jsx)(r.GiftQrSettings,{rid:L}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:Oe,help:'adv-holidays'}],Ve=X.trim().toLowerCase(),Ze=(0,b.useMemo)(()=>Ye.filter(e=>!Ve||`${e.title} ${e.words}`.toLowerCase().includes(Ve)),[Ve,Ye]);return(0,N.jsxs)(f.default,{style:{gap:12},testID:"advanced-settings",children:[(0,N.jsx)(y.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:X,onChangeText:se,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:T.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:T.colours.accentBorder,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:12,fontSize:16}}),te?(0,N.jsx)(y.Banner,{kind:"success",title:te}):null,Ze.length?null:(0,N.jsxs)(y.Muted,{children:["No settings match \u201c",X,"\u201d."]}),Ze.map(s=>(0,N.jsx)(y.Card,{children:(0,N.jsxs)(f.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{size:17,weight:"semibold",colour:T.colours.gold,children:s.title}),e?(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,N.jsx)(y.T,{colour:T.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,N.jsx)(y.Row,{style:{justifyContent:'flex-end'},children:(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ae(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return Y}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,R.useCtx)(6e4),t=(0,v.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,N.jsx)(y.Card,{onPress:()=>e('more','advanced'),highlight:T.colours.gold,children:(0,N.jsxs)(f.default,{testID:"seasons-todo",style:{gap:4},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",colour:T.colours.gold,children:"Setup checklist: kitchen hours"}),(0,N.jsx)(y.T,{colour:T.colours.muted,children:"\u203a"})]}),(0,N.jsxs)(y.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=e(b),x=e(_r(_d[15])),f=e(_r(_d[16])),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),z=_r(_d[31]),I=_r(_d[32]),$=_r(_d[33]),B=_r(_d[34]),A=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]);const W=/^([01]\d|2[0-3]):[0-5]\d$/,H=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,U=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:n=90,bad:l,testID:r}){return(0,N.jsx)(a.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:T.colours.muted,style:{width:n,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?T.colours.red:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:T.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,N.jsx)(y.T,{size:20,colour:T.colours.gold,children:a})});return(0,N.jsxs)(y.Row,{gap:8,children:[r('\u2212',-l),(0,N.jsx)(y.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const Y={DEFAULT_DWELL:S.DEFAULT_DWELL,ANCHORAGE_SEASONS:v.ANCHORAGE_SEASONS};function V(e){const s=L.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,L.chairsId)(e))}const Z=[1,2,3,4,5,6,0],J=e=>`${7===e.days.length?'Every day':Z.filter(s=>e.days.includes(s)).map(e=>P.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${P.AUDIENCE_LABEL[e.audience]}`;function X({init:e,onSave:s,onCancel:t}){const[o,n]=(0,b.useState)(e.text),[l,r]=(0,b.useState)(e.days),[i,d]=(0,b.useState)(e.time),[h,u]=(0,b.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,P.validTime)(i);return(0,N.jsxs)(f.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:T.colours.accentBorder,borderRadius:12,padding:10},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"What it says"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:n,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:T.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}}),(0,N.jsx)(y.T,{weight:"semibold",children:"Days"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,N.jsx)(y.Chip,{label:P.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Time (UK)"}),(0,N.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,P.validTime)(i)})]}),(0,N.jsx)(y.T,{weight:"semibold",children:"Who sees it"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,N.jsx)(y.Chip,{label:P.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,N.jsx)(y.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,N.jsxs)(y.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,N.jsx)(y.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function ee({rid:e}){m.default.useEffect(()=>{L.useReminders.getState().ensure(e)},[e]);const s=(0,L.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,L.useReminders)(s=>s.rules[e]),a=(0,P.clampRules)(o??P.DEFAULT_BREAK_RULES),n=(0,L.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,O.useOwner)(e=>e.staff),r=L.useReminders.getState(),[i,d]=(0,b.useState)(null),[h,u]=(0,b.useState)(null),c=s=>r.setRules(e,s);return(0,N.jsxs)(f.default,{style:{gap:10},testID:"reminders-settings",children:[(0,N.jsx)(y.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,N.jsx)(y.T,{weight:"semibold",children:"Break reminders"}),(0,N.jsx)(y.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,N.jsx)(K,{label:"first break reminder",step:15,min:30,max:P.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Remind once more after"}),(0,N.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,N.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,N.jsxs)(y.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,N.jsx)(f.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:T.colours.hairline,paddingBottom:8},children:i===e.id?(0,N.jsx)(X,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,N.jsx)(y.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,N.jsx)(y.Muted,{size:13,children:J(e)}),h===e.id?(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,N.jsx)(y.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,N.jsx)(y.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,N.jsx)(X,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,N.jsxs)(y.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,N.jsxs)(y.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (Fri and Sun, 21:00); your own reminders stay."]}),(0,N.jsx)(y.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1356,[1121,5,1341,796,1357,1358,1360,1361,1362,1156,1047,1048,1024,1029,34,402,102,794,14,1363,800,852,1075,851,840,1100,848,1150,1001,1002,865,1364,1310,1014,1043,1021,1123,978,25]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1357,[796,34,102,794,1120,851,840,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1358,[829,34,236,102,794,848,1014,1131,1205,985,1276,1359,25]); -__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1359,[829,1229]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrSettings=function({rid:e}){const s=(0,n.useFloor)(t=>t.settings[e]),h={...n.DEFAULT_SETTINGS,...s??{}},[p,y]=(0,t.useState)(h.giftQrUrl??''),[Q,b]=(0,t.useState)(''),S=t=>n.useFloor.getState().setSettings(e,{...h,...t}),x=(0,u.giftQrUrlOk)(p);return(0,c.jsxs)(l.default,{style:{gap:8},testID:"adv-giftqr-panel",children:[(0,c.jsx)(o.Toggle,{testID:"giftqr-on",label:"Show \u201cBuy a gift card\u201d on the Display",value:!!h.giftQrOn,disabled:!h.giftQrOn&&!(0,u.giftQrUrlOk)(h.giftQrUrl),onChange:e=>{S({giftQrOn:e}),b(e?'On: the Display shows Buy a gift card.':'Off: the Display hides Buy a gift card.')}}),(0,c.jsx)(o.Field,{testID:"giftqr-url",label:"Your gift card page (https://\u2026)",value:p,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>{y(e.slice(0,u.GIFT_QR_MAX)),b('')},placeholder:"https://www.example.com/gift-card"}),p&&!x?(0,c.jsx)(o.T,{size:13,colour:f.colours.amber,children:"Use the full address starting https://"}):null,(0,c.jsx)(o.Button,{small:!0,label:"Save the page address",testID:"giftqr-save",disabled:!x||p.trim()===(h.giftQrUrl??''),onPress:()=>{S({giftQrUrl:p.trim()}),b('Saved. The Display QR opens this page.')}}),Q?(0,c.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(o.Muted,{children:Q})}):null,(0,c.jsx)(o.Muted,{size:13,children:"Gift cards are sold through your website. The Display shows only a QR code and \u201cScan to buy a gift card on your phone\u201d: no prices or balances."})]})};var e,t=r(d[0]),s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),u=r(d[4]),f=r(d[5]),c=r(d[6])},1360,[34,102,794,1014,1285,840,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"websiteBlocksSynced",{enumerable:!0,get:function(){return m}}),_e.BlockSettings=function({rid:e}){const n=(0,s.useFloor)(n=>n.settings[e]),h={...s.DEFAULT_SETTINGS,...n??{}},b=h.serviceWindows??{},w=b.lunch??['12:00','17:00'],f=b.dinner??['17:00','21:00'],k=(n,t)=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:{...b,[n]:t}}),y=(e,n,t,s)=>(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{style:{flex:1},children:e}),(0,u.jsx)(o.Stepper,{testID:s,label:e,value:(0,l.toMins)(n),min:360,max:1425,step:15,format:e=>(0,c.fmt12)((0,l.fromMins)(e)),onChange:t})]});return(0,u.jsxs)(t.default,{style:{gap:8},testID:"adv-blocks-panel",children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Lunch and dinner"}),(0,u.jsx)(o.Muted,{children:"Used by Block now (the Lunch and Dinner buttons) and Spend per head. Always kept inside the kitchen hours for the day."}),b.lunch||b.dinner?null:(0,u.jsx)(o.Muted,{testID:"sw-usual",children:"Usual times now: lunch from opening to 5:00pm, dinner from 5:00pm to close. Change a time below to set your own."}),y('Lunch starts',w[0],e=>k('lunch',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(w[1])-15)),w[1]]),'sw-lunch-from'),y('Lunch ends',w[1],e=>k('lunch',[w[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(w[0])+15))]),'sw-lunch-to'),y('Dinner starts',f[0],e=>k('dinner',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(f[1])-15)),f[1]]),'sw-dinner-from'),y('Dinner ends',f[1],e=>k('dinner',[f[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(f[0])+15))]),'sw-dinner-to'),b.lunch||b.dinner?(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Use the usual times",onPress:()=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:void 0})}):null,(0,u.jsx)(o.T,{weight:"semibold",style:{marginTop:8},children:"Block on website bookings too"}),m(e)?(0,u.jsx)(o.Muted,{testID:"wix-block-sync-on",children:"On. A whole-day or time block made in CoverCharge also closes those times for online booking on your website, editing or removing it updates the website, and blocks made on the website show here too. Website bookings can only close the whole venue, not one area or some tables."}):(0,u.jsx)(o.Muted,{testID:"wix-block-sync-off",children:"Website bookings aren\u2019t connected for this venue yet. Once they are, a whole-day or time block made in CoverCharge also closes those times for online booking on your website. Until then, the website can still take bookings in a blocked time, so check those."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);const m=e=>!h.IS_ISOLATED_VENUE&&'anchorage'===e},1361,[34,102,794,1014,827,1318,5,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"advancedPrefill",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"takeAdvancedPrefill",{enumerable:!0,get:function(){return n}});const t={q:''},n=()=>{const n=t.q;return t.q='',n}},1362,[]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,u.staffServer)(),[s,h]=(0,t.useState)(null),[x,y]=(0,t.useState)([]),[p,j]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),v=(0,t.useCallback)(async()=>{try{const[e,t]=await Promise.all([(0,u.readSettings)(),(0,u.readOffers)()]);h(e),y(t)}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,u.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,c.jsx)(l.Banner,{kind:"info",title:"Not connected",children:"Loyalty settings are saved on the server. Not set up yet: sign in to the venue on this device to change them."});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const O=e=>{h({...s,...e}),j(null)},S=(0,o.checkSettings)(s),C=async()=>{if(!S){b(!0);try{await(0,u.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}b(!1)}},T=e=>e?`${e} days`:'Never';return(0,c.jsxs)(n.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Stamp card"}),(0,c.jsx)(l.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps for a reward"}),(0,c.jsx)(l.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,c.jsx)(l.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps run out after"}),(0,c.jsx)(l.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Rewards run out after"}),(0,c.jsx)(l.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Minutes between stamps (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most stamps a day (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,c.jsx)(l.T,{weight:"semibold",children:"Bring a friend"}),(0,c.jsx)(l.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,c.jsx)(l.Field,{label:"Reward for the guest who brings a friend",value:s.referralGiver,onChangeText:e=>O({referralGiver:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsx)(l.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most friend rewards a month (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:S}):null,p?(0,c.jsx)(l.Banner,{kind:p.kind,title:p.text}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{C()}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>h({...o.DEFAULT_LOYALTY})})]}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: a friend reward is given when the friend gets their first stamp, and a guest can\u2019t use their own code. Stamps only come from staff, or from a code or QR staff make."}),(0,c.jsx)(l.T,{weight:"semibold",children:"Offers"}),x.length?x.map(e=>(0,c.jsx)(f,{o:e,onSaved:v},e.id)):(0,c.jsx)(l.Muted,{children:"No offers yet."}),(0,c.jsx)(f,{onSaved:v}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: guests see an offer only while it\u2019s on and between its dates. Leave the dates blank to run it until you turn it off."})]})},_e.LoyaltySummaryCard=function({kind:e="card"}){const[s,a]=(0,t.useState)(null),[h,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,u.loyaltySummary)().then(a,e=>f((0,o.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,u.staffServer)())return x(),(0,u.watchLoyalty)(x)},[x]),!(0,u.staffServer)())return null;if(h)return(0,c.jsx)(l.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:h});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const y='card'===e?[['Guests with a card',s.members],['Joined this month',s.joinedMonth],['Stamps this week',s.stampsWeek],['Stamps this month',s.stampsMonth],['Rewards ready to use',s.rewardsReady],['Rewards used this month',s.rewardsUsedMonth],['Offers live now',s.offersLive]]:[['Friends waiting for their first stamp',s.referralsWaiting],['Friend rewards given',s.referralsRewarded]];return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,c.jsx)(l.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{children:e}),(0,c.jsx)(l.T,{weight:"semibold",children:t})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: these are your real numbers from the server. Change the card in Settings \u203a Advanced \u203a Loyalty."})]})})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=r(d[2]),l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]);const h=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function f({o:e,onSaved:s}){const[f,x]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[y,p]=(0,t.useState)(!!e),[j,w]=(0,t.useState)(null);if(!e&&!y)return(0,c.jsx)(l.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>p(!0)});const b=(!f.startsOn||h.test(f.startsOn))&&(!f.endsOn||h.test(f.endsOn))?(0,o.checkOffer)({title:f.title,details:f.details,startsOn:f.startsOn||null,endsOn:f.endsOn||null}):'Dates look like 2026-12-01.',v=async()=>{if(!b)try{await(0,u.saveOffer)({id:e?.id,title:f.title.trim(),details:f.details.trim(),startsOn:f.startsOn||null,endsOn:f.endsOn||null,isOn:f.isOn}),w('Saved.'),e||(x({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),p(!1)),s()}catch(e){w((0,o.plainError)(e))}};return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[e?(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{weight:"semibold",children:e.title}),(0,c.jsx)(l.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,c.jsx)(l.T,{weight:"semibold",children:"New offer"}),(0,c.jsx)(l.Field,{label:"Title",value:f.title,onChangeText:e=>x({...f,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,c.jsx)(l.Field,{label:"Details",value:f.details,onChangeText:e=>x({...f,details:e.slice(0,500)}),multiline:!0}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Field,{label:"Starts (optional)",value:f.startsOn,onChangeText:e=>x({...f,startsOn:e.trim()}),placeholder:"2026-12-01"}),(0,c.jsx)(l.Field,{label:"Ends (optional)",value:f.endsOn,onChangeText:e=>x({...f,endsOn:e.trim()}),placeholder:"2026-12-24"})]}),(0,c.jsx)(l.Toggle,{label:"Offer on",value:f.isOn,onChange:e=>x({...f,isOn:e})}),b&&(f.title||e)?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:b}):null,j?(0,c.jsx)(l.Muted,{size:13,children:j}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{small:!0,label:"Save offer",disabled:!!b,onPress:()=>{v()}}),e?null:(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>p(!1)})]})]})})}},1363,[34,102,840,794,1202,1205,25]); -__d(function(_g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.tidyWholePlan=u,_e.restoreTidy=h,_e.GridSettings=function({rid:e,me:s}){const p=(0,r.useFloor)(t=>t.settings[e]),c={...r.DEFAULT_SETTINGS,...p??{}},y=t=>r.useFloor.getState().setSettings(e,{...c,...t}),[b,S]=(0,t.useState)(''),f=(0,o.gridOf)(c.gridSize),v=c.tidyBackup,T=v?new Date(v.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'';return(0,g.jsxs)(n.default,{style:{gap:8},children:[(0,g.jsx)(a.Toggle,{testID:"adv-grid-snap",label:"Snap tables to the grid when dragging",value:!1!==c.gridSnap,onChange:e=>y({gridSnap:e}),a11y:"Snap tables to the grid when dragging"}),(0,g.jsx)(a.Muted,{size:13,children:!1!==c.gridSnap?'On: tables jump to the nearest grid line and line up with other tables (gold guides show when edges or centres match). Hold Alt (Option on a Mac) while dragging to move freely.':'Off: tables go exactly where you let go. Gold guides still help you line them up.'}),(0,g.jsx)(a.T,{children:"Grid size"}),(0,g.jsx)(a.Row,{wrap:!0,gap:8,children:o.GRID_SIZES.map(e=>(0,g.jsx)(a.Chip,{testID:`adv-grid-${e}`,label:10===e?'Fine (10)':25===e?'Normal (25)':'Coarse (50)',selected:f===e,onPress:()=>y({gridSize:e})},e))}),(0,g.jsx)(a.Button,{testID:"adv-grid-tidy",label:"Tidy up the whole plan",onPress:()=>{const t=u(e,s,(new Date).toISOString());S(t.moved?`Tidied: ${t.moved} tables lined up on the grid. The old positions are kept below.`:'Already tidy. Nothing moved.')}}),(0,g.jsx)(a.Muted,{size:13,children:"Tidy up snaps every table to the grid and evens out the rows, area by area. Only positions change: table numbers, areas, Covers, sizes and best tables stay as they are."}),v?(0,g.jsxs)(n.default,{testID:"adv-grid-backup",style:{borderWidth:1,borderColor:l.colours.gold,borderRadius:10,padding:10,gap:6},children:[(0,g.jsxs)(a.T,{size:14,children:["Positions from before the tidy on ",T,v.by?` (${v.by})`:''," are kept."]}),(0,g.jsx)(a.Button,{testID:"adv-grid-restore",kind:"secondary",label:"Put the tables back where they were",onPress:()=>{h(e)&&S('Done: every table is back where it was before the tidy.')}})]}):null,b?(0,g.jsx)(a.Banner,{kind:"success",title:b}):null,(0,g.jsx)(a.Muted,{size:13,children:"Tip: in the table plan editor, Tidy up does one area at a time and you can undo it with \u2318Z (Ctrl+Z)."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),g=_r(d[6]);function u(e,t,s){const n=r.useFloor.getState(),a=n.plans[e]??(0,r.planOf)(e),l={...r.DEFAULT_SETTINGS,...n.settings[e]??{}};let g=a;for(const e of a.areas)g=(0,o.tidyArea)(g,e.id,(0,o.gridOf)(l.gridSize));const u=(0,o.movedCount)(a,g);return u?(n.setSettings(e,{...l,tidyBackup:(0,o.backupOf)(a,s,t,'Before Tidy up')}),n.setPlan(e,g),{moved:u}):{moved:u}}function h(e){const t=r.useFloor.getState(),s={...r.DEFAULT_SETTINGS,...t.settings[e]??{}},n=s.tidyBackup;return!!n&&(t.setPlan(e,(0,o.restoreFrom)(t.plans[e]??(0,r.planOf)(e),n)),t.setSettings(e,{...s,tidyBackup:void 0}),!0)}},1364,[34,102,794,1014,1294,840,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1365,[798,34,283,364,236,102,426,900,794,796,840,1324,25]); -__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1366,[925,800,798,806,852,1061,1367,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1166,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1367,[499,1368]); -__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 t}});var t={}},1368,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProgressBar=B,_e.useSetupDone=O,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,C.useCtx)(6e4),n=O(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=f.SETUP_STEPS.findIndex(e=>e.id===a),s=f.SETUP_STEPS[e+1]?.id??null;return(0,E.jsx)(D,{id:a,wizard:!0,onBack:()=>l(e>0?f.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=f.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,E.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{gap:12,children:[(0,E.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsxs)(x.T,{size:20,weight:"bold",colour:S.colours.gold,children:["Set up ",t.name]}),(0,E.jsx)(x.Muted,{children:n.loading?'Checking what is already set up\u2026':i?'Everything is set up. Open any step to check or change it.':'Nine short steps. Do them in order or jump to any one; you can come back to each from Settings.'})]})]}),(0,E.jsx)(B,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,E.jsx)(x.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,E.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:S.colours.border,backgroundColor:S.colours.surface,overflow:'hidden'},children:f.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,E.jsxs)(h.default,{testID:`setup-step-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Step ${s+1}: ${e.title}${t?', done':o.length?`, still needed: ${o.join(', ')}`:''}`,onPress:()=>l(e.id),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',gap:12,padding:12,minHeight:60,borderTopWidth:s?1:0,borderColor:S.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,E.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?S.colours.gold:'transparent',borderWidth:1.5,borderColor:t?S.colours.gold:S.colours.border},children:(0,E.jsx)(x.T,{weight:"bold",colour:t?S.colours.onGold:S.colours.muted,children:t?'\u2713':s+1})}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"medium",children:e.title}),(0,E.jsx)(x.Muted,{children:e.sub}),o.length?(0,E.jsxs)(x.T,{size:13,colour:S.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,E.jsx)(x.Badge,{kind:"ok",label:"Done"}):null,(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=D,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return _}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,C.useCtx)(6e4),t=O(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,E.jsxs)(x.Card,{onPress:()=>e('more','setup'),highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:"Finish setting up"}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]}),(0,E.jsx)(B,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,E.jsxs)(x.Muted,{size:13,children:["Next: ",f.SETUP_STEPS.find(e=>!t.isDone(e.id))?.title]})]})};var s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),o=_r(_d[3]),a=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(_r(_d[4])),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=e(_r(_d[11])),g=e(_r(_d[12])),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),j=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),k=_r(_d[20]),w=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),T=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),E=_r(_d[27]);const M=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],R=[1,2,3,4,5,6,0],z=/^([01]\d|2[0-3]):[0-5]\d$/,$=e=>{const s=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(s)&&s>0?Math.round(100*s):null},I=e=>f.SETUP_STEPS.findIndex(s=>s.id===e)+1;function B({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,E.jsxs)(g.default,{testID:t,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:s,now:e},accessibilityLabel:`${e} of ${s} steps done`,style:{gap:4},children:[(0,E.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:S.colours.gold,borderRadius:5}})}),(0,E.jsxs)(x.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function O(e){const s=(0,f.useSiteSetup)(e),t=(0,p.useBrand)(e),{status:n,live:o}=(0,r.useSetupStatus)(),a=(0,c.useMemo)(()=>n?(0,l.evalSetup)(n,{logo:!!t.logo,email:s.email,bookingUrl:s.bookingUrl}):null,[n,t.logo,s.email,s.bookingUrl]),d=(0,i.useSetupMarksLoaded)(),u=e=>a?(0,i.applyMark)(!!a[e]?.done,d[e]):!!s.done[e],h=f.SETUP_STEPS.filter(e=>u(e.id)).length;return{isDone:u,markOf:e=>d[e],missing:e=>a?a[e]?.missing??[]:[],prog:{done:h,total:f.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function D({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,C.useCtx)(6e4),l=O(a),r=l.prog,d=(0,i.useLiveVenue)(),u=f.SETUP_STEPS.find(s=>s.id===e),[p,b]=(0,c.useState)(null),m=U[e];return(0,E.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsxs)(x.T,{size:12,weight:"semibold",colour:S.colours.gold,children:["STEP ",I(e)," OF ",f.SETUP_STEPS.length]}),s&&o?(0,E.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,E.jsx)(x.T,{size:13,colour:S.colours.muted,children:"All steps"})}):null]}),(0,E.jsx)(x.T,{size:22,weight:"bold",children:u.title}),(0,E.jsx)(B,{done:r.done,total:r.total})]}),(0,E.jsx)(m,{rid:a,done:(t="Saved.")=>{f.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():b(t)},wizard:!!s}),p?(0,E.jsx)(x.Banner,{kind:"success",title:p}):null,(0,E.jsx)(W,{rid:a,id:e,title:u.title,onDone:b}),s?(0,E.jsxs)(x.Row,{gap:10,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,E.jsx)(x.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const L=({wizard:e,onPress:s,disabled:t,label:n})=>(0,E.jsx)(x.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const A=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function F({rid:e,done:n,wizard:o,payList:a=!1}){const l=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,j.useOwner)(e=>e.hourly),i=(0,C.useHourly)(),d=(0,f.useSiteSetup)(e),u=(0,f.useSetup)(e=>e.looks),[p,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),v=e=>{const s=d.grades.find(s=>s.id===d.staffGrade[e.id]);return e.salaried&&null==r[e.id]?'Salaried, no hourly wage':s&&!a?`${s.name} grade`:null==r[e.id]?'Pay not set':null!=i[e.id]?`${(0,w.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];m({id:e.id,name:e.name,job:e.job,access:(0,f.accessOf)(e.level,e.role),pay:e.salaried&&null==r[e.id]?'salaried':s?'grade':'own',gradeId:s??d.grades[0]?.id??'',wage:null!=i[e.id]?(i[e.id]/100).toFixed(2):'',noTax:!!e.noTax,look:u[e.id]??null}),T(null)},M=!!p?.id&&(R=p.id,k.ROSTER.some(e=>e.id===R));var R;const z=p?$(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=z||M&&!p.wage);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Muted,{children:[l.length," people. Tap someone to change their pay, tax or avatar. People from your roster keep their name, access and personal link."]}),(0,E.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,E.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>P(e),style:({pressed:s})=>({flexDirection:'row',alignItems:'center',gap:10,padding:10,borderRadius:14,borderWidth:1,borderColor:p?.id===e.id?S.colours.gold:S.colours.border,backgroundColor:s?'#1d1a14':S.colours.surface}),children:[(0,E.jsx)(b.StaffAvatar,{id:e.id,size:42}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"semibold",children:e.name}),(0,E.jsxs)(x.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,f.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,E.jsx)(x.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,f.accessOf)(e.level,e.role)})]},e.id))}),y?(0,E.jsx)(x.Banner,{kind:"success",title:y}):null,p?(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsx)(x.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:S.colours.gold},children:(0,E.jsx)(b.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsx)(x.Muted,{children:"Choose an original icon or keep a crew look. A personal avatar takes priority. They can change their own in My avatar."}),(0,E.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>m({...p,look:e.look})}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>m({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>m({...p,look:null})}):null]})]})]}),M?(0,E.jsxs)(x.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,E.jsx)(x.Field,{label:"Name",value:p.name,onChangeText:e=>m({...p,name:e}),placeholder:"First and last name"}),(0,E.jsx)(x.Field,{label:"Job title",value:p.job,onChangeText:e=>m({...p,job:e}),placeholder:"e.g. Kitchen porter"}),M?null:(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Access level"}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,selected:p.access===e,onPress:()=>m({...p,access:e})},e))}),(0,E.jsxs)(x.Muted,{size:13,children:["Uses the ",f.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Pay"}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[a?null:(0,E.jsx)(x.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>m({...p,pay:'grade'})}),(0,E.jsx)(x.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>m({...p,pay:'own'})}),(0,E.jsx)(x.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>m({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,E.jsx)(x.Chip,{label:`${e.name} \xb7 ${(0,w.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>m({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,E.jsx)(x.Field,{label:"\xa3 per hour",value:p.wage,onChangeText:e=>m({...p,wage:e}),keyboardType:"decimal-pad",placeholder:M?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=z&&z<1271?(0,E.jsx)(x.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,E.jsx)(x.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>m({...p,noTax:e})}),(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>m(null),style:{flex:1}}),(0,E.jsx)(x.Button,{label:p.id?'Save':'Add to team',testID:"staff-save",disabled:!I,onPress:()=>{if(!p||!I)return;const s=j.useOwner.getState();let t=p.id;if(!t){const e=new Set(s.staff.map(e=>e.id));if(s.addStaff(p.name.trim(),f.ACCESS_ROLE[p.access],p.job.trim()||'Team member'),t=j.useOwner.getState().staff.find(s=>!e.has(s.id))?.id,!t)return}const n={job:p.job.trim()||'Team member',salaried:'salaried'===p.pay,noTax:p.noTax};M||Object.assign(n,{name:p.name.trim(),level:p.access,role:f.ACCESS_ROLE[p.access],dept:'Head Chef'===p.access?'Kitchen':void 0}),s.updateStaff(t,n);const o={...d.staffGrade};if('grade'===p.pay){const e=d.grades.find(e=>e.id===p.gradeId);e&&(a&&d.staffGrade[t]===p.gradeId||s.setRate(t,e.pence),o[t]=e.id)}else delete o[t],'own'===p.pay&&null!=z&&s.setRate(t,z);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),f.useSetup.getState().patch(e,{staffGrade:o}),f.useSetup.getState().setLook(t,p.look),T(`${p.name.trim()} ${p.id?'updated':'added'}.`),m(null)},style:{flex:1}})]}),p.id?null:(0,E.jsx)(x.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,E.jsx)(x.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{m(A(d.grades[0]?.id??'')),T(null)}}),(0,E.jsx)(L,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const U={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,f.useSiteSetup)(e),[i,d]=(0,c.useState)({name:o.name,address:o.address??o.location,phone:o.phone??'',email:r.email,tagline:o.tagline}),[u,h]=(0,c.useState)('');return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,E.jsx)(x.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,E.jsx)(x.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,E.jsx)(x.Field,{label:"Email",accessibilityLabel:"Venue email address",keyboardType:"email-address",inputMode:"email",autoCapitalize:"none",autoCorrect:!1,value:i.email,onChangeText:e=>d({...i,email:e})}),(0,E.jsx)(x.Field,{multiline:!0,numberOfLines:3,label:"Tagline",value:i.tagline,onChangeText:e=>d({...i,tagline:e}),placeholder:"e.g. Seafood and real ale by the harbour"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Logo"}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsxs)(x.Muted,{children:[l.custom?'Your uploaded logo.':'anchorage'===e?'The Anchorage logo in black and gold.':'greenside'===e?'The Greenside Restaurant logo.':'abbotsford'===e?'The Abbotsford Hotel logo.':'kirkton'===e?'The Kirkton Inn logo.':'wildings'===e?'The Wildings Hotel & Restaurant logo.':'kirkmichael'===e?'The Kirkmichael Arms logo.':'souters'===e?'The Souter\u2019s Inn logo.':'Placeholder initials.'," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,E.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,label:"Upload a logo",onPress:async()=>{const s=await a.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(s.canceled||!s.assets?.[0])return;const t=s.assets[0];j.useOwner.getState().setBranding(e,{logoUri:t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri})}}),l.custom?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,E.jsx)(P.OrderAtTableCard,{rid:e,compact:!0}),u?(0,E.jsx)(x.Banner,{kind:"warn",title:u}):null,(0,E.jsx)(L,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(m.useStore.getState().updateRestaurant(o.id,{name:i.name.trim(),address:i.address.trim(),phone:i.phone.trim(),contactEmail:i.email.trim(),tagline:i.tagline.trim()}),h(''),s('Venue details saved.')):h('Check the email address.')}})]})},hours:function({done:e,wizard:s}){const{r:t}=(0,C.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=R.filter(e=>{const s=n[e];return s&&(!z.test(s[0])||!z.test(s[1]))});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),M.map((e,s)=>{const t=R[s],l=n[t];return(0,E.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:S.colours.border,paddingTop:s?6:0},children:[(0,E.jsx)(x.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,E.jsxs)(x.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"to"}),(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,E.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,E.jsx)(x.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries(R.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,E.jsx)(x.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,E.jsx)(L,{wizard:s,disabled:!!l.length,onPress:()=>{m.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,y.usePlan)(e),o=(0,y.planCounts)(n);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v.TablePlan,{startStep:"areas"}),(0,E.jsx)(L,{wizard:t,disabled:!o.tables,label:t?`Looks right (${o.tables} tables, ${o.seats} seats), continue`:'Mark as done',onPress:()=>s('Table plan step marked as done.')})]})},paygrades:function(e){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{center:!0,children:"Your team's hourly rates. Tap a person to edit. Existing grades are retained in the background; opening this list never changes pay."}),(0,E.jsx)(F,{...e,payList:!0})]})},staff:F,permissions:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)('Manager'),l=e=>f.PERMS.filter(s=>n.perms[e]?.[s.id]).length;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Tick what each access level can do. We\u2019ve started you with sensible defaults; change any of them."}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,sub:`${l(e)} of ${f.PERMS.length}`,selected:o===e,onPress:()=>a(e)},e))}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:o}),'Owner'===o?(0,E.jsx)(x.Muted,{children:"The owner can always do everything."}):null,f.PERMS.map((s,t)=>{const a=!!n.perms[o]?.[s.id],l='Owner'===o;return(0,E.jsxs)(h.default,{testID:`perm-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:a,disabled:l},accessibilityLabel:`${o}: ${s.label}`,disabled:l,onPress:()=>f.useSetup.getState().setPerm(e,o,s.id,!a),style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:50,borderTopWidth:t?1:0,borderTopColor:S.colours.border,opacity:l?.75:1},children:[(0,E.jsx)(g.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:a?S.colours.gold:S.colours.muted,backgroundColor:a?S.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:a?(0,E.jsx)(x.T,{weight:"bold",colour:S.colours.onGold,children:"\u2713"}):null}),(0,E.jsx)(x.T,{style:{flex:1},children:s.label})]},s.id)})]}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Back to the suggested defaults",onPress:()=>f.useSetup.getState().resetPerms(e)}),(0,E.jsx)(x.Banner,{kind:"info",title:"Saved on this device",children:"For now the apps still follow the built-in Owner, Manager and Staff rules. These ticks will control access once staff accounts go live."}),(0,E.jsx)(L,{wizard:t,onPress:()=>s('Permissions saved.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Work email address",value:o,onChangeText:a,placeholder:"e.g. hello@yourvenue.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),l?null:(0,E.jsx)(x.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,E.jsx)(x.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Link your inbox"}),(0,E.jsx)(x.Badge,{kind:"amber",label:"Coming soon"})]}),(0,E.jsx)(x.Muted,{children:"Later you\u2019ll be able to link your inbox so booking emails appear in CoverCharge. Nothing is linked yet: CoverCharge doesn\u2019t read or send email from here."}),(0,E.jsx)(x.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,E.jsx)(L,{wizard:t,disabled:!l,onPress:()=>{m.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),a=(0,f.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,T.appUrl)('/customer-app/index.html'),[]),[d,u]=(0,c.useState)(!1),h=l.trim()&&!/^https?:\/\//i.test(l.trim())?`https://${l.trim()}`:l.trim(),p=!h||/^https?:\/\/[^\s.]+\.[^\s]+$/i.test(h);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,E.jsx)(x.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Your booking link"}),(0,E.jsx)(x.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:S.colours.border,padding:10},children:(0,E.jsx)(x.T,{size:14,colour:S.colours.goldLight,children:i})}),(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,T.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,E.jsx)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,E.jsx)(x.Badge,{kind:"gold",label:"Coming soon"})}),(0,E.jsx)(x.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,E.jsx)(L,{wizard:t,disabled:!p,onPress:()=>{m.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),f.useSetup.getState().patch(e,{website:h,bookingUrl:i}),s('Website saved.')}})]})},invites:function({rid:e,done:s,wizard:t}){const n=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),{role:o}=(0,C.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Every person has an Android app download and an iPhone app link. Both sign in automatically. Share privately; nothing is sent from here."}),n.map(e=>(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,E.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,E.jsx)(L,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},_=e=>function(){return(0,E.jsx)(D,{id:e})};function W({rid:e,id:s,title:t,onDone:n}){const o=O(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,E.jsxs)(g.default,{style:{gap:4},children:[(0,E.jsx)(x.Button,{kind:"secondary",label:r?'Saving\u2026':'Mark as not done',disabled:r,testID:`setup-notdone-${s}`,accessibilityLabel:`${t}, mark as not done`,style:{minHeight:44},onPress:async()=>{d(!0),f.useSetup.getState().markDone(e,s,!1);const o=!a||await i.useSetupMarks.getState().set(a,s,!1);d(!1),n(o?`${t} marked as not done.`:'Could not save. Check the connection and try again.')}}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: use this if a step needs another look. It goes back on your to-do list until you mark it done again."})]}):l&&!1===l.done&&l.by?(0,E.jsxs)(x.Muted,{size:13,testID:`setup-notdone-by-${s}`,children:["Marked as not done by ",l.by,l.at?` on ${new Date(l.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})}`:'',"."]}):null}},1369,[927,926,798,796,1061,1370,1371,1372,1373,1375,34,402,102,847,899,794,848,865,1014,925,15,836,840,1100,1376,1379,1383,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1370,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1371,[34,985]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1372,[34,815,985]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1373,[2,796,34,236,383,102,794,1374,985,840,1151,997,865,988,25]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1374,[]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1375,[34,402,794,985,840,1373,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1376,[796,1120,985,900,1174,1176,34,281,379,236,402,102,426,853,794,848,1185,865,836,827,840,1147,1100,838,1366,1135,1377,1378,1119,1126,1125,1024,13,1123,1365,1166,25]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1377,[796,34,1172,1041,839,379,402,102,794,865,836,827,840,1147,1100,1166,25]); -__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1378,[1042,34,402,102,794,865,840,1100,985,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1379,[796,34,1033,395,102,1107,1108,1292,1315,794,1011,1014,827,840,1100,1015,1380,1381,1035,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1380,[796,34,402,102,794,840,1014,5,1015,846,985,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1381,[34,102,794,1014,1382,828,840,1060,931,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1382,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderAtTableCard=c,_e.OrderAtTableSettings=function(){const e=(0,h.useOwner)(e=>e.site);return(0,u.jsxs)(n.default,{style:{gap:10},children:[(0,u.jsx)(c,{rid:e}),(0,u.jsx)(o.Banner,{kind:"info",title:"Takeaway is separate",children:"Takeaway ordering, slots and the live takeaway queue work the same whichever way this is set. Each venue sets this for itself."})]})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var r,s=_r(d[3]),n=(r=s)&&r.__esModule?r:{default:r},o=_r(d[4]),l=_r(d[5]),h=_r(d[6]),u=_r(d[7]);function c({rid:r,compact:s}){const h=(0,l.useOrderAtTable)(r),c=(0,l.useStore)(e=>e.restaurants.find(e=>e.id===r)?.name??'this venue');return e.IS_GREENSIDE?(0,u.jsx)(t.GreensideCashOnly,{}):(0,u.jsx)(n.default,{testID:"order-at-table-card",children:(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Order at table"}),(0,u.jsx)(o.Muted,{children:"Guests scan a QR code on the table and order from their phone, then pay at the bar or till. Tables, hours and QR codes: Settings \u203a Advanced \u203a Order at the table."})]}),(0,u.jsx)(o.Toggle,{label:"Order at table",value:h,onChange:e=>l.useStore.getState().updateSettings(r,{orderAtTable:e})})]}),(0,u.jsx)(o.T,{size:13,colour:h?'#E2C489':'#D8CFBF',children:h?`On for ${c}: table QR codes, table orders and table tickets are shown.`:`Off for ${c}: in-house orders go through your till. Takeaway ordering stays on.`}),s?null:(0,u.jsx)(o.Muted,{children:"When it is off: no Order at table or table QR screen in the customer app, no Tables & QR codes page or Table option in Take an order here, no table orders in Live orders, and no table tickets in the Head Chef app."})]})})}},1383,[5,1341,34,102,794,848,865,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=M,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=M(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',O[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:O[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withWildingsQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function M(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const O={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from Bidfood or Booker? Add them here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1384,[801,1153,34,281,283,364,395,236,295,102,36,794,847,850,865,1014,1051,1052,5,828,1049,1059,840,846,1100,1385,1388,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=k,_e.importQuestionnaireAccounts=T,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Listing them lets the Assistant help with them later. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:i}=(0,x.useCtx)(6e4),j='owner'===n,B=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],A=(0,p.useQuestionnaire)(e),{mark:M}=(0,p.useProvenance)(e),[P,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(A?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!B.some(n=>n.provider===e.provider)),[A,B]),W=(A?.accounts??[]).some((e,n)=>M('accounts',n,'provider'));return(0,y.jsxs)(l.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:i})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>A&&T(e,A,i)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${B.length}`})]}),B.length?B.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(A?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(l.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:I[e.status].kind,label:I[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(k,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=B.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:P,owner:j,by:i,onClose:()=>z(null)}),$?(0,y.jsx)(C,{rid:e,c:$,by:i,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),i=e(r(d[4])),l=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(l.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function k({rid:e,compact:n}){const{role:o,me:i}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,k]=(0,t.useState)({}),[T,B]=(0,t.useState)(null),I=u.useAccounts.getState();return(0,y.jsxs)(l.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(l.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(l.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(l.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(l.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>k({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(l.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>I.update(e,o.id,{accountNo:u},i,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>B(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>I.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:i})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),T?(0,y.jsx)(C,{rid:e,c:T,by:i,onClose:()=>B(null)}):null]})}function C({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(l.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["The Assistant will stop using ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function T(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const i of n.accounts??[])o.some(e=>e.provider===i.provider)||s.add(e,{provider:i.provider,handle:i.handle,status:'listed',from:'questionnaire',addedBy:t})}function B({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,k]=(0,t.useState)(p?.handle??''),[C,T]=(0,t.useState)(p?.customName??''),[B,I]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const A=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${A?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(i.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:A?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),A?(0,y.jsx)(a.Field,{label:"Service name",value:C,onChangeText:T,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>I(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),B?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below so the Assistant knows you use it, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:k,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:A?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:A&&C.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:A?C.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:A&&!C.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(l.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const I={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(B,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1385,[796,34,379,402,295,102,794,1386,1387,840,1384,1100,865,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1386,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.looksSecret=l,Object.defineProperty(_e,"useAccounts",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),s=r(d[2]);const c=/^\s*(password|passwd|pwd|passcode|pin|otp|secret|token|api[ _-]?key)\s*[:=]/i,u=/\b(sk|pk|rk)_(live|test)_|\bghp_|\bxox[abp]-|\bAKIA[0-9A-Z]{12}|\beyJ[A-Za-z0-9_-]{10,}\./;function l(e){return!(!c.test(e)&&!u.test(e))||e.split(/\s+/).some(e=>e.length>=24&&/[A-Za-z]/.test(e)&&/\d/.test(e)&&!/^[\w.+-]+@[\w-]+\.[\w.]+$/.test(e)&&!/^(https?:\/\/|www\.)/i.test(e))}const b=e=>e&&!l(e)&&e.trim().slice(0,120)||void 0,p=e=>{const t=e?.trim();return t&&/^[A-Za-z0-9 -]{1,20}$/.test(t)?t:void 0},y=(0,n.create)()((0,s.persist)(e=>({byVenue:{},log:{},add:(t,o)=>e(e=>{const n={...o,handle:b(o.handle),customName:b(o.customName),accountNo:p(o.accountNo),id:`c-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,addedAt:(new Date).toISOString()};return{byVenue:{...e.byVenue,[t]:[...e.byVenue[t]??[],n]},log:{...e.log,[t]:[{at:n.addedAt,by:o.addedBy,what:`Added ${o.customName??o.provider}`},...e.log[t]??[]].slice(0,200)}}}),update:(t,o,n,s,c)=>e(e=>({byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).map(e=>e.id===o?{...e,...n,handle:void 0!==n.handle?b(n.handle):e.handle,accountNo:void 0!==n.accountNo?p(n.accountNo):e.accountNo}:e)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:s,what:c},...e.log[t]??[]].slice(0,200)}})),remove:(t,o,n)=>e(e=>{const s=(e.byVenue[t]??[]).find(e=>e.id===o);return{byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).filter(e=>e.id!==o)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:n,what:`Removed ${s?.customName??s?.provider??'an account'}`},...e.log[t]??[]].slice(0,200)}}})}),{name:'covercharge-accounts-v1',version:1,storage:(0,s.createJSONStorage)(()=>o.default)}))},1387,[808,815,818]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1388,[34,402,102,794,850,1387,1014,828,1389,1059,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1389,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1390,[798,34,283,364,236,402,102,815,794,840,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const v=(0,m.useInStaffApp)(),{now:L,meId:N,me:A,r:z,today:H}=(0,m.useCtx)(3e4),O=(0,s.useTravelDay)('staff',H),P=(0,c.useOwner)(e=>e.shifts),R=(0,c.useOwner)(e=>e.attendance),F=(0,c.useOwner)(e=>e.staffCanViewSuppliers),_=(0,c.useOwner)(e=>e.quickLinks),E=(0,c.useOwner)(e=>e.chat),W=(0,c.useOwner)(e=>e.swaps),V=(0,c.useOwner)(e=>e.leave),q=P.filter(e=>e.staffId===N&&e.published&&e.date>=H).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),G=q.find(e=>e.date===H),U=R.filter(e=>e.staffId===N&&e.in&&!e.out&&L.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Y=(0,x.usePay)(N,0),Q=(0,b.useOrders)(z.id),K=(0,b.useBookings)(z.id),J=Q.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,K))),X=K.filter(e=>e.date===H&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,Q.filter(T.LIVE))),Z=K.filter(e=>(0,S.undoKind)(e,H)||e.walkIn&&'cancelled'===e.status&&e.date===H).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),ee=E.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],se=W.filter(e=>e.fromId===N&&'open'===e.status).length+V.filter(e=>e.staffId===N&&'pending'===e.status).length,te=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & leave',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...F?[['Suppliers',()=>e('more','suppliers')]]:[]];return!v&&O?(0,$.jsxs)(o.default,{style:{gap:10},children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(s.DayView,{rid:z.id,day:O,today:H,app:"staff"})]}):(0,$.jsxs)(o.default,{style:{gap:10},children:[v?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(t.CoversToday,{rid:z.id})]}),(0,$.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,$.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,$.jsx)(C.StaffAvatar,{id:N,size:52})}),(0,$.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",A.replace(' (example)','').split(' ')[0]]})]}),(0,$.jsx)(r.Badge,{kind:"gold",label:v?z.name:'Staff app preview'})]}),(0,$.jsx)(r.Muted,{children:v?`${L.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,$.jsx)(M.StaffTipsTile,{rid:z.id,today:H,onPress:()=>e('more','mytips')}),(0,$.jsxs)(r.Card,{highlight:U?u.colours.ok:void 0,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{weight:"semibold",children:U?`On shift since ${(0,h.hm)(new Date(U.in))}`:'Not clocked in'}),U?(0,$.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((L.getTime()-new Date(U.in).getTime())/6e4)))}):null]}),G?(0,$.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(G.start),"\u2013",(0,m.fmtH)(G.end)]}):q[0]?(0,$.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[q[0].day]," ",Number(q[0].date.slice(8))," ",(0,m.fmtH)(q[0].start),"\u2013",(0,m.fmtH)(q[0].end)]}):(0,$.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,$.jsx)(r.Button,{small:!0,kind:U?'secondary':'success',label:U?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),(0,$.jsx)(p.ShellfishTile,{rid:z.id,by:A.replace(' (example)',''),app:"staff"}),Z.length?(0,$.jsx)(r.Card,{children:(0,$.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",Z.length,")"]}),(0,$.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),Z.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,$.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,$.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,$.jsxs)(r.Muted,{children:[e.table?(0,D.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,$.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(z.id,e)}):null,e.walkIn?(0,$.jsx)(a.CancelWalkInButton,{rid:z.id,b:e,small:!0}):null,e.walkIn?(0,$.jsx)(a.ReinstateWalkInButton,{rid:z.id,b:e,today:H,small:!0}):null,(0,$.jsx)(S.BookingUndo,{b:e,rid:z.id,today:H,who:s})]})]},e.id)})]})}):null,J.length+X.length?(0,$.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",J.length+X.length,")"]}),(0,$.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),J.map(e=>(0,$.jsx)(j.AllergyChain,{o:e,me:A},e.id)),X.map(e=>(0,$.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,I.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,$.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsx)(j.BookingAllergyChain,{b:e,me:A}),(0,$.jsx)(o.default,{style:{flexDirection:'row'},children:(0,$.jsx)(w.WhatsAppGuest,{b:e,rid:z.id,kind:"auto"})})]},e.id))]}):null,ee?(0,$.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,$.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,$.jsx)(r.T,{size:14,children:ee.text})]}):null,(0,$.jsxs)(r.Card,{children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,$.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Y.paid)," paid hours"]})]}),se?(0,$.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,$.jsxs)(r.T,{size:14,children:["You have ",se," request",se>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(_,'staff').length?(0,$.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,$.jsx)(y.QuickLinksRow,{compact:!0})]}):null,v?null:(0,$.jsx)(o.default,{style:{gap:6},children:te.map(([e,s])=>(0,$.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),D=_r(d[23]),I=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27])},1391,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1366,1136,850,1149,838,1147,899,1345,1014,829,1096,1154,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:C,now:$,today:S}=(0,x.useCtx)(3e4),{width:T}=(0,r.default)(),B=(0,n.useBookings)(v),M=(0,n.useOrders)(v),D=(0,n.useEvents)(v),[H,R]=(0,t.useState)(7),A=(0,b.useRealHistory)(v,$),P=(0,t.useMemo)(()=>(0,s.forecastToday)(C,B,M,D,$,A??void 0),[C,B,M,D,A,$.getTime()/6e4|0]),E=(0,t.useMemo)(()=>Array.from({length:H},(e,t)=>{const o=(0,c.addMins)((0,c.parseYmd)(S),1440*t);return{d:o,f:(0,s.forecastToday)(C,B,M,D,o,A??void 0)}}),[C,B,M,D,S,H,A]),F=P.hours.reduce((e,s)=>e+s.booked,0),L=Math.max(C.settings.capacityPerHour,...P.hours.map(e=>e.coversHigh)),I=(0,i.showTakeaway)(C),[N,O]=(0,t.useState)(I),_=D.filter(e=>e.date>=S).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),z=Math.min(T,900)-60,Y=e=>E.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,p.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,p.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:H===e,onPress:()=>R(e),testID:`forecast-range-${e}`},e))});return P.enough?(0,p.jsxs)(a.default,{style:{gap:12},children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsxs)(d.Muted,{children:["Hourly labels use the upper end of the Covers range. Steady starts at ",P.busy.steady,"; Busy starts at ",P.busy.busy,"."]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(d.T,{weight:"semibold",colour:u.colours.gold,children:["Today by hour \xb7 ",(0,c.niceDate)($)]}),P.example?(0,p.jsx)(b.ExampleBadge,{}):(0,p.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),P.open?(0,p.jsx)(y.Bars,{data:P.hours.map(e=>({key:String(e.hour),label:String(e.hour),a:e.booked,b:e.walkIns})),max:L,highlight:P.nextHour?String(P.nextHour.hour):void 0}):(0,p.jsx)(d.Muted,{children:"Closed today."}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#9C7C45'}}),(0,p.jsx)(d.Muted,{children:"Booked"})]}),(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#6B5A3A'}}),(0,p.jsx)(d.Muted,{children:"Expected walk-ins and later bookings"})]})]}),P.hours.map(e=>{const t=(0,y.busyLevel)(e.coversHigh,P.busy.busy);return(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{size:14,children:(0,x.fmtH)(e.hour)}),(0,p.jsxs)(d.T,{size:14,colour:u.colours.muted,children:[(0,s.coversRange)(e.coversLow,e.coversHigh),I?` \xb7 about ${e.takeaway} takeaway`:'']}),(0,p.jsx)(d.T,{size:14,weight:"semibold",colour:t.colour,children:t.label})]},e.hour)})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),P.suggestions.map((e,s)=>(0,p.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,p.jsx)(d.Muted,{children:P.example?`${l.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Next ",H," days (covers)"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Covers for the next ${H} days`}),E.filter(e=>e.f.flags.length).map(e=>(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",colour:I?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,p.jsx)(d.Button,{small:!0,kind:"ghost",label:N?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>O(!N)})]}),N?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,p.jsx)(j.LineChart,{width:z,series:[P.hours.map(e=>e.takeaway),P.hours.map(e=>e.takeawayPlaced)],labels:P.hours.map(e=>String(e.hour))}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsx)(d.Muted,{children:"Gold: forecast"}),(0,p.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.map(s=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(s.title)}),(0,p.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,p.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${k(s.date,S)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${k(s.date,S)}`,body:`${s.title} at ${C.name} ${k(s.date,S)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${f(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:f(s.title),body:`${f(s.title)} at ${C.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,p.jsxs)(a.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsx)(b.NotEnoughHistory,{weeks:P.minWeeks,booked:F}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",H," days"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${H} days`}),(0,p.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.slice(0,6).map(e=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(e.title)}),(0,p.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=e(_r(_d[3])),r=e(_r(_d[4])),d=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),j=_r(_d[14]),b=_r(_d[15]),p=_r(_d[16]);const k=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},f=e=>`${(0,o.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1392,[1120,34,1075,102,426,794,848,1122,851,827,840,865,1147,1100,1365,1125,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1393,[815]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=P,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,x]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)).slice(0,8),R=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),A=R.filter(e=>'due'===e.state||'overdue'===e.state),M=R.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,B.jsxs)(o.default,{style:{gap:12},children:[(0,B.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),b?(0,B.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,B.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,B.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,B.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,B.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,B.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===A.length?(0,B.jsx)(i.Muted,{children:"Nothing due right now."}):null,A.map(e=>(0,B.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,y.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,B.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,B.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),M.map(e=>(0,B.jsxs)(i.Muted,{children:[(0,y.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,y.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,B.jsx)(k.SectionHead,{title:"Live orders",right:(0,B.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,B.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,B.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,B.jsx)(P,{o:e},e.id)),v.length?(0,B.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,B.jsx)(i.Card,{style:{opacity:.7},children:(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,B.jsx)(O,{onClose:e=>{h(!1),e&&x(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),x=_r(d[13]),y=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]);const R={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function O({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),y=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,R]=(0,r.useState)(''),[O,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[N,$]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,F]=(0,r.useState)(''),[_,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,x.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries(N).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(y.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.ukPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(_),J=K.length>0&&Y&&(Q?O.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(y.map(e=>e.section)));return(0,B.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,B.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,B.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,B.jsx)(i.Field,{label:"Table number",value:O,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,B.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:R,placeholder:"e.g. Mrs Reid"}),Q?null:(0,B.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:F,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,B.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,B.jsx)(i.Field,{label:"Email (optional)",value:_,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too"}),'phone'===T?(0,B.jsxs)(o.default,{style:{gap:4},children:[(0,B.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,B.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,B.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,B.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),y.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,B.jsxs)(o.default,{style:{flex:1},children:[(0,B.jsx)(i.T,{size:15,children:e.name}),(0,B.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,B.jsx)(i.Stepper,{value:N[e.id]??0,min:0,max:20,label:e.name,onChange:t=>$({...N,[e.id]:t})})]},e.id)),(0,B.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,B.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,B.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,B.jsx)(l.GreensideCashOnly,{}):(0,B.jsx)(i.Banner,{kind:"demo",title:"Card payments: not set up yet",children:"Pay on collection or at the table. Nothing is charged in the app."}),(0,B.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?O.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:_.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${O.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function P({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),x=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,B.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,y.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",R[e.channel??(e.type,'app')]," \xb7 ",(0,y.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,B.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,B.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,B.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,B.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,B.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,B.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,y.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,B.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,B.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,B.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,B.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:x,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,B.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,B.jsx)(i.Button,{small:!0,kind:"ghost",label:"Reject",onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1394,[5,1341,829,1310,34,102,794,848,850,855,830,836,1134,1104,827,840,1147,1100,1135,1136,838,1347,833,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return le}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),p=_r(d[8]),b=_r(d[9]),h=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),v=_r(d[16]),w=_r(d[17]),E=_r(d[18]),N=_r(d[19]),P=_r(d[20]),W=_r(d[21]),A=_r(d[22]),T=_r(d[23]),R=_r(d[24]),M=(e=R)&&e.__esModule?e:{default:e},B=_r(d[25]),O=_r(d[26]),G=_r(d[27]),x=_r(d[28]),D=_r(d[29]),I=_r(d[30]),L=_r(d[31]),H=_r(d[32]),F=_r(d[33]),_=_r(d[34]),Q=_r(d[35]),V=_r(d[36]),q=_r(d[37]),U=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),$=_r(d[42]),J=_r(d[43]),K=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),ae=_r(d[49]),se=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),de=_r(d[55]);const le=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},ue=e=>n.CAN.manage(e);(0,y.register)([{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>ue(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:ue,C:o.ServiceBoard},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:ue,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:ue,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',badge:'NEW',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:ue,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:ue,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:ue,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:ue,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:b.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:ue,badge:'NEW',C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:h.PLAN_SUB,group:'Account',can:n.CAN.billing,C:h.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',badge:'NEW',C:W.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',badge:'NEW',C:N.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:N.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',badge:'NEW',can:ue,C:P.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:N.Timesheets}]),(0,y.register)([{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:A.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:A.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',badge:'NEW',can:ue,C:w.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',badge:'NEW',can:ue,C:E.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'Photo of the cash up sheet, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',badge:'NEW',can:ue,C:v.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:A.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:A.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:A.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:ue,C:A.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:ue,C:A.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:ue,C:A.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:ue,C:A.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:ue,C:A.ReviewEmailSettings},{id:'compliance',title:'Daily checks & allergen log',sub:'Fridge temps, opening checks, audit log',group:'Compliance',C:A.Compliance},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:A.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:ue,badge:'NEW',C:A.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:A.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:T.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>le(),C:T.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:ue,C:T.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:ue,C:T.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:T.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:ue,C:T.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:ue,C:T.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:ue,C:T.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:ue,C:T.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:T.TabletPreview}]);const ge=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',badge:'NEW',C:()=>M.default.createElement(O.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:B.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',badge:'NEW',can:ge,C:B.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',badge:'NEW',can:ge,C:O.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',badge:'NEW',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:G.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',badge:'NEW',C:x.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:ue,C:x.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:ue,badge:'NEW',C:x.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:ue,badge:'NEW',C:D.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:ue,badge:'NEW',C:D.DisplaySettingsPage}]);const ce=e=>'owner'===e||'manager'===e;I.ASSISTANT_AVAILABLE&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ce,badge:'NEW',C:I.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off, voice, connected services',group:'Account',can:ce,C:I.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',badge:'NEW',can:e=>'owner'===e&&!r.IS_CAR,C:H.CarScreen}]);const pe=e=>'owner'===e||'manager'===e,be=()=>{const e=l.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,u.costsAllowedFor)(t)},he=e=>pe(e)&&be();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:pe,badge:'NEW',C:L.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Creator},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Prices},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning, allergen checks; filters; CSV and print for the EHO',group:'Compliance',can:pe,badge:'NEW',C:L.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:pe,badge:'NEW',C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',badge:'NEW',C:L.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:ue,badge:'NEW',C:F.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:ue,badge:'NEW',C:F.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:ue,badge:'NEW',C:F.Outbox}]);const fe=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:fe,badge:'NEW',C:Q.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:fe,badge:'NEW',C:_.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:fe,badge:'NEW',C:V.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:fe,badge:'NEW',C:q.OrderSheetSettings},...U.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:fe,C:(0,_.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:fe,badge:'NEW',C:Y.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:fe,badge:'NEW',C:j.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:ue,badge:'NEW',C:j.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:fe,badge:'NEW',C:j.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:fe,badge:'NEW',C:z.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:ue,badge:'NEW',C:$.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:ue,badge:'NEW',C:$.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:ue,badge:'NEW',C:$.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:ue,badge:'NEW',C:J.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos, Show me where, or ask the Assistant',group:'Start here',can:ue,badge:'NEW',C:K.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:ue,badge:'NEW',C:Z.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, Booker and Bidfood lists, offers, events and specials the voice helper prepared; nothing is sent',group:'Run the day',can:ue,badge:'NEW',C:ee.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift, left by voice or typing',group:'Run the day',badge:'NEW',C:ee.ShiftNotesPage},{id:'voice',title:'Voice helper',sub:'Hold-to-talk input, text-only replies, who gets it and microphone privacy',group:'Settings',can:ue,badge:'NEW',C:ee.VoiceSettingsPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(te.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update',group:'Compliance',can:pe,badge:'NEW',C:function(){return M.default.createElement(ae.FoodSafetyCard,null)}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(ie.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:pe,badge:'NEW',C:function(){const{rid:e,today:t}=(0,se.useCtx)(6e4);return M.default.createElement(ie.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',badge:'NEW',C:function(){const{rid:e,me:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(re.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:ue,badge:'NEW',C:X.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',badge:'NEW',C:function(){const{me:e,role:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(oe.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:ue,C:ne.NightlyReportPage},{id:'support',title:'Chat with CoverCharge support',sub:'A message to the CoverCharge team',group:'Start here',can:ue,C:de.SupportChatPage}])},1395,[806,1396,846,1399,865,997,988,800,855,1401,1406,1416,1378,1417,1418,1420,1421,1422,1423,1155,1157,1425,1376,1426,34,1154,1145,1377,1366,1379,1410,1431,1432,1433,1369,1356,1383,1434,925,1435,1436,1437,1151,1384,1438,1310,1385,1450,1082,1043,1100,1156,1130,1451,1454,1457]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LookBackResult=k,_e.monthCells=v,_e.calendarDayLabel=C,_e.LookBackCalendar=T,_e.LookBack=function(){const{rid:e,today:s}=(0,d.useCtx)(3e4),[o,l]=(0,t.useState)((0,c.addDays)(s,-1)),[x,j]=(0,t.useState)((0,b.ukHistoryDate)(o)),[p,f]=(0,t.useState)(0),[m,D]=(0,t.useState)(!1),v=(0,u.useHistoricalBookingDay)(e,o,s,p),C=(0,b.parseHistoryInput)(x),w=!!C&&(0,b.validPastDate)(C,s);if(!v.allowed)return(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"Sign in to the Managers app with manager or owner access to Look back."})});const $=e=>{l(e),j((0,b.ukHistoryDate)(e))};return(0,h.jsxs)(i.default,{style:{gap:14},testID:"look-back",children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Look back"}),(0,h.jsx)(n.T,{size:18,center:!0,children:"Find bookings for one exact past date. Read-only; nothing is sent or changed."}),(0,h.jsx)(n.Field,{label:"Past booking date (DD MM YYYY)",value:x,onChangeText:j,placeholder:"05 11 2025",accessibilityLabel:"Exact past booking date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"look-back-date",style:{textAlign:'center'}}),w?null:(0,h.jsx)(n.T,{size:18,center:!0,children:"Enter a past date as DD MM YYYY, for example 09 11 2026, including the four-digit year."}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"look-back-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,c.longDay)(o)}`,onPress:()=>D(!0)}),(0,h.jsx)(n.Button,{label:"Show bookings",accessibilityLabel:`Look back at bookings for ${w&&C?(0,b.historyDateLabel)(C):'a valid past date'}`,disabled:!w,onPress:()=>{C&&$(C),f(p+1)}})]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Previous day",accessibilityLabel:`Previous day, ${(0,c.longDay)((0,c.addDays)(o,-1))}`,onPress:()=>$((0,c.addDays)(o,-1))}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Next day",accessibilityLabel:`Next day, ${(0,c.longDay)((0,c.addDays)(o,1))}`,disabled:!(0,b.validPastDate)((0,c.addDays)(o,1),s),onPress:()=>$((0,c.addDays)(o,1))})]})]})}),(0,h.jsx)(T,{visible:m,today:s,selected:o,onClose:()=>D(!1),onPick:e=>{$(e),D(!1)}}),v.data?(0,h.jsx)(k,{day:v.data}):(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:v.error||'Loading booking history\u2026'})})]})};var t=r(_d[0]),s=e(t),o=e(r(_d[1])),l=e(r(_d[2])),i=e(r(_d[3])),n=r(_d[4]),c=r(_d[5]),d=r(_d[6]),u=r(_d[7]),b=r(_d[8]),y=r(_d[9]),h=r(_d[10]);function k({day:e}){return(0,h.jsxs)(i.default,{testID:"look-back-result",style:{gap:14},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.T,{size:24,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:(0,b.historyDateLabel)(e.date)}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`Booked Covers: ${null===e.booked_covers?'not recorded':e.booked_covers}`,children:[(0,h.jsx)(n.T,{size:20,children:"Booked Covers"}),(0,h.jsx)(n.T,{size:36,weight:"bold",colour:y.colours.gold,children:null===e.booked_covers?'Not recorded':e.booked_covers})]}),e.historical_records?(0,h.jsx)(n.T,{size:20,colour:y.colours.gold,weight:"semibold",children:b.HISTORY_LABEL}):null,(0,h.jsx)(n.T,{size:18,children:b.HISTORY_NOTE}),e.missing_covers?(0,h.jsxs)(n.T,{size:18,children:[e.missing_covers," booking records have no party size; not filled in."]}):null]})}),e.bookings.length?null:(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"No booking records found for this date. The history is incomplete; this does not prove there were no bookings."})}),e.bookings.map((e,t)=>(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{testID:"look-back-booking",style:{gap:8},accessible:!0,accessibilityLabel:`${e.time??'Time not recorded'}, party size ${null===e.covers?'not recorded':`${e.covers} Covers`}, ${e.table?`table ${e.table}`:'table not recorded'}, ${e.status??'status not recorded'}${e.counted?'':', excluded from Booked Covers'}`,children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:20,children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,children:e.time??'Time not recorded'}),(0,h.jsxs)(n.T,{size:22,children:["Party size: ",null===e.covers?'Not recorded':`${e.covers} Covers`]})]}),(0,h.jsxs)(n.T,{size:20,children:["Table: ",e.table??'Not recorded']}),(0,h.jsxs)(n.T,{size:18,children:[e.status??'Status not recorded',e.counted?'':' \xb7 excluded from Booked Covers']}),(0,h.jsxs)(n.T,{size:18,colour:y.colours.muted,children:['favourite_table'===e.source?'previous booking system':'CoverCharge'," \xb7 ",e.ref]})]})},`${e.source}:${e.ref}:${t}`))]})}const x=['January','February','March','April','May','June','July','August','September','October','November','December'],j=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],p=e=>String(e).padStart(2,'0'),f=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=(e,t)=>{const[s,o]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1+t,1,12));return`${l.getUTCFullYear()}-${p(l.getUTCMonth()+1)}`},D=e=>{const[t,s]=e.split('-').map(Number);return`${x[s-1]} ${t}`};function v(e){const[t,s]=e.split('-').map(Number),o=new Date(Date.UTC(t,s,0)).getUTCDate();return[...Array(f(`${e}-01`)).fill(null),...Array.from({length:o},(t,s)=>`${e}-${p(s+1)}`)]}function C(e,t,s){const o=(0,b.validPastDate)(e,t);return`${(0,c.longDay)(e)}${e===t?', today':''}${e===s?', selected':''}${o?'':', not available. Look back is for past days only'}`}function T({visible:e,today:d,selected:u,onPick:k,onClose:x}){const[p,f]=(0,t.useState)(u.slice(0,7)),[T,w]=(0,t.useState)(0);s.default.useEffect(()=>{e&&f(u.slice(0,7))},[e,u]);const $=v(p),L=m(p,-1),z=m(p,1),P=`${z}-01`I>=46?e.slice(0,3):e.slice(0,2);return(0,h.jsx)(n.Sheet,{visible:e,onClose:x,title:"Pick a day",maxWidth:420,testID:"look-back-calendar",footer:(0,h.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,h.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:"look-back-cal-close",onPress:x})}),children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'stretch'},children:[(0,h.jsx)(n.T,{size:20,weight:"bold",colour:y.colours.goldLight,center:!0,accessibilityRole:"header",testID:"look-back-cal-month",children:D(p)}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:`Previous month, ${D(L)}`,testID:"look-back-cal-prev",onPress:()=>f(L)}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:P?`Next month, ${D(z)}`:`Next month, ${D(z)}, not available. Look back is for past days only`,disabled:!P,testID:"look-back-cal-next",onPress:()=>f(z)})]}),(0,h.jsxs)(i.default,{onLayout:e=>w(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,h.jsx)(i.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:j.map(e=>(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,h.jsx)(n.T,{size:13,colour:y.colours.muted,center:!0,children:S(e)})},e))}),(0,h.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:"look-back-cal-grid",children:$.map((e,t)=>{if(!e)return(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`blank-${t}`);const s=(0,b.validPastDate)(e,d),x=e===u;return(0,h.jsx)(l.default,{testID:`look-back-cal-${e}`,accessibilityRole:"button",accessibilityLabel:C(e,d,u),accessibilityState:{selected:x,disabled:!s},disabled:!s,onPress:()=>{k(e),o.default.announceForAccessibility?.(`Looking back at ${(0,c.longDay)(e)}`)},style:{width:"14.285714285714286%",height:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:x||e===d?1.5:0,borderColor:y.colours.gold,backgroundColor:x?y.colours.goldTint:'transparent',opacity:s?1:.35},children:(0,h.jsx)(n.T,{size:17,weight:x?'bold':'regular',colour:x?y.colours.goldLight:y.colours.text,center:!0,children:Number(e.slice(8))})},e)})})]})]})})}},1396,[34,281,402,102,794,1346,1100,1397,1398,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1397,[34,846,1398,827,985,931]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1398,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return k}}),_e.DashCorners=I,_e.ServiceBoard=function(){const{role:e}=(0,j.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,D.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,D.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,D.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,D.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,D.jsx)(I,{onLeave:y}),(0,D.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,D.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,D.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,D.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,D.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,D.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?w((0,D.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]),D=r(d[16]);const k=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function C({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,D.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,D.jsxs)(s.default,{children:[(0,D.jsx)(p.Icon,{name:t,colour:h.colours.gold}),u?(0,D.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,D.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function I({onLeave:e}){const t=(0,x.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>y.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,D.jsx)(C,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,D.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,D.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:k.filter(e=>'left'===e.side).map(n)}),(0,D.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[k.filter(e=>'right'===e.side).map(n),(0,D.jsx)(C,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')}),(0,D.jsx)(f.VoiceSlot,{size:44,layer:1})]})]})}function w(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[17]);return t(e,document.body)}},1399,[34,395,236,402,102,36,794,1041,1278,865,840,1116,1400,1153,1393,1100,25,277]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1400,[815]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),S=(0,c.useOwner)(e=>e.staff),$=(0,c.useOwner)(e=>e.previewRole),[B,P]=(0,t.useState)(''),[z,_]=(0,t.useState)(''),[H,E]=(0,t.useState)('staff'),[N,Y]=(0,t.useState)({}),F=c.CAN.staffAdmin(f),[G,U]=(0,t.useState)(null),[W,J]=(0,t.useState)(''),[K,V]=(0,t.useState)({});return(0,C.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(r.default,{testID:"access-tip",children:(0,C.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(r.default,{testID:"cashup-access-tip",children:(0,C.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, take a picture of the taking sheet and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,C.jsx)(r.default,{testID:"temp-access-tip",children:(0,C.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,C.jsx)(L,{ask:G,onClose:()=>U(null)}),(0,C.jsx)(O,{}),(0,C.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,C.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,C.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,C.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:$===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,C.jsx)(i.Muted,{children:T[$]})]}),'owner'===f||'manager'===f?(0,C.jsx)(v.AddTempStaffButton,{}):null,(0,C.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:W,onChangeText:J,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),S.filter(e=>(0,c.staffMatches)(e,W)).map(t=>(0,C.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,C.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,C.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,C.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,C.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,C.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,C.jsx)(A,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(i.Row,{gap:6,children:(0,C.jsx)(k.CashUpAccessBadge,{m:t})}),(0,C.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,C.jsxs)(r.default,{style:{gap:4},children:[(0,C.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:N[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>Y(e=>({...e,[t.id]:!e[t.id]}))}),N[t.id]?(0,C.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,C.jsx)(M,{person:t,actor:j,onAsk:U}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,C.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,C.jsx)(R,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsxs)(i.Row,{gap:6,children:[(0,C.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,C.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:K[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>V(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(K[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,C.jsx)(I,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,C.jsx)(k.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,C.jsx)(v.StaffDisplayControls,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,C.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,F&&t.id!==w&&'owner'!==t.role?(0,C.jsx)(i.Row,{wrap:!0,gap:6,children:(0,C.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),F?(0,C.jsxs)(i.Card,{children:[(0,C.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,C.jsx)(i.Field,{label:"Name",value:B,onChangeText:P}),(0,C.jsx)(i.Field,{label:"Job title",value:z,onChangeText:_,placeholder:"e.g. Kitchen porter"}),(0,C.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,C.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:H===e,onPress:()=>E(e)},e))}),(0,C.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:B.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(B.trim(),H,z.trim()||'Team member'),P(''),_('')}})]}):(0,C.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]);const T={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function A({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,C.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function I({person:e}){const s=(0,S.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,C.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,C.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,$.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,C.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,S.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,C.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,C.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function M({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,C.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,C.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function R({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,C.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,C.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,C.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,C.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,C.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,C.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,C.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,C.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function D({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,C.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,C.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,C.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,C.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,C.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,C.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,C.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,C.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,C.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,C.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,C.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,C.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,C.jsxs)(i.Row,{gap:8,children:[(0,C.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,C.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function O(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,C.jsxs)(r.default,{style:{gap:4},children:[(0,C.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,C.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,C.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1401,[796,1375,34,836,102,794,865,840,1100,899,924,1402,985,994,1047,1373,1403,1404,1012,1405,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1402,[]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffDisplayControls=function({m:e}){const s=(0,p.usePinStatus)(t=>t[e.id]),[c,m]=(0,l.useState)(''),[h,y]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),b='owner'===e.role||'manager'===e.role?6:4,j=async()=>{S(!0);const t=await(0,p.setStaffPin)(e.id,c,b);S(!1),m(''),y(t.ok?`PIN ${s?.hasPin?'reset':'set'}. Tell ${e.name} in person; it isn\u2019t shown again.`:t.error??'Could not set the PIN.'),t.ok&&(0,p.refreshPinStatus)()};return(0,f.jsxs)(n.default,{testID:`display-controls-${e.id}`,style:{gap:6,paddingTop:4},children:[(0,f.jsx)(o.Toggle,{testID:`display-clock-${e.id}`,label:"Can clock in at the Display",value:!!e.displayClock,onChange:t=>u.useOwner.getState().updateStaff(e.id,{displayClock:t})}),e.displayClock?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Muted,{size:12,children:s?.locked?'PIN locked (5 wrong tries)':s?.hasPin?e.temp?'Code set':'PIN set':'No PIN yet'}),(0,f.jsx)(t.TextInput,{testID:`pin-input-${e.id}`,accessibilityLabel:`New PIN for ${e.name}`,value:c,onChangeText:e=>m(e.replace(/\D/g,'').slice(0,8)),placeholder:`${b}\u20138 digits`,placeholderTextColor:r.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",maxLength:8,style:{width:110,minHeight:34,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:`set-pin-${e.id}`,label:s?.hasPin?'Reset PIN':'Set PIN',disabled:x||c.length{j()}})]}):null,h?(0,f.jsx)(o.Muted,{children:h}):null,e.temp?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Badge,{kind:"gold",label:"Temp"}),(0,f.jsxs)(o.Muted,{size:12,children:[e.tempUntil?`Until ${e.tempUntil}`:'No end date'," \xb7 Display only, no phone app"]}),(0,f.jsx)(o.Button,{small:!0,kind:"ghost",testID:`make-full-${e.id}`,label:"Make full staff",onPress:()=>u.useOwner.getState().updateStaff(e.id,{temp:!1,tempUntil:void 0,job:'Temp'===e.job?'':e.job})})]}):null]})},_e.AddTempStaffButton=function({initialOpen:e}){const[t,s]=(0,l.useState)(!!e),[n,r]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),[y,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{(0,p.refreshPinStatus)()},[]);const S=()=>{s(!1),x(null),h(null)},b=async e=>{r(!0);const t=await(0,p.addTempStaff)(e);r(!1),t.ok&&t.ref&&t.code?(u.useOwner.setState(l=>({staff:[...l.staff.filter(e=>e.id!==t.ref),{id:t.ref,name:t.name??e.name,role:'staff',job:'Temp',active:!0,level:'Staff',dept:e.dept??'',displayClock:!0,temp:!0,tempUntil:e.until??void 0}],hourly:null!=e.rate?{...l.hourly,[t.ref]:Math.round(100*e.rate)}:l.hourly})),x({name:t.name??e.name,code:t.code})):h(t.error??'Could not add them.')};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Button,{testID:"add-temp-btn",kind:"secondary",label:"Add temp staff",onPress:()=>s(!0)}),t?(0,f.jsx)(o.Sheet,{visible:!0,onClose:S,title:y?'Temp added':'Add temp staff',maxWidth:560,testID:"add-temp",children:y?(0,f.jsx)(c.TempCode,{name:y.name,code:y.code,onClose:S}):(0,f.jsx)(c.AddTempForm,{busy:n,error:m,onSubmit:e=>{b(e)}})}):null]})};var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),n=(e=s)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),u=_r(d[5]),p=_r(d[6]),c=_r(d[7]),f=_r(d[8])},1403,[796,34,102,794,840,865,1320,1331,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1404,[34,102,794,840,993,1037,985,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setCanChangeBookings=async function(o,s){const c=n.useSync.getState().venueId;if(!c||'staff'!==n.useSync.getState().kind)return{ok:!1,error:'Saved on this device. Connect to the shared team to store it for everyone.'};const h=(0,t.getSupabase)();try{const{error:t}=await h.rpc('set_can_change_bookings',{p_venue:c,p_staff_ref:o,p_on:s});return t?{ok:!1,error:/owner or manager/i.test(t.message)?'Only an owner or manager can change this.':'Saved on this device. The server did not take the change.'}:{ok:!0}}catch{return{ok:!1,error:'Saved on this device. The server did not take the change.'}}};var t=r(d[0]),n=r(d[1])},1405,[931,985]); -__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PRICING_AVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_VOICE_LINE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_SUPPLIER_LINE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DONE_FOR_YOU",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"doneForYouLine",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return v}}),_e.PlanBilling=function(){const{now:e,role:n,rid:b}=(0,p.useCtx)(6e4),j=(0,c.trialStatus)((0,l.defaultSimStart)(),e),[x,w]=(0,s.useState)(!1);return u.CAN.billing(n)?x?(0,y.jsx)(M,{onBack:()=>w(!1)}):(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(o.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,y.jsx)(t.VoiceUsageCard,{rid:b,now:e}),(0,y.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,y.jsxs)(i.default,{testID:"plan-founding",children:[(0,y.jsx)(o.T,{size:12,weight:"semibold",colour:h.colours.goldMuted,children:"FOUNDING OFFER \xb7 FIRST 50 VENUES"}),(0,y.jsxs)(o.T,{size:30,weight:"bold",children:["\xa349",(0,y.jsx)(o.T,{size:14,colour:h.colours.muted,children:" a month + VAT if applicable, per venue"})]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(o.Badge,{kind:"gold",label:"Every Full Restaurant Pro feature"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"One month free"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"\xa349 net locked in"})]}),(0,y.jsx)(o.Muted,{children:"Early adopter price for the first 50 venues: every Full Restaurant Pro App feature, including the owner's dashboard and admin and the voice Assistant. \xa349 net stays locked in while your subscription stays active."}),(0,y.jsxs)(o.T,{size:13,testID:"plan-early-done-for-you",children:["\u2713 ",T(P.early)]}),(0,y.jsx)(o.Muted,{children:"From venue 51, usual prices:"}),(0,y.jsxs)(i.default,{testID:"plan-usual-lite",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[k," \xb7 ",C," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:S}),O.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e)),(0,y.jsx)(o.T,{size:13,testID:"plan-lite-not-included",children:"Not included: the owner's dashboard and admin, or the voice Assistant."})]}),(0,y.jsxs)(i.default,{testID:"plan-usual-pro",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[_," \xb7 ",L," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:v}),R.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e))]}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>w(!0),style:{marginTop:6}})]}),(0,y.jsx)(o.Card,{children:(0,y.jsxs)(i.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,y.jsx)(o.T,{weight:"bold",colour:h.colours.gold,children:"free"}),"."]}),(0,y.jsx)(o.Muted,{children:"Your own app would cost about \xa398 in store fees in the first year alone (Apple \xa378.99 a year in the UK, Google US$25 one-off), then \xa378.99 a year."})]})}),(0,y.jsx)(o.Muted,{children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, and subscribers get free lifetime 24/7 customer support. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{children:"Free trial"}),(0,y.jsxs)(o.T,{weight:"bold",colour:h.colours.gold,children:[j.daysLeft," day",1===j.daysLeft?'':'s'," left"]})]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(100*(1-j.daysLeft/j.total))}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),(0,y.jsxs)(o.Muted,{children:["Then \xa3",c.PLAN.monthlyPence/100," a month + VAT if applicable. The trial start date is not set up yet."]})]}),(0,y.jsx)(f.AssistantPlanCard,{}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{weight:"semibold",children:"Free lifetime customer support"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"Included"})]}),(0,y.jsx)(o.Muted,{children:"Free for as long as you subscribe, day or night. Setup is all done digitally. Support contact details: not set up yet."})]})]}):(0,y.jsx)(o.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),i=(e=n)&&e.__esModule?e:{default:e},o=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),p=r(d[8]),f=r(d[9]),y=r(d[10]);const b=!0,j='Founding offer, free trial, set-up guide',x='. The owner\'s dashboard and admin come with Full Restaurant Pro App (\xa399 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',w='Voice Assistant (hold to talk) for seating guests, marking tables as cleared, temperature logs and finding something in the app: fair usage 1,000 voice tasks a month per venue',A='Supplier links: open your suppliers\' ordering sites and keep order lists',P={lite:1,pro:3,early:3},T=e=>`${e} done-for-you ${1===e?'change':'changes'} a month`,k='Customer & Takeaway App',_='Full Restaurant Pro App',C='\xa349',L='\xa399',S='A lite version of CoverCharge: 3 core customer and takeaway functions tailored to you, set up digitally with the in-app guided setup and step-by-step guides, free lifetime 24/7 customer support while subscribed, and unlimited self-edits of your basic info. The owner\'s dashboard and admin, and the voice Assistant, are not included.',v='Every feature, every app, including the owner\'s dashboard and admin and the voice Assistant. Set up digitally with the in-app guided setup and step-by-step guides, the Assistant (fair use 300 tasks a month), free lifetime 24/7 customer support while subscribed, and unlimited self-edits.',O=['Customer app: menu, allergens, bookings and loyalty','Takeaway ordering','Set up digitally: in-app guided setup and step-by-step guides','Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits of your basic info',T(P.lite)],R=['Every feature, every app','The owner\'s dashboard and admin',A,'Set up digitally: in-app guided setup and step-by-step guides','The Assistant, fair use 300 tasks a month',w,'Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits',T(P.pro)],I=[['Choose your 3 core functions','Pick what matters most to you, for example menu & allergens, takeaway ordering or the stamp card.'],['Add your logo and colours','More \u203a Branding: upload your logo; the apps use it everywhere.'],['Check your opening hours','More \u203a Opening hours: set your normal week and any closed days.'],['Add your menu and allergens','Menu & allergens: add dishes, prices and the 14 allergens, then sign each dish off.'],['Invite your team','More \u203a Team: add staff so they can use CoverCharge for Staff.'],['Share the customer app','More \u203a Your apps: copy the link or show the QR code at the counter.'],['Try a test order','Place a test order in the customer app and watch it arrive.']];function M({onBack:e}){const[t,n]=(0,s.useState)([]);return(0,y.jsxs)(i.default,{style:{gap:10},testID:"setup-guide",children:[(0,y.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,y.jsx)(o.H2,{children:"Set-up guide"}),(0,y.jsxs)(o.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",t.length," of ",I.length," done."]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(t.length/I.length*100)}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),I.map(([e,s],l)=>{const u=t.includes(l);return(0,y.jsx)(o.Card,{children:(0,y.jsxs)(o.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,y.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:u?h.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(o.T,{size:14,weight:"bold",colour:u?'#1a1610':h.colours.gold,children:u?'\u2713':String(l+1)})}),(0,y.jsxs)(i.default,{style:{flex:1,gap:4},children:[(0,y.jsx)(o.T,{weight:"semibold",children:e}),(0,y.jsx)(o.Muted,{children:s}),(0,y.jsx)(o.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>n(u?t.filter(e=>e!==l):[...t,l])})]})]})},e)}),(0,y.jsx)(o.Muted,{children:"Stuck? Free lifetime customer support is included while you subscribe. Ticks on this guide are not saved."})]})}},1406,[1407,34,102,794,819,865,1409,840,1100,1410,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceUsageCard=function({rid:e,now:o}){const h=(0,l.useVoiceUsage)(e,o);return(0,c.jsx)(s.Card,{children:(0,c.jsxs)(n.default,{testID:"voice-usage",style:{gap:6},children:[(0,c.jsx)(s.T,{weight:"semibold",children:h.line}),(0,c.jsx)(n.default,{style:{height:8,borderRadius:4,backgroundColor:t.colours.surface2,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${Math.min(100,Math.round(100*h.pct))}%`,height:8,backgroundColor:h.reached?t.colours.red:h.warn?t.colours.amber:t.colours.ok}})}),(0,c.jsxs)(s.Muted,{children:[l.VOICE_FAIR_USAGE,", shared by all of this venue\u2019s apps and devices. Food safety logging always works."]}),h.reached?(0,c.jsx)(s.Banner,{kind:"info",title:"Allowance reached for this month",children:l.REACHED_TEXT}):h.warn?(0,c.jsx)(s.Banner,{kind:"warn",title:"80% of this month\u2019s allowance used",children:"The voice helper keeps working until 1,000; it starts again on the 1st."}):null,(0,c.jsx)(s.Muted,{children:"For now the count is kept on each device; it will become one venue-wide count."})]})})},r(d[0]);var e,o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),l=r(d[4]),c=r(d[5])},1407,[34,102,794,840,1408,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1408,[808,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PLAN",{enumerable:!0,get:function(){return t}}),e.trialStatus=function(n,o){const l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),u=new Date(l.getFullYear(),l.getMonth()+t.trialMonths,l.getDate()),c=Math.max(0,Math.ceil((u.getTime()-o.getTime())/864e5));return{start:l,end:u,daysLeft:c,total:Math.round((u.getTime()-l.getTime())/864e5)}};const t={name:'CoverCharge',monthlyPence:4900,trialMonths:1,vatNote:'+ VAT if applicable'}},1409,[]); -__d(function(g,_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,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return S}}),_e.AssistantFab=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)(e=>e.enabled);return T(e)&&t?(0,k.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:y.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,k.jsx)(v,{size:22}),(0,k.jsx)(h.T,{weight:"bold",colour:A,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=S(e=>e.open),s=()=>S.getState().setOpen(!1),{rid:n,role:u,me:w}=(0,j.useCtx)(3e4),A=(0,x.useAssistant)(),B=R(),[P,O]=(0,o.useState)([]),[E,L]=(0,o.useState)(''),[z,W]=(0,o.useState)(!1),$=(0,o.useRef)(null),_=(0,o.useRef)(null);if((0,o.useEffect)(()=>{setTimeout(()=>$.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!T(u))return null;const N=(e,t,s)=>x.useAssistant.getState().record({at:(new Date).toISOString(),by:w,role:u,asked:e,action:t,outcome:s}),F=(e,t="result")=>O(s=>[...s,{id:I(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;L(''),O(e=>[...e,{id:I(),from:'you',text:t}]);try{s=await(0,m.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),O(e=>[...e,{id:I(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>O(s=>s.map(s=>s.id===e?{...s,state:t}:s)),V=async(e,t,s)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(s??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(C,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await b.repo.bookings.seatWalkIn(n,Number(o.party),s,'Added by Assistant'),s&&(0,p.resetTableLive)(n,s),F(`Done: Walk-in \xb7 ${o.party} seated${s?` at table ${s}`:' (table to assign)'}. It's in Bookings now.`),N(e.asked,t.title,'done');break}case'eightysix':await b.repo.menu.updateItem(String(o.itemId),{soldOut:Boolean(o.soldOut)}),F(o.soldOut?`Done: ${o.name} is marked sold out. Staff see it on the Display.`:`Done: ${o.name} is back on.`),N(e.asked,t.title,'done');break;case'price':await b.repo.menu.updateItem(String(o.itemId),{price:Number(o.pence)}),F(`Done: ${o.name} is now \xa3${(Number(o.pence)/100).toFixed(2)}.`),N(e.asked,t.title,'done');break;case'offer':f.useOwner.getState().addOffer({title:String(o.title),body:String(o.body),kind:'offer',live:!1}),F(`Done: draft offer \u201c${o.title}\u201d saved in Offers & specials (not live).`),N(e.asked,t.title,'done');break;case'rota':case'bookings':F(String(o.result)),N(e.asked,t.title,'looked up')}},G=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===A.tier,Y=(0,x.tasksUsed)(A);return(0,k.jsx)(a.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:s,children:(0,k.jsx)(c.default,{style:[h.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(c.default,{testID:"assistant-sheet",style:{backgroundColor:y.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:y.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:8,style:{flex:1},children:[(0,k.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:18})}),(0,k.jsx)(h.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,k.jsx)(r.default,{accessibilityLabel:"Close",onPress:s,hitSlop:10,children:(0,k.jsx)(h.T,{size:22,colour:y.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(c.default,{testID:"assistant-demo-badge",children:(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,k.jsxs)(c.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"info",title:"The Assistant is switched off in this preview",children:"Ask for things in plain English \u2014 add a walk-in, mark a dish sold out, check the rota, draft posts and replies \u2014 and confirm each one before anything happens. To use it, turn off the preview switch in More \u203a Account \u203a Assistant settings."}),(0,k.jsx)(h.Button,{kind:"secondary",label:"Close",onPress:s})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(l.default,{ref:$,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,k.jsxs)(c.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,k.jsxs)(h.T,{children:["Hi ",w.split(' ')[0]," \u2014 what can I do? I\u2019ll always show you what I\u2019m about to do and wait for you to confirm."]}),(0,k.jsx)(h.Muted,{children:"Try:"}),m.SUGGESTED_PROMPTS.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:y.colours.surface2},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,k.jsx)(c.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(h.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,k.jsx)(D,{m:e,onConfirm:(t,s)=>V(e,t,s),onCancel:()=>G(e)},e.id):'choose'===e.proposal.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,k.jsxs)(c.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:8},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]},e.id):(0,k.jsx)(c.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?y.colours.amberBg:y.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:y.colours.amber},children:(0,k.jsx)(h.T,{children:e.text})},e.id))]}),(0,k.jsxs)(h.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:E,onChangeText:L,onSubmitEditing:()=>H(E),returnKeyType:"send",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),A.voice?(0,k.jsx)(r.default,{testID:"assistant-mic",accessibilityRole:"button",accessibilityLabel:z?'Stop listening':'Speak',onPress:()=>{const e=M();if(e)if(z)_.current?.stop?.();else try{const t=new e;_.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&L(t)},t.onend=()=>W(!1),t.onerror=()=>{W(!1),F("Sorry, I didn't catch that. You can type instead.",'note')},W(!0),t.start()}catch{W(!1),F("Voice input isn't available here. Please type instead.",'note')}else F("Voice input isn't available in this browser (for example Huawei Browser). Please type your request instead.",'note')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:y.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:z?y.colours.gold:'transparent'},children:(0,k.jsx)(h.T,{size:20,children:"\ud83c\udfa4"})}):null,(0,k.jsx)(h.Button,{label:"Send",accessibilityLabel:"Send",disabled:!E.trim(),onPress:()=>H(E)})]}),(0,k.jsxs)(h.Muted,{center:!0,children:["Demo on this device \xb7 ",Y," of ",x.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,j.useCtx)(6e4),s=(0,x.useAssistant)();return T(t)?(0,k.jsxs)(c.default,{style:{gap:12},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(c.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:22})}),(0,k.jsxs)(c.default,{style:{flex:1},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,k.jsx)(h.Muted,{children:"Add walk-ins, mark dishes sold out, change prices, check the rota or bookings, draft offers, posts and replies. You confirm every action."})]})]}),(0,k.jsx)(h.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>S.getState().setOpen(!0)}),(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,k.jsxs)(c.default,{testID:"assistant-log",style:{gap:6},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>x.useAssistant.getState().clearLog()}):null]}),(0,k.jsx)(h.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,k.jsx)(h.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,k.jsxs)(c.default,{style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.T,{size:12,colour:y.colours.muted,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,")"]}),(0,k.jsx)(h.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,k.jsxs)(h.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,k.jsxs)(h.T,{size:13,colour:y.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,k.jsx)(h.Muted,{children:"The activity log is visible to the owner."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)();return T(e)?(0,k.jsxs)(c.default,{style:{gap:12},testID:"assistant-settings",children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,k.jsx)(h.Muted,{children:"Shows the gold Assistant button on every Managers screen."}),(0,k.jsx)(h.Toggle,{label:"Voice input (microphone)",value:t.voice,onChange:e=>t.set({voice:e})}),(0,k.jsx)(h.Muted,{children:"What you say is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. If this device can\u2019t record, just type."})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,k.jsxs)(c.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:y.colours.border,paddingTop:8},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:e.name}),(0,k.jsx)(h.Badge,{kind:"neutral",label:"Not connected"})]}),(0,k.jsxs)(h.Muted,{children:["Needed for ",e.does,". Until it\u2019s connected, the Assistant only shows you a preview \u2014 nothing is sent or changed."]})]},e.id)),(0,k.jsx)(h.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,k.jsx)(h.Muted,{children:"The Assistant comes with Full Restaurant Pro App and the early adopter offer. It isn\u2019t part of Customer & Takeaway App. This switch only shows how the app looks with it switched off."})]}):null,(0,k.jsx)(h.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to the voice assistant to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,x.useAssistant)(),t=(0,x.tasksUsed)(e),s=Math.min(1,t/x.FAIR_USE);return(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,k.jsx)(h.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,k.jsx)(c.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${x.FAIR_USE} tasks used`,style:{height:8,backgroundColor:y.colours.border,borderRadius:4},children:(0,k.jsx)(c.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:y.colours.gold,borderRadius:4}})}),(0,k.jsxs)(h.Muted,{children:[t," of ",x.FAIR_USE," tasks used this month (mock). A task is one confirmed action or look-up."]})]})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),o=_r(d[3]),a=e(_r(d[4]));_r(d[5]);var r=e(_r(d[6])),l=e(_r(d[7])),c=e(_r(d[8])),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),m=_r(d[14]),x=_r(d[15]),y=_r(d[16]),j=_r(d[17]),k=_r(d[18]);const w=!0,C='Nothing was sent or changed: this connection is not set up yet.',A='#1A1408',S=(0,u.create)(e=>({open:!1,setOpen:t=>e({open:t})})),T=e=>'owner'===e||'manager'===e,I=()=>Math.random().toString(36).slice(2,9);function v({size:e=24,colour:t=A}){return(0,k.jsx)(h.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function R(){const{rid:e,r:t,now:n,today:a}=(0,j.useCtx)(3e4),r=(0,b.useAllMenu)(e),l=(0,p.useTableNames)(e),c=(0,b.useBookings)(e),u=(0,f.useOwner)(e=>e.staff),h=(0,f.useOwner)(e=>e.shifts),m=(0,f.useOwner)(e=>e.offers),x=(0,f.useOwner)(e=>e.suppliers);return(0,o.useMemo)(()=>({venue:t.name,now:n.toISOString(),menu:r.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:l,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:h.filter(e=>e.published&&e.date>=(0,f.addDays)(a,-(0,f.weekdayOf)(a))&&e.date<=(0,f.addDays)(a,6-(0,f.weekdayOf)(a))),bookingsToday:c.filter(e=>e.date===a).sort((e,t)=>e.time.localeCompare(t.time)).map(e=>({name:e.walkIn?'Walk-in':e.name,party:e.partySize,time:e.time,table:e.table,status:e.status})),specials:m.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,s.examplesAllowed)()?{from:`${x[0]?.contact??'Alex Sample'}, ${x[0]?.name??'Example Fish Co.'}`,subject:'Price update for next week (example)',body:'Langoustine is up about 8% next week because of the weather. Haddock and hake unchanged. Same delivery days.'}:null}),[t,n.getMinutes(),r,l,c,u,h,m,x])}function D({m:e,onConfirm:s,onCancel:n}){const a=e.proposal,[r,l]=(0,o.useState)(!1),[u,p]=(0,o.useState)('external'===a.kind?a.text:''),b='open'===e.state;return'inapp'!==a.kind&&'external'!==a.kind?null:(0,k.jsxs)(c.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?y.colours.gold:y.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:y.colours.surface2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:a.title}),'external'===a.kind?(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,k.jsx)(h.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===a.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[a.detail?(0,k.jsx)(h.Muted,{children:a.detail}):null,(0,k.jsx)(h.T,{size:14,colour:y.colours.muted,children:a.label}),r&&b?(0,k.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:u,onChangeText:p,style:[h.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,k.jsx)(c.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:y.colours.gold,paddingLeft:10},children:(0,k.jsxs)(h.T,{children:["\u201c",u,"\u201d"]})}),(0,k.jsxs)(h.Muted,{children:["Sends to: ",a.service.map(e=>m.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,k.jsxs)(c.default,{style:{gap:4},children:[(0,k.jsx)(h.Muted,{children:a.detail}),a.warning?(0,k.jsxs)(h.T,{size:13,colour:y.colours.amber,children:["\u26a0 ",a.warning]}):null]}),b?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,k.jsx)(h.Button,{small:!0,label:'inapp'===a.kind?a.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(a,u)}),'external'===a.kind?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:r?'Done editing':'Edit',testID:"edit-action",onPress:()=>l(!r)}):null,(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,k.jsx)(h.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,k.jsxs)(h.Muted,{children:["Nothing happens until you tap ",'inapp'===a.kind?a.confirmLabel:'Confirm',"."]}):null]})}function M(){return'undefined'==typeof window?null:(0,n.speechRecognizer)()}const B=[{id:'facebook',name:'Facebook (Page & Messenger)',does:'posts and the Messenger auto-reply'},{id:'instagram',name:'Instagram',does:'posts'},{id:'gmail',name:'Gmail',does:'drafting and replying to email'},{id:'wix',name:'Website bookings',does:'website changes such as opening hours'}]},1410,[796,858,929,34,395,236,402,295,102,815,794,1096,848,865,1411,1415,840,1100,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"interpretDemo",{enumerable:!0,get:function(){return t.interpretDemo}}),e.getProvider=function(o="demo"){return'xai'===o?n.xaiProvider:t.demoProvider};var t=r(d[0]),n=r(d[1]),o=r(d[2]);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]}})})},1411,[1412,1414,1413]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.interpretDemo=u,Object.defineProperty(_e,"demoProvider",{enumerable:!0,get:function(){return m}});var e=r(_d[0]),t=r(_d[1]);const a=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],n=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,o=e=>e.toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').trim(),s=e=>o(e).replace(/\([^)]*\)/g,' ').split(/[^a-z0-9]+/).filter(e=>e.length>2&&!['the','and','with','our'].includes(e)),l={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},d=e=>e?l[e]??Number(e):NaN,c=e=>(e.match(/["\u201c\u201d']([^"\u201c\u201d]{3,})["\u201c\u201d']?\s*$/)||e.match(/\bto[:\s]+(.{3,})$/i)||[])[1]?.replace(/["\u201c\u201d]+$/,'').trim();function p(e,t){const a=s(t),n=e.menu.map(e=>{const n=s(e.name);return{m:e,hits:a.filter(e=>n.includes(e)).length,exact:o(e.name).includes(o(t))}}),l=n.filter(e=>e.exact);if(1===l.length)return[l[0].m];const d=Math.max(0,...n.map(e=>e.hits));if(!d)return[];const c=n.filter(e=>e.hits===d).map(e=>e.m);return d===a.length&&1===c.length?c:c.slice(0,4)}function u(s,l){const u=o(s),m=new Date(l.now);if(/messenger|auto-?reply|away message/.test(u)){return{kind:'external',intent:'messenger-autoreply',service:['messenger'],title:'Facebook Messenger auto-reply',label:'Change Messenger auto-reply to:',text:c(s)||`Thanks for getting in touch with ${l.venue}! We'll reply as soon as we can. To book a table, use our app.`}}if(/\b(post|share|publish)\b/.test(u)&&/facebook|instagram|\bfb\b|\binsta|\big\b|social/.test(u)){const e=/facebook|\bfb\b|social/.test(u),t=/instagram|\binsta|\big\b|social/.test(u),a=/special/.test(u)&&l.specials.length?`Tonight at ${l.venue}: ${l.specials.map(e=>e.title.replace(/\s*\(example\)/i,'')).join(' \xb7 ')}. Book in the app or just walk in!`:c(s)||`Tonight at ${l.venue} \u2014 come and see us!`,n=[...e?['facebook']:[],...t?['instagram']:[]];return{kind:'external',intent:'social-post',service:n,title:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}`,label:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}:`,text:a}}if(/(reply|respond|answer|draft).*(e-?mail|gmail|supplier)|(e-?mail|gmail).*(reply|draft)/.test(u)){const e=l.latestSupplierEmail;if(!e)return{kind:'unknown',message:"I can't read your email yet: CoverCharge isn't linked to Gmail. Paste the supplier's message here and I'll draft a reply for you to check and send yourself.",suggestions:[]};const t=`Hi ${e.from.split(' ')[0]},\n\nThanks for letting us know. That's fine for this week \u2014 please keep our usual standing order and let me know if anything changes.\n\nBest wishes,\n${l.venue}`;return{kind:'external',intent:'gmail-reply',service:['gmail'],title:`Gmail reply to ${e.from}`,label:`Reply to "${e.subject}" (${e.from}):`,text:t,detail:`Latest supplier email (example): "${e.body}"`}}if(/\bwix\b|website|web site/.test(u)&&/hour|open|clos/.test(u)){return{kind:'external',intent:'wix-hours',service:['wix'],title:'Website bookings opening hours',label:'Update website bookings opening hours to:',text:[1,2,3,4,5,6,0].map(e=>{const t=l.kitchenHours[e];return`${a[(e+6)%7]}: ${t?`${t[0]}\u2013${t[1]}`:'Closed'}`}).join('\n'),detail:'From the kitchen hours saved in CoverCharge.'}}const h=u.match(/walk-?in\b.*?\b(?:for|of)\s+(\d+|[a-z]+)(?:.*?\btable\s+([a-z]?\d+[a-z]?(?:\+\d+)?))?/)||u.match(/\b(\d+|[a-z]+)\s+walk-?ins?\b(?:.*?\btable\s+([a-z]?\d+))?/);if(h&&!Number.isNaN(d(h[1]))){const t=d(h[1]),a=h[2]?h[2].toUpperCase():'';if(a&&!l.tables.map(e=>e.toUpperCase()).includes(a))return{kind:'unknown',message:`There's no table ${a} on the table plan. Try one of: ${l.tables.slice(0,12).join(', ')}.`,suggestions:[`Add a walk-in for ${t} at table ${l.tables[0]}`]};const n=a?l.bookingsToday.find(e=>e.table?.toUpperCase().split('+').includes(a)&&['seated','confirmed'].includes(e.status)):void 0;return{kind:'inapp',intent:'walkin',title:`Seat a walk-in for ${t}${a?` at table ${a}`:''}`,detail:`Adds \u201cWalk-in \xb7 ${t}\u201d to today's bookings${a?` at table ${a}`:' (table to assign)'} and counts ${t} covers.`,confirmLabel:'Seat walk-in',params:{party:t,table:a},warning:n?`${(0,e.tableNumbers)(a)} also has a ${n.status} booking at ${n.time} (party of ${n.party}).`:void 0}}const b=u.match(/^(?:please )?(?:mark |set |make )?(?:the )?(.+?)\s+(?:as |to )?(?:86'?d?|86ed|sold out)(?=\W|$)/)||u.match(/^86 (?:the )?(.+)$/),f=u.match(/^(?:put |mark |set )?(?:the )?(.+?)\s+(?:back on|as available|available again|un-?86'?d?)/);if((b||f)&&!/walk|book|rota|price/.test(u)){const e=(b||f)[1].replace(/^mark |^set /,''),t=p(l,e),a=!!f&&!b;return 1===t.length?{kind:'inapp',intent:'eightysix',title:a?`Put ${t[0].name} back on`:`Mark ${t[0].name} sold out`,detail:a?'Takes it off the Sold out list and the Display.':'A reminder for staff: it shows on the Display and in the Sold out list until you put it back on. It doesn\'t change your till.',confirmLabel:a?'Back on':'Mark sold out',params:{itemId:t[0].id,name:t[0].name,soldOut:!a}}:t.length>1?{kind:'choose',message:`I couldn't find "${e}" exactly on the menu. Did you mean:`,options:t.map(e=>({label:e.name,prompt:`Mark ${e.name} sold out`}))}:{kind:'unknown',message:`I couldn't find "${e}" on the menu.`,suggestions:['Mark the Fish Supper sold out']}}const k=u.match(/(?:change|set|update|make)\s+(?:the\s+)?(?:price\s+of\s+(?:the\s+)?)?(.+?)\s+(?:price\s+)?to\s+\xa3?\s?(\d+(?:\.\d{1,2})?)/);if(k&&/\xa3|price|\d/.test(u)){const e=p(l,k[1].replace(/\s*price$/,'')),t=Math.round(100*Number(k[2]));if(1===e.length)return{kind:'inapp',intent:'price',title:`Change ${e[0].name} to \xa3${(t/100).toFixed(2)}`,detail:`Now ${null==e[0].price?'board price':`\xa3${(e[0].price/100).toFixed(2)}`}. Updates the menu in the customer app.`,confirmLabel:'Change price',params:{itemId:e[0].id,name:e[0].name,pence:t}};if(e.length>1)return{kind:'choose',message:'Which dish?',options:e.map(e=>({label:e.name,prompt:`Change the price of ${e.name} to \xa3${(t/100).toFixed(2)}`}))}}if(/rota|who'?s on|who is on|working|on shift/.test(u)){let e=(m.getDay()+6)%7,t='today';/tomorrow/.test(u)&&(e=(e+1)%7,t='tomorrow');const o=a.findIndex(e=>u.includes(e.toLowerCase()));o>=0&&(e=o,t=a[o]);const s=l.shifts.filter(t=>t.day===e).sort((e,t)=>e.start-t.start).map(e=>{const t=l.staff.find(t=>t.id===e.staffId);return`${t?.name??'Someone'} (${t?.job??''}) ${n(e.start)}\u2013${n(e.end)}`});return{kind:'inapp',intent:'rota',title:`Show the rota for ${t} (${a[e]})`,detail:'Read-only: looks up the rota saved in CoverCharge. Nothing is changed.',confirmLabel:'Show rota',params:{day:e,label:t,result:s.length?s.join('\n'):'Nobody is on the rota.'}}}if(/booking|covers|reservations?/.test(u)&&!/^(add|make|create)/.test(u)){const t=l.bookingsToday.filter(e=>!['cancelled','noshow'].includes(e.status)),a=t.map(t=>`${t.time} \xb7 ${t.name} \xb7 ${t.party}${t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:''} \xb7 ${t.status}`);return{kind:'inapp',intent:'bookings',title:"Show today's bookings",detail:'Read-only: looks up bookings saved in CoverCharge. Nothing is changed.',confirmLabel:'Show bookings',params:{result:`${t.length} bookings, ${t.reduce((e,t)=>e+t.party,0)} covers\n${a.join('\n')}`}}}if(/(draft|create|write|make|add).*(offer|deal|promo|special)/.test(u)){const e=(s.match(/(?:offer|deal|promo|special)\s+(?:for|on)\s+(.+)$/i)||[])[1]?.trim(),t=e?`${e[0].toUpperCase()}${e.slice(1)}`:'Midweek offer (draft)';return{kind:'inapp',intent:'offer',title:`Draft an offer: ${t}`,detail:'Saved as a draft in Offers & specials (not live, nothing sent). Edit it there before you publish.',confirmLabel:'Save draft',params:{title:t,body:e?`${t} at ${l.venue}. Ask your server for details.`:`A midweek treat at ${l.venue}. Add the details before you publish.`}}}return{kind:'unknown',message:"Sorry \u2014 I can't do that yet. Here are some things I can help with:",suggestions:t.SUGGESTED_PROMPTS.slice(1,6)}}const m={id:'demo',label:'On-device assistant',interpret:async(e,t)=>u(e,t)}},1412,[829,1413]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUGGESTED_PROMPTS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SERVICE_LABEL",{enumerable:!0,get:function(){return t}});const o=['Change our Facebook Messenger auto-reply to "Thanks for your message \u2014 we reply within the hour. To book, use the app."','Draft a reply to the latest supplier email','Add a walk-in for 4 at table 7',"Post tonight's specials to Facebook & Instagram",'Mark the fish pie sold out',"Who's on the rota tomorrow?",'Update website bookings opening hours'],t={facebook:'Facebook',messenger:'Facebook Messenger',instagram:'Instagram',gmail:'Gmail',wix:'Website bookings'}},1413,[]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_TOOLS",{enumerable:!0,get:function(){return o}}),e.callToText=a,e.interpretWithServer=s,Object.defineProperty(e,"xaiProvider",{enumerable:!0,get:function(){return u}});var t=_r(d[0]),n=_r(d[1]);const r=(t,n,r,o=[])=>({type:'function',function:{name:t,description:n,parameters:{type:'object',properties:r,required:o}}}),o=[r('walk_in','Seat a walk-in party now',{party:{type:'integer',description:'Number of covers'},table:{type:'string',description:'Table name, optional'}},['party']),r('sold_out','Mark a dish sold out, or put it back on',{dish:{type:'string',description:'Dish name'},back_on:{type:'boolean',description:'True to put it back on'}},['dish']),r('set_price','Change the menu price of a dish',{dish:{type:'string',description:'Dish name'},pounds:{type:'number',description:'New price in pounds'}},['dish','pounds']),r('show_rota','Show who is on the rota',{day:{type:'string',description:'today, tomorrow or a weekday'}}),r('show_bookings',"Show today's bookings and covers",{}),r('draft_offer','Draft an offer (saved as a draft, not live)',{what:{type:'string',description:'What the offer is for'}})];function a(t,n){const r=t=>String(n[t]??'').trim();switch(t){case'walk_in':return Number(n.party)>0?`walk-in for ${Number(n.party)}${r('table')?` table ${r('table')}`:''}`:null;case'sold_out':return r('dish')?n.back_on?`put ${r('dish')} back on`:`mark ${r('dish')} sold out`:null;case'set_price':return r('dish')&&Number(n.pounds)>0?`change the price of ${r('dish')} to \xa3${Number(n.pounds)}`:null;case'show_rota':return`who's on the rota ${r('day')||'today'}`;case'show_bookings':return"today's bookings";case'draft_offer':return"draft an offer"+(r('what')?` for ${r('what')}`:'');default:return null}}async function s(r,s,u=n.askServer){const c=(0,t.interpretDemo)(r,s);if('unknown'!==c.kind)return c;const p=await u('owner',r,o);if('call'===p.kind){const n=a(p.name,p.args);if(n){const r=(0,t.interpretDemo)(n,s);if('unknown'!==r.kind)return r}return c}return'text'===p.kind?{kind:'unknown',message:p.text,suggestions:[]}:c}const u={id:'xai',label:'Voice assistant (server, with on-device fallback)',interpret:s}},1414,[1412,930]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FAIR_USE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useAssistant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tasksUsed",{enumerable:!0,get:function(){return b}});var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]);const c=300,u=(0,s.create)()((0,l.persist)(e=>({enabled:!0,voice:!0,tier:'pro',baseUsed:41,log:[],set:t=>e(t),record:t=>e(e=>({log:[{...t,id:`as-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`},...e.log].slice(0,200)})),clearLog:()=>e({log:[]})}),{name:'covercharge-assistant-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:(e,t)=>t<2?{...e,enabled:!0,voice:!0}:e})),b=e=>((0,t.examplesAllowed)()?e.baseUsed:0)+e.log.filter(e=>['done','demo (nothing sent)','looked up'].includes(e.outcome)).length},1415,[858,808,815,818]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.InfoHours=function(){const{r:e}=(0,w.useCtx)(6e4),[t,s]=(0,d.useState)(e.tagline),[n,i]=(0,d.useState)(e.phone??''),[a,r]=(0,d.useState)(e.about??''),[o,h]=(0,d.useState)(e.kitchenHours),[g,x]=(0,d.useState)(!1);return(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"info",title:"Edit basic info yourself anytime",children:"Prices, sold-out, hours and specials are free to change on any plan, as often as you like."}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.location}),(0,T.jsx)(p.Field,{label:"Tagline",value:t,onChangeText:s}),(0,T.jsx)(p.Field,{label:"Phone",value:n,onChangeText:i,keyboardType:"phone-pad"}),(0,T.jsx)(p.Field,{label:"About",value:a,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Kitchen hours"}),k.map((e,t)=>{const s=P[t],n=o[s];return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{style:{width:44},children:e}),n?(0,T.jsxs)(p.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>h({...o,[s]:[e,n[1]]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,T.jsx)(p.T,{children:"\u2013"}),(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>h({...o,[s]:[n[0],e]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,T.jsx)(p.Muted,{style:{flex:1},children:"Closed"}),(0,T.jsx)(c.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>h({...o,[s]:e?['12:00','20:00']:null}),trackColor:{true:b.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:b.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,T.jsx)(p.Muted,{children:e.hoursNote}):null]}),(0,T.jsx)(p.Button,{label:"Save changes",onPress:()=>{R().updateRestaurant(e.id,{tagline:t,phone:n,about:a,kitchenHours:o}),x(!0)}}),g?(0,T.jsx)(p.Banner,{kind:"success",title:"Saved",children:"Shared with your other devices and the customer app. Guests see it next time they open the app."}):null]})},_e.Photos=function(){const e=(0,x.useOwner)(e=>e.photos),[t,s]=(0,d.useState)('');return i.LIVE_VENUE_BUILD?(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,T.jsx)(p.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Placeholder photos",children:"Adding photos from the camera or gallery isn\u2019t set up yet. Tiles stand in for uploaded photos."}),(0,T.jsx)(p.Row,{wrap:!0,gap:8,children:e.map(e=>(0,T.jsxs)(u.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,T.jsx)(p.T,{size:13,children:e.caption}),(0,T.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>x.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,T.jsx)(p.T,{size:13,colour:b.colours.gold,children:"Remove"})})]},e.id))}),(0,T.jsx)(p.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,T.jsx)(p.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{x.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:n,role:l}=(0,w.useCtx)(6e4),a=(0,g.useAllMenu)(t),[r,c]=(0,d.useState)(null),[h,x]=(0,d.useState)(!1),[f,m]=(0,d.useState)(5),[C,v]=(0,d.useState)([]),[k,P]=(0,d.useState)('all'),B=(0,g.useStore)(e=>e.menu),O=e=>!!B.find(t=>t.id===e)?.hidden,$=a.filter(e=>!e.signOff&&!O(e.id)).length;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Button,{small:!0,label:"Add dish",onPress:()=>c('new')}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{x(!h),v([])}}),!e||'owner'!==l&&'manager'!==l?null:(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),$?(0,T.jsx)(o.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,T.jsx)(p.Banner,{kind:"warn",title:`${$} dish${1===$?'':'es'} awaiting the head chef's sign-off`,children:"Allergens, section and price come from each dish\u2019s recipe card. The head chef signs cards off in the Head Chef app. Tap to open Recipe cards."})}):null,h?(0,T.jsx)(p.Banner,{kind:"warn",title:"Price changes reset sign-off",children:"Each dish\u2019s price is on its recipe card, so a price change sets that card back to \u201cAwaiting sign-off\u201d until the head chef signs it off."}):null,i.LIVE_VENUE_BUILD?(0,T.jsx)(p.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Scheduled menus"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:"All day",selected:'all'===k,onPress:()=>P('all')}),(0,T.jsx)(p.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>P('lunch')}),(0,T.jsx)(p.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>P('dinner')})]}),(0,T.jsx)(p.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,T.jsxs)(p.Card,{highlight:b.colours.gold,children:[(0,T.jsxs)(p.T,{weight:"semibold",children:["Bulk price edit \xb7 ",C.length," selected"]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Change by %"}),(0,T.jsx)(p.Stepper,{value:f,onChange:m,min:-30,max:30,label:"percent"})]}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>v(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,T.jsx)(p.Button,{small:!0,label:`Apply ${f>0?'+':''}${f}%`,disabled:!C.length||0===f,onPress:()=>{C.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&R().updateMenuItem(e,{price:5*Math.round(t.price*(100+f)/100/5)})}),v([])}})]}),(0,T.jsx)(p.Muted,{children:"Prices round to the nearest 5p."})]}):null,s.sections.map(e=>{const t=a.filter(t=>t.section===e&&('all'===k||'lunch'!==k||!/supper|steak|lobster/i.test(t.name)));return t.length?(0,T.jsxs)(u.default,{style:{gap:6},children:[(0,T.jsx)(y.SectionHead,{title:e}),t.map(e=>(0,T.jsxs)(u.default,{style:[p.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,T.jsx)(p.Toggle,{label:`select ${e.name}`,value:C.includes(e.id),onChange:t=>v(t?[...C,e.id]:C.filter(t=>t!==e.id))}):null,(0,T.jsxs)(o.default,{style:{flex:1},onPress:()=>c(e),accessibilityRole:"button",children:[(0,T.jsx)(p.T,{weight:"medium",children:e.name}),(0,T.jsxs)(p.Muted,{children:[null!=e.price?(0,j.gbp)(e.price):e.priceNote??'Board price'," \xb7 ",Object.keys(e.allergens).length," allergens \xb7 ",e.signOff?`signed off by ${e.signOff.by}, ${e.signOff.at}`:'awaiting sign-off']})]})]}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>(R().updateMenuItem(e.id,{soldOut:!e.soldOut}),(0,S.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,T.jsx)(p.Chip,{label:O(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:O(e.id),onPress:()=>R().updateMenuItem(e.id,{hidden:!O(e.id)})})]})]},e.id))]},e):null}),r?(0,T.jsx)(M,{item:'new'===r?null:r,onClose:()=>c(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:s}=(0,w.useCtx)(6e4),n=(0,g.useEvents)(t).filter(e=>e.restaurantId===t),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[h,x]=(0,d.useState)(null),f=(()=>{const e=a.trim(),t=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(e);if(t){const e=Number(t[1]),s=Number(t[2]);return e>=1&&e<=31&&s>=1&&s<=12?`${t[3]}-${String(s).padStart(2,'0')}-${String(e).padStart(2,'0')}`:''}return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:''})(),j=l.trim().length>2&&!!f&&!Number.isNaN((0,m.parseYmd)(f).getTime());return(0,T.jsxs)(u.default,{style:{gap:10},children:[n.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:t.date=s?(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{g.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),x(null)}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>x(null)})]}):(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>x(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Add an event"}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i,placeholder:"e.g. Seafood night"}),(0,T.jsx)(p.Field,{label:"Date (DD/MM/YYYY)",value:a,onChangeText:r,placeholder:"20/11/2026"}),(0,T.jsx)(p.Field,{label:"Description",value:o,onChangeText:c,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add event",disabled:!j,onPress:()=>{R().addEvent({restaurantId:t,date:f,title:l.trim(),kind:'event',description:o.trim(),example:!1}),i(''),r(''),c('')}}),(0,T.jsx)(p.Muted,{children:"Events show in the customer app\u2019s What\u2019s on and on its booking dates, and feed the forecast."})]})]})},_e.GiftCardsPage=function(){const{rid:e}=(0,w.useCtx)(6e4),n=(0,g.useStore)((0,h.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[l,i]=(0,d.useState)(25),[a,r]=(0,d.useState)(''),o=n.reduce((e,t)=>e+t.initial,0),c=n.reduce((e,t)=>e+t.balance,0);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Sold (all time)"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(o)})]}),(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Outstanding balance"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(c)})]})]}),n.map(e=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,T.jsx)(p.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,T.jsxs)(p.Muted,{children:[e.code," \xb7 ",(0,j.gbp)(e.balance)," of ",(0,j.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,T.jsx)(p.Chip,{label:`\xa3${e}`,selected:l===e,onPress:()=>i(e)},e))}),(0,T.jsx)(p.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,T.jsx)(s.GreensideCashOnly,{}):(0,T.jsx)(p.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,T.jsx)(p.Button,{label:`Issue \xa3${l} card`,disabled:a.trim().length<2,onPress:()=>{R().buyGiftCard(e,100*l,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,w.useCtx)(6e4),t=(0,g.useRatings)(e),[s,n]=(0,d.useState)('all'),l=t.filter(e=>'all'===s||e.stars<=3).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),i=t.length?t.reduce((e,t)=>e+t.stars,0)/t.length:0;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,T.jsxs)(p.Row,{gap:4,children:[(0,T.jsx)(p.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,T.jsx)(p.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,T.jsx)(p.Banner,{kind:"danger",title:"Low-rating alert",children:`${t.filter(e=>e.stars<=2).length} rating(s) at 2\u2605 or below. Reply within 24 hours.`}):null,l.map(e=>(0,T.jsxs)(p.Card,{highlight:e.stars<=2?b.colours.red:void 0,children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.customerName}),(0,T.jsxs)(p.T,{colour:b.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,T.jsx)(p.T,{size:14,children:e.comment||'(no comment)'}),(0,T.jsx)(p.Muted,{children:e.context??''})]},e.id)),(0,T.jsx)(p.Banner,{kind:"info",title:"No review gating",children:"After private feedback, every customer (whatever their rating) is shown the link to leave a public Google review. Low ratings alert you here so you can put it right."}),(0,T.jsx)(p.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return y.DemoTag}}),_e.StampSettings=function(){return i.LIVE_VENUE_BUILD||(0,a.staffServer)()?(0,T.jsx)(r.LoyaltySettingsPanel,{}):(0,T.jsx)(O,{})},_e.Offers=function({go:e}){return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,a.staffServer)()?(0,T.jsx)(p.Banner,{kind:"info",title:"Stamp card offers are in Settings \u203a Advanced \u203a Loyalty",children:"Offers there are saved on the server and shown on every guest\u2019s stamp card. Specials below stay as they were."}):null,(0,T.jsx)(B,{go:e})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),o=e(_r(_d[8])),c=e(_r(_d[9])),u=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),m=_r(_d[17]),b=_r(_d[18]),y=_r(_d[19]),w=_r(_d[20]),S=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]);const k=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],P=[1,2,3,4,5,6,0],R=()=>g.useStore.getState();function M({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,w.useCtx)(6e4),[i,a]=(0,d.useState)(e?.name??''),[r,o]=(0,d.useState)(e?.description??''),[c,u]=(0,d.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,g]=(0,d.useState)(e?.section??l.sections[0]??'Mains'),[x,j]=(0,d.useState)(e?.prepMins??0),m=''===c.trim()?null:Math.round(100*Number(c)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},S=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,T.jsx)(p.Field,{label:"Name",value:i,onChangeText:a}),(0,T.jsx)(p.Field,{label:"Description",value:r,onChangeText:o,multiline:!0}),(0,T.jsx)(p.Field,{label:"Price \xa3 (blank = board price)",value:c,onChangeText:u,keyboardType:"decimal-pad"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,T.jsx)(p.Chip,{label:e,selected:h===e,onPress:()=>g(e)},e))}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Prep time (min)"}),(0,T.jsx)(p.Stepper,{value:x,onChange:j,min:1,max:60,label:"prep minutes"})]}),(0,T.jsx)(p.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[f.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,T.jsx)(p.Badge,{label:'may'===y[e.id]?`May contain ${e.short.toLowerCase()}`:e.short,kind:'may'===y[e.id]?'amber':'red'},e.id)),e&&!Object.keys(y).length?(0,T.jsx)(p.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,T.jsx)(p.Muted,{children:e?e.signOff?`Signed off by ${e.signOff.by} on ${e.signOff.at}.`:'Awaiting sign-off by the head chef.':'Saving adds the dish and its recipe card. Add the ingredients and allergens on the card; the dish stays off the menu until the head chef signs it off.'}),s?(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,S&&e?.signOff?(0,T.jsx)(p.Banner,{kind:"warn",title:"Sign-off resets",children:"Name, price and section live on the recipe card. Changing them sets the card back to \u201cAwaiting sign-off\u201d until the head chef signs it off again."}):null,(0,T.jsx)(p.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?R().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:x}):R().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:x,soldOut:!1,signOff:null}),t()}})]})}function B({go:e}){const{now:t}=(0,w.useCtx)(6e4),s=(0,x.useOwner)(e=>e.offers),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)('special'),[h,g]=(0,d.useState)(null);return(0,T.jsxs)(u.default,{style:{gap:10},children:[s.map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,T.jsxs)(p.Muted,{children:[t.body,t.until?` \xb7 until ${(0,m.niceDate)((0,m.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,T.jsx)(p.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Toggle,{label:"Live in app",value:t.live,onChange:e=>x.useOwner.getState().updateOffer(t.id,{live:e})}),(0,T.jsx)(p.Muted,{children:t.live?'Live in app':'Hidden'}),(0,T.jsx)(u.default,{style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>g(t.id)})]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"New special or offer"}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Chip,{label:"Special",selected:'special'===o,onPress:()=>c('special')}),(0,T.jsx)(p.Chip,{label:"Offer",selected:'offer'===o,onPress:()=>c('offer')})]}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i}),(0,T.jsx)(p.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add",disabled:l.trim().length<3,onPress:()=>{x.useOwner.getState().addOffer({title:l.trim(),body:a.trim(),kind:o,live:!0}),i(''),r('')}})]}),h?(()=>{const e=s.find(e=>e.id===h);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:()=>g(null),title:"Push notification composer",children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,T.jsxs)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,T.jsx)(p.Muted,{children:"CoverCharge \xb7 now"}),(0,T.jsx)(p.T,{weight:"semibold",children:e.title}),(0,T.jsx)(p.T,{size:14,children:e.body})]}),(0,T.jsxs)(p.Muted,{children:["Audience: customers who opted in to ",(0,v.venueInfo)().name," offers. No audience count is available."]}),(0,T.jsx)(p.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{x.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,m.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),g(null)}})]})})():null]})}function O(){const{r:e}=(0,w.useCtx)(6e4),t=e.settings,[s,n]=(0,d.useState)(t.stampReward);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Stamp card"}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Stamps for a reward"}),(0,T.jsx)(p.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>R().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Minimum spend"}),(0,T.jsx)(p.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>R().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,T.jsxs)(p.Muted,{children:[(0,j.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,T.jsx)(p.Field,{label:"Reward",value:s,onChangeText:n}),(0,T.jsx)(p.Button,{small:!0,label:"Save reward",onPress:()=>R().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,T.jsx)(u.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:b.colours.gold,backgroundColor:t<3?b.colours.gold:'transparent'}},t))}),(0,T.jsxs)(p.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1416,[5,1341,798,796,806,1205,1363,34,402,410,102,853,794,848,865,830,836,827,840,1147,1100,1135,1366,1166,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1417,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandingSettings=function(){const{rid:e,r:t}=(0,h.useCtx)(6e4),p=(0,l.useBrand)(e),x=(0,c.useOwner)(e=>e.setBranding),[j,f]=(0,r.useState)(''),y=(0,c.useOwner)(o=>o.branding[e]?.recent)??[],[w,C]=(0,r.useState)(p.accent);(0,r.useEffect)(()=>{C(p.accent)},[p.accent]);const v=(0,r.useMemo)(()=>(0,a.checkAccent)(w,u.colours.bg,u.colours.onGold,u.colours.text),[w]);return(0,b.jsxs)(n.default,{style:{gap:10},children:[(0,b.jsx)(d.Muted,{children:"Your logo, name and accent colour lead every CoverCharge app: Managers, Staff, Display, Head Chef and the customer app. A small \u201cpowered by CoverCharge\u201d stays at the top left."}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Customer header preview"}),(0,b.jsxs)(n.default,{testID:"branding-preview",style:{backgroundColor:u.colours.bg,borderRadius:12,borderWidth:1,borderColor:u.colours.border,padding:12,gap:4},children:[(0,b.jsx)(l.PoweredBy,{}),(0,b.jsxs)(d.Row,{gap:10,children:[(0,b.jsx)(l.RestaurantLogo,{rid:e,size:52}),(0,b.jsxs)(n.default,{style:{flex:1},children:[(0,b.jsx)(d.T,{weight:"semibold",size:18,children:t.name}),(0,b.jsx)(d.T,{size:12,colour:v.accentText,children:t.location})]})]}),(0,b.jsx)(n.default,{testID:"branding-preview-button",style:{marginTop:8,backgroundColor:w,borderRadius:10,paddingVertical:10,alignItems:'center'},children:(0,b.jsx)(d.T,{weight:"semibold",colour:v.onAccent,children:"Book a table"})})]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Logo"}),(0,b.jsxs)(d.Muted,{children:[p.custom?'Your uploaded logo.':'anchorage'===e?'Built in: The Anchorage logo in black and gold.':l.BUILTIN_LOGOS[e]?`Built in: ${t.name} logo.`:'Built in: placeholder initials for this demo venue.'," Square images work best."]}),(0,b.jsxs)(d.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(d.Button,{label:"Upload a logo",onPress:async()=>{const r=await o.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(r.canceled||!r.assets?.[0])return;const t=r.assets[0],n=t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri;x(e,{logoUri:n}),f('Logo updated in all apps on this device.')},testID:"branding-upload"}),p.custom?(0,b.jsx)(d.Button,{kind:"secondary",label:"Use the built-in logo",onPress:()=>{x(e,{logoUri:void 0}),f('Back to the built-in logo.')}}):null]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Accent colour"}),(0,b.jsx)(d.Muted,{children:"Any colour you like for your own brand. The preview above changes as you drag."}),(0,b.jsx)(s.ColourPicker,{value:w,onChange:C,onCommit:o=>{o===p.accent&&y[0]===o||(x(e,{accent:o,recent:(0,a.pushRecent)(y,o)}),f(`Accent set to ${o}.`))},quick:l.ACCENTS,recent:y}),v.tips.length?(0,b.jsx)(n.default,{testID:"accent-tip",style:{borderWidth:1,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg,borderRadius:10,padding:10,gap:4},children:v.tips.map(e=>(0,b.jsx)(d.T,{size:13,colour:u.colours.amber,children:e},e))}):null,(0,b.jsx)(d.Muted,{children:"Used for the restaurant line in headers, the logo ring and main buttons. Text on it is picked to stay readable."})]}),j?(0,b.jsx)(d.Banner,{kind:"success",title:"Saved",children:j}):null,(0,b.jsx)(d.Button,{kind:"ghost",label:"Restore default branding",onPress:()=>{x(e,null),f('Default branding restored.')}}),(0,b.jsx)(d.Muted,{children:"Saved the same way as your logo: on this device, shared by all the apps on it. Nothing is uploaded."})]})};var e,o=(function(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(r){if('default'!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),o.default=e,o})(_r(_d[0])),r=_r(_d[1]),t=_r(_d[2]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),b=_r(_d[10])},1418,[1061,34,102,1419,799,847,794,865,840,1100,25]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ColourPicker=function({value:e,onChange:p,onCommit:v,quick:y,recent:w}){const[R,C]=(0,t.useState)(()=>(0,c.hexToHsv)(e)),[H,T]=(0,t.useState)(e),[S,M]=(0,t.useState)(!1),F=(0,t.useRef)(e);(0,t.useEffect)(()=>{(0,c.normaliseHex)(e)!==(0,c.normaliseHex)(F.current)&&(F.current=e,C((0,c.hexToHsv)(e)),T(e))},[e]);const k=e=>{C(e);const o=(0,c.hsvToHex)(e);F.current=o,T(o),M(!1),p(o)},D=(0,t.useMemo)(()=>(0,c.hsvToHex)({h:R.h,s:R.s,v:1}),[R.h,R.s]),E=(0,t.useMemo)(()=>f.map(e=>(0,c.hsvToHex)({h:e,s:1,v:1})),[]),I=e=>{const o=(0,c.normaliseHex)(e);o&&(F.current=o,C((0,c.hexToHsv)(o)),T(o),M(!1),p(o),v(o))},z=(o,t,n)=>(0,x.jsx)(s.default,{testID:`accent-${n}-${t}`,accessibilityRole:"button",accessibilityLabel:`Accent ${o}`,onPress:()=>I(o),hitSlop:4,style:{width:40,height:40,borderRadius:20,backgroundColor:o,borderWidth:3,borderColor:(0,c.normaliseHex)(e)===(0,c.normaliseHex)(o)?u.colours.text:u.colours.border}},n+o+t);return(0,x.jsxs)(n.default,{testID:"colour-picker",style:{gap:10},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Drag across for the colour, up and down for how strong it is"}),(0,x.jsxs)(b,{testID:"picker-area",label:"Colour and strength",height:170,onMove:(e,o)=>k({h:360*e,s:1-o,v:R.v}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:[(0,x.jsxs)(l.Defs,{children:[(0,x.jsx)(l.LinearGradient,{id:"cpHue",x1:"0",y1:"0",x2:"1",y2:"0",children:E.map((e,o)=>(0,x.jsx)(l.Stop,{offset:o/(E.length-1),stopColor:e},o))}),(0,x.jsxs)(l.LinearGradient,{id:"cpSat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#FFFFFF",stopOpacity:0}),(0,x.jsx)(l.Stop,{offset:1,stopColor:"#FFFFFF",stopOpacity:1})]})]}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpHue)"}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpSat)"})]}),(0,x.jsx)(j,{x:R.h/360*100+"%",y:100*(1-R.s)+"%",colour:D})]}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Brightness"}),(0,x.jsxs)(b,{testID:"picker-brightness",label:"Brightness",height:36,onMove:e=>k({...R,v:Math.max(.04,e)}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 10",children:[(0,x.jsx)(l.Defs,{children:(0,x.jsxs)(l.LinearGradient,{id:"cpVal",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#000000"}),(0,x.jsx)(l.Stop,{offset:1,stopColor:D})]})}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"10",fill:"url(#cpVal)"})]}),(0,x.jsx)(j,{x:100*R.v+"%",y:"0%",colour:(0,c.hsvToHex)(R),round:!1})]}),(0,x.jsxs)(h.Row,{gap:10,style:{alignItems:'center'},children:[(0,x.jsx)(n.default,{testID:"picker-swatch",style:{width:46,height:46,borderRadius:10,backgroundColor:(0,c.normaliseHex)(H)??e,borderWidth:1,borderColor:u.colours.border}}),(0,x.jsxs)(n.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Hex code"}),(0,x.jsx)(o.TextInput,{testID:"picker-hex",value:H,autoCapitalize:"characters",autoCorrect:!1,maxLength:7,placeholder:"#CFA45F",placeholderTextColor:u.colours.muted,accessibilityLabel:"Hex code",onChangeText:e=>{T(e);const o=(0,c.normaliseHex)(e);M(!o&&e.replace('#','').length>=6),o&&6===e.replace('#','').length&&(F.current=o,C((0,c.hexToHsv)(o)),p(o))},onBlur:()=>{const e=(0,c.normaliseHex)(H);e?I(e):(T(F.current),M(!1))},onSubmitEditing:()=>{const e=(0,c.normaliseHex)(H);e?I(e):M(!0)},style:{minHeight:46,borderRadius:10,borderWidth:1,borderColor:S?u.colours.amber:u.colours.accentBorder,backgroundColor:u.colours.surface2,color:u.colours.text,paddingHorizontal:12,fontSize:16}})]})]}),S?(0,x.jsx)(h.T,{size:13,colour:u.colours.amber,children:"Use six letters or numbers after #, like #CFA45F."}):null,(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Quick picks"}),(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:y.map((e,o)=>z(e,o,'quick'))}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Recent colours"}),w.length?(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:w.map((e,o)=>z(e,o,'recent'))}):(0,x.jsx)(h.Muted,{children:"Colours you choose show here."})]})};var o=r(d[0]),t=r(d[1]);r(d[2]);var s=e(r(d[3])),n=e(r(d[4])),l=r(d[5]),i=e(l),c=r(d[6]),u=r(d[7]),h=r(d[8]),x=r(d[9]);const p={touchAction:'none',cursor:'crosshair',userSelect:'none'},f=[0,30,60,90,120,150,180,210,240,270,300,330,360];function b({height:e,onMove:o,onEnd:s,children:l,testID:i,label:c}){const h=(0,t.useRef)({w:1,h:e}),f=e=>{const{locationX:t,locationY:s}=e.nativeEvent;o(Math.min(1,Math.max(0,t/h.current.w)),Math.min(1,Math.max(0,s/h.current.h)))};return(0,x.jsx)(n.default,{testID:i,accessibilityLabel:c,onLayout:e=>{h.current={w:Math.max(1,e.nativeEvent.layout.width),h:Math.max(1,e.nativeEvent.layout.height)}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:f,onResponderMove:f,onResponderRelease:s,onResponderTerminate:s,style:[{height:e,borderRadius:10,overflow:'hidden',borderWidth:1,borderColor:u.colours.border},p],children:(0,x.jsx)(n.default,{pointerEvents:"none",style:{flex:1},children:l})})}const j=({x:e,y:o,colour:t,round:s=!0})=>(0,x.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:e,top:o,width:26,height:s?26:'100%',marginLeft:-13,marginTop:s?-13:0,borderRadius:s?13:6,borderWidth:3,borderColor:u.colours.text,backgroundColor:t,shadowColor:'#000',shadowOpacity:.6,shadowRadius:3}})},1419,[796,34,236,402,102,900,799,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.RecipeCardsPage=function(){const{rid:c,role:u,me:f}=(0,o.useCtx)(),_=(0,o.useSignedIn)(),l='owner'===u?'owner':'manager'===u?'manager':'staff';return(0,s.jsx)(t.RecipeCards,{rid:c,actor:(0,n.cardActorFor)(f,l,_),mode:'staff'===l?'read':'edit'})},r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4])},1420,[34,1132,832,1100,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:c,role:s,me:u,meId:l,today:p}=(0,t.useCtx)(6e4),_='owner'===s||'manager'===s;return(0,o.jsx)(n.CashUpScreen,{rid:c,today:p,canEdit:_,who:{id:l??'me',name:u.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),t=r(d[2]),o=r(d[3])},1421,[34,1048,1100,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1422,[34,1316,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=y,_e.SpendPerHeadPage=function(){const{rid:e,today:s}=(0,c.useCtx)(6e4),a=(0,r.useBookings)(e),n=(0,o.useCashUp)(e=>e.cashUps),[b,j]=(0,t.useState)('day'),k=(0,d.hasAnyTakings)(n,e),w=(0,d.dayRows)(n,a,e,s,14),f=(0,d.weekRows)(n,a,e,s,8),v=(0,d.averageSph)(w),$=(e,t,s,a,n)=>(0,u.jsxs)(l.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:h.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${t}: ${'No takings entered'===a?'no takings entered':`spend per head ${a}`}, ${s}${n?`, ${n}`:''}`,children:[(0,u.jsx)(i.T,{center:!0,children:t}),(0,u.jsx)(i.T,{center:!0,colour:h.colours.muted,children:s}),(0,u.jsx)(i.T,{center:!0,weight:"semibold",colour:'No takings entered'===a?h.colours.muted:h.colours.goldLight,size:'No takings entered'===a?13:16,children:a}),n?(0,u.jsx)(i.Muted,{center:!0,children:n}):null]},e);return(0,u.jsxs)(l.default,{style:{gap:12},testID:"sph-screen",children:[(0,u.jsx)(i.Muted,{children:"Tip: spend per head is Gross takings \xf7 Covers. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,u.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,u.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==v?(0,u.jsx)(i.T,{size:22,weight:"semibold",colour:h.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,u.jsxs)(i.T,{size:34,weight:"bold",colour:h.colours.goldLight,testID:"sph-avg",children:[p(v)," ",(0,u.jsx)(i.T,{size:16,colour:h.colours.muted,children:"per head"})]}),(0,u.jsx)(i.Muted,{children:k?'Only days with gross takings entered are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has Gross takings.'})]}),(0,u.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(i.Chip,{testID:"sph-day",label:"By day",selected:'day'===b,onPress:()=>j('day')}),(0,u.jsx)(i.Chip,{testID:"sph-week",label:"By week",selected:'week'===b,onPress:()=>j('week')})]}),'day'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by day"}),(0,u.jsx)(y,{testID:"sph-trend-day",label:"Spend per head trend by day",points:w.map(e=>({label:x(e.date),value:e.sph}))}),[...w].reverse().map(e=>$(e.date,x(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':p(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${p(e.foodPh)}, drink ${p(e.drinkPh)} per head`:void 0))]}):null,'week'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,u.jsx)(y,{testID:"sph-trend-week",label:"Spend per head trend by week",points:f.map(e=>({label:`w/c ${x(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...f].reverse().map(e=>$(e.weekStart,`w/c ${x(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':p(e.sph)))]}):null,(0,u.jsx)(i.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var t=_r(_d[0]),s=e(t),l=e(_r(_d[1])),a=_r(_d[2]),n=e(a),i=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,x=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function y({points:e,testID:r,label:o}){const[d,c]=(0,t.useState)(320),[x,y]=(0,t.useState)(e.length);(0,t.useEffect)(()=>y(e.length),[e.length,r]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,x)),k=Math.max(0,j-b),w=e.slice(k,j),f=Math.max(140,d-68),v=e.map(e=>e.value).filter(e=>null!=e),$=Math.max(5,5*Math.ceil(Math.max(0,...v)/5)),T=e=>38+e*(f-76)/Math.max(1,w.length-1),S=e=>140-e/$*106,L=[];let D=[];w.forEach((e,t)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:t,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${p(e.value)}`).join(', ');return(0,u.jsxs)(l.default,{testID:r,onLayout:e=>c(e.nativeEvent.layout.width),style:{gap:8},children:[(0,u.jsxs)(l.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,u.jsx)(n.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,u.jsx)(a.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:h.colours.muted,children:p($*e/4)},e))}),(0,u.jsxs)(n.default,{width:f,height:170,children:[[0,1,2,3,4].map(e=>(0,u.jsx)(a.Line,{x1:0,x2:f,y1:S($*e/4),y2:S($*e/4),stroke:h.colours.border,strokeWidth:1},e)),L.map((e,t)=>(0,u.jsx)(a.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:h.colours.gold,strokeWidth:2.5},t)),w.map((e,t)=>(0,u.jsx)(s.default.Fragment,{children:null==e.value?(0,u.jsx)(a.Circle,{cx:T(t),cy:140,r:2,fill:"#444"}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Circle,{cx:T(t),cy:S(e.value),r:4,fill:h.colours.goldLight}),(0,u.jsx)(a.Text,{x:T(t),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:h.colours.goldLight,children:p(e.value)})]})},k+t))]})]}),(0,u.jsx)(l.default,{style:{flexDirection:'row',gap:12},children:w.map((e,t)=>(0,u.jsxs)(l.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':p(e.value)}`,children:[(0,u.jsx)(i.T,{center:!0,size:12,colour:h.colours.muted,children:e.label}),(0,u.jsx)(i.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?h.colours.muted:h.colours.goldLight,children:null==e.value?'No takings entered':p(e.value)})]},k+t))}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===k,onPress:()=>y(Math.max(b,j-b))}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Later",accessibilityLabel:"Later spend per head chart points",disabled:j>=e.length,onPress:()=>y(Math.min(e.length,j+b))})]})]})}},1423,[34,102,900,794,848,1024,1424,840,1100,25]); -__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COUNTED",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"serviceOfBooking",{enumerable:!0,get:function(){return o}}),e.coversOn=d,e.dayRows=i,e.weekRows=function(n,t,s,o,d){const u=(0,r.weekStartOf)(o);return Array.from({length:d},(l,f)=>{const h=(0,r.addDaysYmd)(u,7*(f-d+1)),m=i(n,t,s,(0,r.addDaysYmd)(h,6),7).filter(r=>r.date<=o&&null!=r.gross),p=m.length?Math.round(100*m.reduce((r,n)=>r+n.gross,0))/100:null,v=m.reduce((r,n)=>r+n.covers,0);return{weekStart:h,gross:p,covers:v,days:m.length,sph:c(p,v)}})},e.serviceRows=function(n,t,s,o,i,l=1020){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r])),h=[];for(let n=0;nnull!=r.gross&&r.covers>0);return n.length?c(n.reduce((r,n)=>r+n.gross,0),n.reduce((r,n)=>r+n.covers,0)):null},Object.defineProperty(e,"hasAnyTakings",{enumerable:!0,get:function(){return l}});var r=_r(_d[0]);const n=['seated','finished'],t=r=>n.includes(r.status),s=r=>{const[n,t]=r.split(':').map(Number);return 60*n+(t||0)},o=(r,n)=>s(r.time)r.restaurantId===n&&r.date===s&&t(r)&&(!d||o(r,u)===d)).reduce((r,n)=>r+(n.partySize||0),0)}const u=r=>'number'==typeof r&&Number.isFinite(r)?r:null,c=(r,n)=>null==r||n<=0?null:Math.round(r/n*100)/100;function i(n,t,s,o,i){const l=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,f)=>{const h=(0,r.addDaysYmd)(o,f-i+1),m=l.get(h)?.vals??{},p=(0,r.grossOf)(m),v=d(t,s,h),y=u(m.food),b=u(m.drink);return{date:h,gross:p,covers:v,sph:c(p,v),food:y,drink:b,foodPh:c(y,v),drinkPh:c(b,v)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.grossOf)(n.vals))},1424,[13]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1425,[34,793,1100,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(W,{})},_e.Merch=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(X,{})},_e.TablesQr=function({go:e}={}){const{rid:s,r:t,now:r,me:a}=(0,A.useCtx)(1e4);return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(l.StaffTableOrders,{rid:s,me:a}),(0,V.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(t)?(0,V.jsx)(q,{rid:s,now:r,me:a}):(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:s,r:t,now:r}=(0,A.useCtx)(3e4),n=(0,T.useOrders)(s),a=t.settings,l=(0,P.takeawaySlots)(t,n,r).slice(0,10),i=e=>_().updateSettings(s,e),o=n.filter(e=>'takeaway'===e.type&&(0,B.LIVE)(e));return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:a.takeawayPaused?I.colours.red:I.colours.ok,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:a.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,V.jsx)(v.Toggle,{label:"Takeaway on",value:!a.takeawayPaused,onChange:e=>i({takeawayPaused:!e})})]}),(0,V.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Slot length (min)"}),(0,V.jsx)(v.Stepper,{value:a.slotMinutes,min:5,max:30,onChange:e=>i({slotMinutes:e}),label:"slot minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Orders per slot"}),(0,V.jsx)(v.Stepper,{value:a.slotCap,min:1,max:20,onChange:e=>i({slotCap:e}),label:"orders per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,V.jsx)(v.Stepper,{value:a.leadMins,min:5,max:60,onChange:e=>i({leadMins:e}),label:"lead minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,V.jsx)(v.Stepper,{value:a.bufferMins,min:0,max:20,onChange:e=>i({bufferMins:e}),label:"buffer minutes"})]}),(0,V.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Next slots"}),l.map(e=>(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{size:14,children:e.label}),(0,V.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:I.colours.border,borderRadius:4},children:(0,V.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?I.colours.red:I.colours.gold,borderRadius:4}})}),(0,V.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,V.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,V.jsxs)(v.Muted,{children:[e.slotTime?(0,O.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,B.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:r,r:n}=(0,A.useCtx)(6e4),a=n.settings,l=(0,S.useOwner)(e=>e.reminders),i=e=>_().updateSettings(r,e),o=e=>S.useOwner.getState().setOwner({reminders:{...l,...e}});return(0,V.jsxs)(w.default,{style:{gap:10},children:[s.IS_GREENSIDE?(0,V.jsx)(t.GreensideCashOnly,{}):(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,V.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(a);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,V.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,V.jsx)(v.Toggle,{label:"24h reminder",value:l.h24,onChange:e=>o({h24:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,V.jsx)(v.Toggle,{label:"2h reminder",value:l.h2,onChange:e=>o({h2:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,V.jsx)(v.Toggle,{label:"confirm",value:l.confirmText,onChange:e=>o({confirmText:e})})]}),(0,V.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,V.jsx)(v.Stepper,{value:a.bookingCoversPerSlot,min:2,max:60,onChange:e=>i({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Typical table turn (min)"}),(0,V.jsx)(v.Stepper,{value:a.turnMins,min:30,max:180,onChange:e=>i({turnMins:e}),label:"turn minutes"})]}),(0,V.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,V.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:s,today:t,role:r,me:n}=(0,A.useCtx)(1e4),[a,l]=(0,x.useState)(null),i=(0,T.useOrders)(s),o=(0,T.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===s&&e.date===t))),d=(0,T.useAudit)(s).filter(e=>'allergy'===e.kind),c=(0,z.useUnsignedDishes)(s),h=(0,T.useStore)(e=>e.bookings),u=i.filter(e=>(0,B.LIVE)(e)&&(0,D.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i.filter(B.LIVE))).length,g=(0,A.useSignedIn)(),p=(0,F.cardActorFor)(n,'owner'===r?'owner':'manager'===r?'manager':'staff',g);if('unsigned'===a)return(0,V.jsx)(z.UnsignedDishList,{rid:s,actor:p,onClose:()=>l(null),onOpenCards:()=>e('more','recipecards')});if('pending'===a)return(0,V.jsx)(K,{go:e,onClose:()=>l(null)});const b={flex:1,minHeight:48};return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>l('pending'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?I.colours.red:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,V.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>l('unsigned'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?I.colours.amber:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,V.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,V.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,V.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,V.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,V.jsxs)(v.Muted,{children:[(0,O.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,V.jsx)(v.Muted,{children:"No allergy events yet."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,V.jsx)(w.default,{style:{gap:10},children:(0,V.jsxs)(v.Card,{highlight:I.colours.gold,style:{alignItems:'center'},children:[(0,V.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:I.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,V.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,V.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,V.jsx)(v.T,{size:20,weight:"bold",colour:I.colours.gold,children:"CoverCharge for Display"}),(0,V.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:s,r:t}=(0,A.useCtx)(6e4),r=(0,d.useLiveVenue)(),n=s=>s.startsWith('tab:')?e(s.slice(4)):e('more',s),a=e=>e.startsWith('tab:')?'tab:forecast'!==e||S.CAN.forecasts(s):(()=>{const t=L.PAGES.find(s=>s.id===e);return!!t&&(!t.can||t.can(s))})();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:I.colours.gold,children:[(0,V.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(t)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,s,t])=>(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"medium",children:e}),(0,V.jsx)(v.Muted,{children:s})]}),(0,V.jsx)(v.Badge,{kind:'This app'===t?'ok':'gold',label:t})]},e)),'owner'===s?(0,V.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{S.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,V.jsx)(v.Muted,{children:r?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,V.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...Y].filter(e=>4!==e.n||(0,M.orderAtTableOn)(t)).sort((e,s)=>e.n-s.n).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(v.T,{weight:"bold",colour:I.colours.gold,style:{width:26},children:[e.n,"."]}),(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"semibold",children:e.title}),(0,V.jsx)(v.Muted,{children:e.note})]})]}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>a(e)).map(([e,s])=>(0,V.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>n(s)},s))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"card"}):(0,V.jsx)(G,{})},_e.Referrals=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"referrals"}):(0,V.jsx)(H,{})};var s=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),I=_r(_d[30]),B=_r(_d[31]),A=_r(_d[32]),N=_r(_d[33]),$=_r(_d[34]),L=_r(_d[35]),D=_r(_d[36]),E=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),V=_r(_d[41]);const _=()=>T.useStore.getState();function G(){const{rid:e,r:t,me:n}=(0,A.useCtx)(3e4),a=t.settings,l=(0,T.useStore)((0,k.useShallow)(s=>s.stampCards.filter(s=>s.restaurantId===e))),i=(0,T.useStore)(e=>e.customer.name),o=(0,T.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,x.useMemo)(()=>(0,N.crmCustomers)(),[]),[c,h]=(0,x.useState)(a.stampReward),[u,g]=(0,x.useState)('');(0,x.useEffect)(()=>{(0,$.examplesAllowed)()&&e===s.VENUE_RID&&!l.some(e=>e.customerId.startsWith('cr-'))&&T.useStore.setState(s=>({stampCards:[...s.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((s,t)=>({restaurantId:e,customerId:s.id,stamps:s.stamps%a.stampTarget,rewardsAvailable:t%5==0?1:0,history:[{at:'2026-10-20',source:t%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(s=>s.id===e)?.name??(e===T.useStore.getState().customer.id?i||'Guest':e),b=l.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,s)=>s.stamps-e.stamps),m=(0,$.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(m?31:0);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Active cards"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.length})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Rewards ready"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.reduce((e,s)=>e+s.rewardsAvailable,0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Redeemed"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,V.jsx)(v.Muted,{children:m?'all time (example)':'all time'})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Stamps for a reward"}),(0,V.jsx)(v.Stepper,{value:a.stampTarget,min:3,max:15,onChange:s=>_().updateSettings(e,{stampTarget:s}),label:"stamps"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Min spend \xa3"}),(0,V.jsx)(v.Stepper,{value:a.stampMinSpend/100,min:0,max:50,onChange:s=>_().updateSettings(e,{stampMinSpend:100*s}),label:"minimum spend"})]}),(0,V.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,V.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>_().updateSettings(e,{stampReward:c.trim()||a.stampReward})}),(0,V.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,V.jsx)(B.SectionHead,{title:"Members"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),b.map(s=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(s.customerId)}),s.rewardsAvailable?(0,V.jsx)(v.Badge,{kind:"ok",label:`${s.rewardsAvailable} reward ready`}):null]}),(0,V.jsx)(v.Row,{gap:4,children:Array.from({length:a.stampTarget},(e,t)=>(0,V.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:te.source))).join(', ')||'\u2013']}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>_().addStamp(e,s.customerId,`Manual (${n})`)}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!s.rewardsAvailable,onPress:()=>_().redeemReward(e,s.customerId)})]})]},s.customerId))]})}function H(){const e=(0,S.useOwner)(e=>e.referral),s=(0,S.useOwner)(e=>e.referrals),[t,r]=(0,x.useState)(e.giverReward),[n,a]=(0,x.useState)(e.friendReward),l=e=>s.filter(s=>s.status===e).length,i=(0,$.examplesAllowed)();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[i?(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Invites sent"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,V.jsx)(v.Muted,{children:"example"})]}):null,(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sign-ups"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:s.length+(i?23:0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Ordered"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l('first order')+l('rewarded')+(i?9:0)})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,V.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:s=>S.useOwner.getState().setOwner({referral:{...e,active:s}})})]}),(0,V.jsx)(v.Field,{label:"Reward for the customer who invites",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Reward for the friend (first order)",value:n,onChangeText:a}),(0,V.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>S.useOwner.getState().setOwner({referral:{...e,giverReward:t.trim(),friendReward:n.trim()}})}),(0,V.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,V.jsx)(B.SectionHead,{title:"Referrals"}),s.map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,V.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,V.jsx)(v.Muted,{children:e.at})]},e.id))]})}function Q(){const{me:e}=(0,A.useCtx)(6e4),s=(0,A.useSignedIn)();return(0,V.jsx)(p.GiftCardsPage,{me:(s?.name??e).replace(' (example)','')})}function W(){const{rid:e,me:s}=(0,A.useCtx)(6e4),t=(0,T.useStore)((0,k.useShallow)(s=>s.giftCards.filter(s=>s.restaurantId===e))),[n,a]=(0,x.useState)(25),[l,i]=(0,x.useState)(''),[o,d]=(0,x.useState)(''),[c,h]=(0,x.useState)(''),[u,g]=(0,x.useState)(''),[p,b]=(0,x.useState)(''),[m,f]=(0,x.useState)(null),j=t.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=t.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sold"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.initial,0))})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Outstanding"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.balance,0))})]})]}),m?(0,V.jsx)(v.Banner,{kind:"success",title:m}):null,(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,V.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"No card with that code."}):null,(0,V.jsx)(v.Field,{label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{_().redeemGiftCard(o,Math.round(100*Number(c)),s)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,V.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,V.jsx)(v.Field,{label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const t=_().honourLegacyCard(e,u,Math.round(100*Number(p)),s);f(`Website bookings card ${t.code} honoured`),d(t.code),g(''),b('')}})]}):null]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,V.jsx)(v.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>a(e)},e))}),(0,V.jsx)(v.Field,{label:"Recipient",value:l,onChangeText:i}),(0,V.jsx)(v.Button,{label:`Record a \xa3${n} card paid at the till`,disabled:l.trim().length<2,onPress:()=>{const s=_().buyGiftCard(e,100*n,l.trim(),'Sold at the till');f(`Created ${s.code}`),i('')}}),(0,V.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,V.jsx)(B.SectionHead,{title:"All cards"}),t.map(e=>(0,V.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,V.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,V.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function q({rid:e,now:s,me:t}){const r=(0,T.useOrders)(e).filter(e=>'table'===e.type),[n,l]=(0,x.useState)(null),i=(0,m.useTableUse)(e,s),o=(0,m.useTableNames)(e);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,V.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const s=r.filter(s=>s.tableNo===e&&(0,B.LIVE)(s)),t=s.reduce((e,s)=>e+s.total-s.paid,0);return(0,V.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,a.tableNumbers)(e)}`,onPress:()=>l(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:s.length?I.colours.gold:I.colours.border,backgroundColor:I.colours.surface,gap:2},children:[(0,V.jsx)(v.T,{weight:"bold",children:(0,a.tableNumbers)(e)}),(0,V.jsx)(v.T,{size:12,colour:i[e]?.busy?'#FFD9D4':'#E2C489',children:i[e]?.busy?i[e].label:'Free'}),(0,V.jsx)(v.Muted,{children:s.length?`${s.length} order${s.length>1?'s':''}`:'No orders'}),t?(0,V.jsxs)(v.T,{size:12,colour:I.colours.amber,children:[(0,R.gbp)(t)," to pay"]}):(0,V.jsx)(v.T,{size:12,colour:I.colours.muted,children:"View QR"})]},e)})}),(0,V.jsx)(B.SectionHead,{title:"Live table orders"}),r.filter(B.LIVE).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:[(0,a.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,V.jsx)(v.Badge,{kind:(0,B.statusKind)(e.status),label:(0,B.statusLabel)(e)})]}),(0,V.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,O.minsBetween)(new Date(e.createdAt),s)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),r.filter(B.LIVE).length?null:(0,V.jsx)(v.Muted,{children:"No live table orders."}),n?(0,V.jsxs)(v.Sheet,{visible:!0,onClose:()=>l(null),title:`${(0,a.tableNumbers)(n)} QR code`,children:[(0,V.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,V.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${n}`,size:200})}),(0,V.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",n]}),(0,V.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,V.jsx)(v.Button,{label:`Preview customer table ordering (${(0,a.tableNumbers)(n)})`,onPress:()=>{const e=n;l(null),j.router.push(`/table/${e}`)}}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>l(n)})]}):null]})}function K({go:e,onClose:s}){const{rid:t,today:r,role:n}=(0,A.useCtx)(1e4),a=(0,T.useOrders)(t),l=(0,T.useStore)(e=>e.bookings);(0,E.useBackLayer)(!0,s);const i=a.filter(B.LIVE),o=[...i.filter(e=>(0,D.chainNeedsAction)(e,l)).map(e=>{const s=(0,D.nextStep)(e,(0,D.linkedBooking)(e,l)),t=D.CHAIN_STEPS.find(e=>e.id===s);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,O.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:t?`Next: ${t.n}. ${t.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...l.filter(e=>e.restaurantId===t&&e.date===r&&'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,s)=>e.at.localeCompare(s.at));return(0,V.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,V.jsx)(E.BackButton,{onPress:s,testID:"pending-back"}),(0,V.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:I.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,V.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(s=>(0,V.jsxs)(v.Card,{highlight:I.colours.red,style:{alignItems:'center',gap:8},children:[(0,V.jsxs)(w.default,{testID:`pending-row-${s.id}`,accessible:!0,accessibilityLabel:`${s.title}, ${s.when}, allergies: ${s.allergies}. ${s.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,V.jsx)(v.T,{center:!0,weight:"bold",size:18,children:s.title}),(0,V.jsx)(v.T,{center:!0,children:s.when}),(0,V.jsxs)(v.Muted,{center:!0,children:["Allergies: ",s.allergies]}),(0,V.jsx)(v.T,{center:!0,colour:I.colours.gold,children:s.next})]}),(0,V.jsx)(v.Button,{small:!0,label:s.open,onPress:()=>e(s.tab),style:{alignSelf:'stretch'}})]},s.id)),'owner'===n||'manager'===n?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function X(){const e=(0,S.useOwner)(e=>e.merch),s=(0,S.useOwner)(e=>e.merchOrders),[t,r]=(0,x.useState)(''),[n,a]=(0,x.useState)(''),l=(s,t)=>S.useOwner.getState().setOwner({merch:e.map(e=>e.id===s?{...e,...t}:e)});return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,V.jsx)(B.SectionHead,{title:"Products & stock"}),e.map(e=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,V.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,V.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:s=>l(e.id,{live:s})})}),(0,V.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:s=>l(e.id,{stock:s}),label:`${e.name} stock`})]}),0===e.stock?(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"Out of stock"}):e.stock<8?(0,V.jsx)(v.T,{size:13,colour:I.colours.amber,children:"Low stock"}):null]},e.id)),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,V.jsx)(v.Field,{label:"Name",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Price \xa3",value:n,onChangeText:a,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Add product",disabled:t.trim().length<2||!(Number(n)>0),onPress:()=>{S.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:t.trim(),price:Math.round(100*Number(n)),stock:10,live:!0}]}),r(''),a('')}})]}),(0,V.jsx)(B.SectionHead,{title:"Shop orders"}),s.map(t=>{const r=e.find(e=>e.id===t.productId);return(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[t.qty,"\xd7 ",r?.name," \xb7 ",t.customer]}),(0,V.jsx)(v.Badge,{kind:'new'===t.status?'amber':'ready'===t.status?'blue':'ok',label:t.status})]}),(0,V.jsxs)(v.Muted,{children:[t.at," \xb7 ",(0,R.gbp)((r?.price??0)*t.qty)]}),'collected'!==t.status?(0,V.jsx)(v.Button,{small:!0,label:'new'===t.status?'Mark ready':'Mark collected',onPress:()=>S.useOwner.getState().setOwner({merchOrders:s.map(e=>e.id===t.id?{...e,status:'new'===t.status?'ready':'collected'}:e)})}):null]},t.id)})]})}const Y=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const J=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},Z=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function ee({kind:e}){const{r:s}=(0,A.useCtx)(6e4),t=(0,S.useOwner)(e=>e.offers);(0,x.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:t},J,Z).catch(()=>{})},[]);const r=(0,u.can)('venue.settings');return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(b.LoyaltySummaryCard,{kind:e}),(0,V.jsx)(g.StaffLoyalty,{venue:s.name,canRemove:r,onOpenSettings:r?()=>{i.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),r?(0,V.jsx)(v.Card,{children:(0,V.jsxs)(w.default,{style:{gap:8},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,V.jsx)(b.LoyaltySettingsPanel,{})]})}):null]})}},1426,[5,1341,796,806,829,1427,1362,1400,1172,14,1205,985,1428,1430,1363,34,1096,1406,30,402,102,853,1225,794,848,865,836,855,1104,827,840,1147,1100,1119,858,1378,838,1041,1132,832,830,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1427,[829,34,102,794,830,836,1131,848,838,840,25]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1428,[985,34,281,236,102,1225,794,1202,1205,840,1429,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1429,[34,236,102,794,1202,25]); -__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1430,[5,1341,34,102,794,836,1202,1203,1204,985,1205,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SafetyPages",{enumerable:!0,get:function(){return l}}),r(d[0]);var n=r(d[1]),t=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]);const l={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s,initial:"items"})},Haccp:()=>{const{me:n,meId:t,now:o}=(0,c.useCtx)(3e4);return(0,u.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:l}=(0,c.useCtx)(3e4);return(0,u.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===l||'manager'===l})}}},1431,[34,1161,1133,1162,1169,1100,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CAR_LINK",{enumerable:!0,get:function(){return h}}),_e.CarScreen=function(){const e=(0,o.useSync)(e=>'staff'===e.kind&&!!e.venueId),[n,c]=(0,t.useState)(''),[b,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[f,w]=(0,t.useState)(null),[v,k]=(0,t.useState)(null),S=async()=>{try{w(await(0,o.carList)())}catch{w([])}};(0,t.useEffect)(()=>{e&&S()},[e]);const C=n.replace(/\D/g,''),D=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(C);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is signed in as you. It opens the owner screen in a few seconds.'}),S()):y({ok:!1,text:e.message})};return(0,u.jsxs)(s.default,{testID:"car-screen-page",style:{gap:12},children:[(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Sign the car in"}),(0,u.jsx)(r.T,{center:!0,children:`In the car, while parked, open the browser and type ${h}`}),(0,u.jsx)(r.T,{center:!0,children:"The car shows 6 numbers on its screen."}),(0,u.jsx)(r.Field,{testID:"car-code-field",label:"Code shown on the car (6 numbers)",accessibilityLabel:"Code shown on the car, 6 numbers",value:n,onChangeText:e=>c(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,u.jsx)(r.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Signs the car in as you",disabled:!e||x||6!==C.length,onPress:()=>{D()},style:{minHeight:56}}),e?null:(0,u.jsx)(r.Muted,{center:!0,children:"Your phone needs to be connected to approve a car."}),(0,u.jsx)(s.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,u.jsx)(r.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,u.jsx)(r.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars signed in"}),null===f?(0,u.jsx)(r.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):f.length?f.map(e=>(0,u.jsxs)(s.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 signed in as ${e.staffName}`}),(0,u.jsx)(r.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,u.jsx)(r.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Sign this car out",accessibilityLabel:`Sign ${e.label} out`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,u.jsx)(r.Muted,{center:!0,children:"No cars are signed in."})]}),v?(0,u.jsxs)(r.Sheet,{visible:!0,onClose:()=>k(null),title:"Sign this car out?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,u.jsx)(r.T,{center:!0,children:`${v.label} stops working straight away. To use it again, make a new code in the car and approve it here.`}),(0,u.jsx)(r.Button,{testID:"car-revoke-yes",label:"Yes, sign it out",onPress:async()=>{const e=v;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is signed out.`}:{ok:!1,text:t.message}),S()},style:{minHeight:56}}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),u=_r(d[6]);const h='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1432,[34,102,794,985,827,840,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=k,_e.SmsBubble=v,_e.AlertSettings=function({go:e}){const{rid:s}=(0,w.useCtx)(6e4),t=(0,b.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,b.systemSupport)()),[r,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=!0;return'undefined'!=typeof navigator&&/Android/i.test(navigator.userAgent)?p('unsupported'):(0,f.pushState)().then(s=>{e&&p(s)}).catch(()=>{e&&m('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const y='granted'===l?'Allowed on this device':'denied'===l?'Blocked. Turn it back on in your browser or phone settings for this site.':'default'===l?'Not asked yet':'This browser can\u2019t show notifications. On iPhone, add the Managers app to your Home Screen first.';return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Alert sound"}),(0,T.jsx)(u.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,T.jsx)(u.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>b.useAlerts.getState().setPrefs({muted:!e})}),(0,T.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,j.chime)('bright')}),(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,j.lowChime)(.6)})]}),(0,T.jsx)(u.Muted,{children:"The Display is silent and shows alerts on screen. The Head Chef app flashes and plays a soft chime until a takeaway is confirmed and its allergies are ticked."})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Which alerts to show"}),(0,T.jsx)(u.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),b.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindChip,{kind:e,size:30}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(u.Toggle,{label:b.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>b.useAlerts.getState().setType(e,s)})})]},e))]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Send a test alert"}),(0,T.jsx)(u.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,T.jsx)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,T.jsx)(u.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${b.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,b.sendTestAlert)(s,e)},e))})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,T.jsx)(u.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,T.jsx)(u.Muted,{children:y}),(0,T.jsx)(u.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>b.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,T.jsx)(u.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,b.requestSystemPermission)()),b.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,b.showSystemNotification)({id:`test-sys:${Date.now()}`,kind:'test',rid:s,at:Date.now(),name:'Test guest',when:'Today 19:30',covers:4,source:'Phone',test:!0},!0)}):null,(0,T.jsx)(u.Muted,{children:(0,b.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,T.jsxs)(u.Banner,{kind:"info",title:"What works today",children:["Alerts show while the app is open. ",'unsupported'===x?'Locked-phone alerts for this phone are coming soon.':'on'===x?'Locked-phone alerts are on for this phone.':'To get alerts when your phone is locked, tap Turn on alerts.']}),'unsupported'!==x?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:'on'===x?'Check alerts':'Turn on alerts',onPress:async()=>{try{if('on'===x){const e=await(0,f.pushState)();p(e),m('on'===e?'Locked-phone alerts are on for this phone.':'Tap Turn on alerts to connect this phone.')}else{const e=await(0,f.turnOnPush)();m(e.message),e.ok&&(p('on'),o((0,b.systemSupport)()))}}catch{m('Could not turn on alerts. Please try again.')}}}):null,r?(0,T.jsx)(u.Muted,{children:r}):null]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindIcon,{kind:"email"}),(0,T.jsx)(u.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,T.jsx)(u.Badge,{kind:"neutral",label:b.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,T.jsx)(u.Muted,{children:b.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${b.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,T.jsx)(u.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,w.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),h=(0,n.useMemo)(()=>(0,p.templatesFor)(r),[r]),b=(0,x.useAssistant)(e=>e.enabled),[j,f]=(0,n.useState)('booking'),[P,M]=(0,n.useState)('sms'),A=h[j],B=s=>m.useStore.getState().setTemplate(e,j,s),L=Object.fromEntries(p.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),R=l.LIVE_VENUE_BUILD?{sms:L,email:L}:'order'===j?(0,p.orderVars)({...S,slotTime:`${o}T18:45:00`},s):(0,p.bookingVars)({...C,date:o},s),I=(0,p.toGsm)((0,p.fill)(A.sms,R.sms)),N=(0,p.fill)(A.subject,R.email),_=(0,p.emailHtml)((0,p.fillEmailText)(A.body,R.email),{venue:s.name,preheader:N}),O=!!r?.[j],D=s.settings;return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsx)(u.Banner,{kind:"demo",title:"Preview mode",children:p.PREVIEW_BANNER}),(0,T.jsxs)(u.Muted,{children:["Every booking and takeaway order gets a text (a phone number is needed to book) and an email if they gave one. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest."]}),(0,T.jsx)(u.Row,{wrap:!0,gap:6,children:Object.keys(p.DEFAULT_TEMPLATES).map(e=>(0,T.jsx)(u.Chip,{label:p.TEMPLATE_LABEL[e].title,selected:j===e,onPress:()=>f(e)},e))}),(0,T.jsx)(u.Muted,{children:p.TEMPLATE_LABEL[j].when}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Text message"}),(0,T.jsxs)(u.Muted,{children:[(0,p.smsParts)(I).chars," characters"]})]}),(0,T.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:A.sms,onChangeText:e=>B({sms:e}),style:[u.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,p.smsParts)(I).chars>300?(0,T.jsx)(u.T,{size:13,colour:y.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,T.jsx)(u.T,{weight:"semibold",children:"Email subject"}),(0,T.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:A.subject,onChangeText:e=>B({subject:e}),style:u.styles.input}),(0,T.jsx)(u.T,{weight:"semibold",children:"Email message"}),(0,T.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:A.body,onChangeText:e=>B({body:e}),style:[u.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,T.jsxs)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:[b?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>B(E(A))}):null,O?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,j,null)}):null]}),b?(0,T.jsx)(u.Muted,{children:"\u201cMake it warmer\u201d is an on-device wording tool: it rewrites on this device and keeps every detail. Check it reads right before you leave it."}):null,(0,T.jsxs)(u.Muted,{children:["Placeholders: ",p.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Live preview"}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:"Text",selected:'sms'===P,onPress:()=>M('sms')}),(0,T.jsx)(u.Chip,{label:"Email",selected:'email'===P,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,T.jsx)(u.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,T.jsxs)(u.Muted,{children:["Sample guest: Alex, ",'order'===j?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===P?(0,T.jsx)(v,{text:I,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),N]}),(0,T.jsx)(k,{html:_})]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,T.jsx)(u.Muted,{children:"Online bookings above this size wait for you to confirm. The guest gets a \u201cwe\u2019ve got your request\u201d message first, then the confirmation once you accept."}),(0,T.jsx)(u.Stepper,{label:"Auto-accept online bookings up to",value:D.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,T.jsx)(u.Toggle,{label:"Also check online bookings with a special request",value:!!D.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Going live"}),(0,T.jsxs)(u.Muted,{children:["Nothing is sent yet. To send real texts and emails: a text service account (for example Twilio) and an email service (for example Postmark), a small CoverCharge server to keep the keys safe, and your sender name (",s.name,") registered. Your venue name, address and phone come from Info & hours."]})]})]})},_e.Outbox=function(){const{rid:e}=(0,w.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[h,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:y.colours.gold,borderRadius:12,padding:12},children:[(0,T.jsx)(u.T,{weight:"semibold",colour:y.colours.gold,children:(0,p.isLive)()?'Live: messages are sent through your text and email service.':p.PREVIEW_BANNER}),(0,p.isLive)()?null:(0,T.jsx)(u.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,T.jsx)(u.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,T.jsx)(u.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,T.jsx)(u.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(h===e.id?null:e.id),style:{gap:4},children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,T.jsxs)(u.T,{weight:"semibold",children:[P[e.kind]," \xb7 ",e.ref]})]}),(0,T.jsx)(u.Muted,{children:e.at.slice(11,16)})]}),(0,T.jsxs)(u.Muted,{children:["To ",e.toName,", ",e.to]}),(0,T.jsx)(u.T,{size:13,colour:'sent'===e.status?y.colours.ok:'failed'===e.status?y.colours.red:y.colours.amber,children:(0,p.statusLabel)(e)})]}),'sms'===e.channel?(0,T.jsx)(v,{text:e.body}):h===e.id?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),e.subject]}),(0,T.jsx)(k,{html:e.html??'',height:560})]}):(0,T.jsxs)(u.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Clear the Outbox",onPress:()=>m.useStore.getState().clearOutbox(e)}):null]})};var s=_r(d[0]),t=_r(d[1]),l=_r(d[2]),n=_r(d[3]),o=e(n);_r(d[4]);var r=e(_r(d[5])),c=e(_r(d[6])),u=_r(d[7]),h=_r(d[8]),m=_r(d[9]),x=_r(d[10]),p=_r(d[11]),b=_r(d[12]),j=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]);function k({html:e,height:s=520}){return o.default.createElement('iframe',{srcDoc:e,title:'Email preview',sandbox:'',style:{width:'100%',height:s,border:'1px solid #2a2a2a',borderRadius:12,background:'#f4efe6'}})}function v({text:e,to:t}){const l=(0,p.smsParts)(e);return(0,T.jsxs)(c.default,{style:{gap:4},children:[t?(0,T.jsxs)(u.Muted,{children:["To ",t]}):null,(0,T.jsx)(c.default,{style:{alignSelf:'flex-start',maxWidth:420,backgroundColor:(0,s.soutersSurface)('#1f1f22'),borderRadius:18,borderBottomLeftRadius:4,padding:12,borderWidth:1,borderColor:'#2c2c30'},children:(0,T.jsx)(u.T,{size:15,children:e})}),(0,T.jsxs)(u.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const C={name:'Alex Morgan',partySize:4,date:'',time:'19:30',ref:'B-1042',allergies:[{allergen:'peanuts',severity:'allergy'}],notes:'It\u2019s my mum\u2019s birthday',table:void 0},S={customerName:'Alex Morgan',ref:'T-2093',total:3150,slotTime:void 0,readyBy:void 0,allergies:[{allergen:'milk',severity:'intolerance'}],lines:[{qty:2,name:'Fish and chips',choices:[]},{qty:1,name:'Sticky toffee pudding',choices:[]}]};function E(e){const s=e.sms.replace(/^Hi \{first\},/,'Hi {first}, lovely news!').replace(/See you soon,/,'We can\u2019t wait to see you,');let t=e.body;return/can\u2019t wait/.test(t)||(t=t.replace(/(Hi \{first\},\n\n)/,'$1We\u2019re so glad you chose us. ')),t=t.replace(/Warm wishes,/,'With very warm wishes from all of us,'),{sms:s,subject:e.subject,body:t}}const P={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1433,[798,796,806,34,236,402,102,794,1174,848,1415,833,1176,1033,840,1045,1100,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,i.useOwner)(e=>e.site),u=(0,o.useSheets)(e),[c,m]=(0,l.useState)(null);return c?(0,p.jsxs)(s.Card,{children:[(0,p.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===c.id)?`Edit ${c.name}`:'New supplier'}),(0,p.jsx)(x,{rid:e,s:c,onDone:()=>m(null)})]}):(0,p.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,p.jsx)(s.Banner,{kind:"info",title:"Used by the Head Chef app",children:"Each supplier gets an order sheet in Head Chef \u203a Ordering. Text, WhatsApp and phone orders open the phone\u2019s own app with the order written out, and the chef presses Send. Nothing is sent automatically."}),u.map(e=>(0,p.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,p.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,p.jsx)(s.Muted,{children:[e.goods,e.deliveryDays.length?`delivers ${(0,h.dayRange)(e.deliveryDays)}`:'',e.orderDays.length?`order ${(0,h.dayRange)(e.orderDays)}`:'',e.frequency,e.priceCapPerKg?`cap ${(0,d.gbp)(e.priceCapPerKg)}/kg`:''].filter(Boolean).join(' \xb7 ')}),'text'!==e.method&&'whatsapp'!==e.method&&'phone'!==e.method||e.number?null:(0,p.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,p.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,p.jsx)(s.Row,{wrap:!0,gap:8,children:(0,p.jsx)(s.Button,{label:"Add supplier",testID:"sheet-add",onPress:()=>m({id:(0,h.sid)(),name:'',goods:'',method:'text',number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:''})})})]})};var l=r(_d[0]),t=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),i=r(_d[4]),o=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]);const c=['online','phone','text','whatsapp','tbc'];function m({label:e,value:l,onChange:t}){return(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,p.jsx)(s.Chip,{label:e,selected:l.includes(n),onPress:()=>t(l.includes(n)?l.filter(e=>e!==n):[...l,n].sort())},e))})]})}function x({rid:e,s:t,onDone:i}){const d=(0,o.useOrderSheets)(e=>e.upsert),x=(0,o.useOrderSheets)(e=>e.remove),[b,f]=(0,l.useState)(t),[j,y]=(0,l.useState)(t.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[C,v]=(0,l.useState)(t.priceCapPerKg?(t.priceCapPerKg/100).toFixed(2):''),[w,T]=(0,l.useState)(!1),D=e=>f(l=>({...l,...e}));return(0,p.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,p.jsx)(s.Field,{label:"Supplier name",value:b.name,onChangeText:e=>D({name:e})}),(0,p.jsx)(s.Field,{label:"What they supply",value:b.goods,onChangeText:e=>D({goods:e})}),(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:c.map(e=>(0,p.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:b.method===e,onPress:()=>D({method:e})},e))})]}),'text'===b.method||'whatsapp'===b.method||'phone'===b.method?(0,p.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:b.number,keyboardType:"phone-pad",onChangeText:e=>D({number:e})}):null,'online'===b.method?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:b.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>D({url:e.trim()})}),(0,p.jsx)(s.Field,{label:"Button label",value:b.urlLabel??'',placeholder:"Open website",onChangeText:e=>D({urlLabel:e})})]}):null,(0,p.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:b.contact??'',onChangeText:e=>D({contact:e})}),(0,p.jsx)(m,{label:"Delivery days",value:b.deliveryDays,onChange:e=>D({deliveryDays:e})}),(0,p.jsx)(m,{label:"Order days (a reminder shows in the Head Chef app)",value:b.orderDays,onChange:e=>D({orderDays:e})}),(0,p.jsxs)(s.Row,{gap:10,children:[(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:b.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>D({cutoff:e})})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Price cap \xa3/kg (optional)",value:C,keyboardType:"decimal-pad",onChangeText:v})})]}),(0,p.jsx)(s.Field,{label:"Reminder text (optional)",value:b.reminder,onChangeText:e=>D({reminder:e})}),(0,p.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:b.frequency,onChangeText:e=>D({frequency:e})}),b.priceCapPerKg||C?(0,p.jsx)(s.Field,{label:"Seller",value:b.seller,onChangeText:e=>D({seller:e})}):null,(0,p.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:y}),(0,p.jsx)(s.Field,{label:"Notes for the chef",value:b.notes,multiline:!0,onChangeText:e=>D({notes:e})}),(0,p.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,p.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const l=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,l)=>{const[n,s]=e.split('|').map(e=>e.trim()),i=t.items.find(e=>e.name===n);return{id:i?.id??`${b.id}-i${l}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*parseFloat(C.replace(/[\xa3,]/g,'')));d(e,{...b,items:l,priceCapPerKg:n>0?n:0,placeholder:b.placeholder&&'tbc'===b.method}),i()},disabled:!b.name.trim()}),(0,p.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:i}),w?(0,p.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{x(e,t.id),i()}}):(0,p.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>T(!0)})]})]})}},1434,[34,402,102,794,865,1016,836,1017,840,25]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaySaverSettings=function(){const{rid:e,me:s}=(0,v.useCtx)(6e4),u=s.replace(' (example)','');(0,f.useSync)(e=>e.venueId);const x=(0,b.saverConnected)(),R=!x||(0,f.can)('venue.settings'),D=(0,b.useSaverSync)(),[k,M]=(0,t.useState)(D??p.SAVER_DEFAULT),[C,T]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[L,E]=(0,t.useState)(null);(0,t.useEffect)(()=>{C||M(D??p.SAVER_DEFAULT)},[D]);const O=e=>{R&&(M(t=>({...t,...e})),T(!0),E(null))},_=async()=>{P(!0);try{await(0,b.saveSaver)(k,u),T(!1),E({kind:'success',t:x?'Saved. The Display changes within a few seconds; no need to pair it again.':'Saved on this device (demo).'})}catch(e){E({kind:'danger',t:`Couldn't save: ${e.message}`})}finally{P(!1)}},{width:$}=(0,l.default)(),U=Math.min($-48,520),A=Math.round(10*U/16);return(0,j.jsxs)(n.default,{style:{gap:14,width:'100%',maxWidth:640,alignSelf:'center'},testID:"saver-settings",children:[(0,j.jsx)(i.T,{center:!0,size:22,weight:"semibold",colour:c.colours.gold,accessibilityRole:"header",children:"Display screensaver"}),(0,j.jsx)(i.Muted,{center:!0,children:"What the Display shows when nobody has touched it for a while. Tap anywhere on the Display to wake it; that tap doesn\u2019t press anything."}),R?null:(0,j.jsx)(i.Banner,{kind:"info",title:"Managers and owners only",children:"You can see the screensaver settings, but only a manager or owner can change them."}),!D&&x?(0,j.jsx)(i.Muted,{center:!0,children:"Not set yet: the Display shows your logo after the idle time set on that Display."}):null,(0,j.jsx)(i.Card,{children:(0,j.jsx)(i.Toggle,{label:"Screensaver on",value:k.on,onChange:e=>O({on:e}),testID:"saver-on",a11y:"Screensaver on or off"})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Start after"}),(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:p.IDLE_OPTIONS.map(e=>(0,j.jsx)(i.Chip,{label:e.label,selected:k.idleMins===e.mins,disabled:!k.on,onPress:()=>O({idleMins:e.mins}),testID:`saver-idle-${e.mins}`,accessibilityLabel:e.mins?`Start after ${e.mins} minutes with no touches`:'Never start the screensaver'},e.mins))}),(0,j.jsx)(i.Muted,{center:!0,children:k.on?k.idleMins?`Starts after ${k.idleMins} minutes with no touches.`:'Never: the Display stays on the board.':'Off: the Display never goes to the screensaver.'})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Style"}),(0,j.jsx)(n.default,{accessibilityRole:"radiogroup",style:{gap:8},children:p.SAVER_STYLES.map(e=>{const t=k.style===e.id;return(0,j.jsxs)(o.default,{testID:`saver-style-${e.id}`,onPress:()=>O({style:e.id}),disabled:!R,accessibilityRole:"radio",accessibilityState:{checked:t,disabled:!R},accessibilityLabel:`${e.label}. ${e.sub}`,style:{minHeight:64,borderRadius:14,borderWidth:2,borderColor:t?c.colours.gold:c.colours.border,backgroundColor:t?'rgba(201,162,74,0.12)':'transparent',paddingVertical:10,paddingHorizontal:14,alignItems:'center',justifyContent:'center'},children:[(0,j.jsxs)(i.T,{center:!0,weight:"semibold",colour:t?c.colours.gold:c.colours.text,children:[t?'\u25cf ':'\u25cb ',e.label]}),(0,j.jsx)(i.Muted,{center:!0,children:e.sub})]},e.id)})})]}),(0,j.jsx)(S,{rid:e,c:k,set:O,editor:R,connected:x,onMsg:E}),'photos'===k.style?(0,j.jsx)(w,{c:k,set:O,editor:R,connected:x,onMsg:E}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.Toggle,{label:"Dim at night",value:k.dimOn,onChange:e=>O({dimOn:e}),testID:"saver-dim",a11y:"Dim the screensaver at night"}),k.dimOn?(0,j.jsxs)(n.default,{style:{gap:8,alignItems:'center'},children:[(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"From"}),(0,j.jsx)(i.Stepper,{label:"Dim from",value:(0,y.toMins)(k.dimFrom),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimFrom:(0,y.fromMins)(e)}),testID:"saver-dim-from"})]}),(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"Until"}),(0,j.jsx)(i.Stepper,{label:"Dim until",value:(0,y.toMins)(k.dimTo),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimTo:(0,y.fromMins)(e)}),testID:"saver-dim-to"})]})]}):null,(0,j.jsxs)(i.Muted,{center:!0,children:[(0,p.dimWords)(k),". The screensaver is shown much darker between these times."]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Preview"}),(0,j.jsx)(n.default,{style:{alignItems:'center'},testID:"saver-preview",accessibilityLabel:"Preview of the screensaver",children:(0,j.jsx)(n.default,{style:{width:U,height:A,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:c.colours.border},children:k.on?(0,j.jsx)(h.Saver,{rid:e,cfg:k,box:{width:U,height:A}},`${k.style}-${k.photos.length}-${k.logo??''}`):(0,j.jsx)(n.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.Muted,{center:!0,children:"Screensaver off"})})})})]}),L?(0,j.jsx)(i.Banner,{kind:L.kind,children:L.t}):null,R?(0,j.jsx)(i.Button,{label:I?'Saving\u2026':C?'Save screensaver':'Saved',disabled:I||!C,onPress:()=>{_()},testID:"saver-save"}):null]})};var t=r(d[0]),s=e(t);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),l=e(r(d[4])),i=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),v=r(d[13]),j=r(d[14]);const x='undefined'!=typeof document;function w({c:e,set:o,editor:l,connected:h,onMsg:u}){const y=(0,t.useRef)(null),[f,v]=(0,t.useState)(!1),[w,S]=(0,t.useState)({});(0,t.useEffect)(()=>{let t=!0;return Promise.all(e.photos.map(async e=>[e,await(0,b.saverPhotoUrl)(e)])).then(e=>{t&&S(Object.fromEntries(e.filter(e=>e[1])))}),()=>{t=!1}},[e.photos.join('|')]);const R=async t=>{if(t?.length){v(!0);try{const s=[];for(const o of Array.from(t).slice(0,p.MAX_SAVER_PHOTOS-e.photos.length))s.push(h?await(0,b.uploadSaverPhoto)(o,e.photos.length+s.length):URL.createObjectURL(o));o({photos:[...e.photos,...s]}),u({kind:'success',t:`${s.length} photo${1===s.length?'':'s'} added. Tap Save screensaver to show ${1===s.length?'it':'them'} on the Display.`})}catch(e){u({kind:'danger',t:e.message})}finally{v(!1),y.current&&(y.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Slideshow photos"}),(0,j.jsxs)(i.Muted,{center:!0,children:["Your own photos of the venue, food and team, one every 8 seconds. Up to ",p.MAX_SAVER_PHOTOS,". With no photos the Display shows your logo."]}),e.photos.length?(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:e.photos.map((t,h)=>(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:4},children:[w[t]&&x?s.default.createElement('img',{src:w[t],alt:`Slideshow photo ${h+1}`,style:{width:96,height:64,objectFit:'cover',borderRadius:8}}):(0,j.jsx)(n.default,{style:{width:96,height:64,borderRadius:8,backgroundColor:c.colours.border}}),l?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove photo ${h+1} from the slideshow`,onPress:()=>o({photos:e.photos.filter(e=>e!==t)})}):null]},t))}):(0,j.jsx)(i.Muted,{center:!0,children:"No photos yet."}),l?(0,j.jsx)(i.Button,{kind:"secondary",label:f?'Uploading\u2026':'Upload photos',disabled:f||e.photos.length>=p.MAX_SAVER_PHOTOS,onPress:()=>{x&&y.current?.click()},testID:"saver-upload",accessibilityLabel:"Upload photos for the slideshow"}):null,x?s.default.createElement('input',{ref:y,type:'file',accept:'image/jpeg,image/png,image/webp',multiple:!0,style:{display:'none'},'aria-hidden':!0,onChange:e=>{R(e.target.files)}}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Removing a photo takes it off the slideshow; the file itself is kept."})]})}function S({rid:e,c:o,set:l,editor:y,connected:f,onMsg:v}){const w=(0,t.useRef)(null),[S,R]=(0,t.useState)(!1),[D,k]=(0,t.useState)(!1),M=(0,u.useBrand)(e).name,C=!!o.logo,T=async e=>{const t=e?.[0];if(t){R(!0);try{let e;if(f)e=await(0,b.uploadSaverLogo)(t);else{const s=(0,p.logoFileProblem)(t.type,t.size);if(s)throw new Error(s);if('image/svg+xml'===t.type&&!(0,p.svgSafe)(await t.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');e=URL.createObjectURL(t)}l({logo:e}),v({kind:'success',t:(C?'New logo ready':'Logo uploaded')+". Tap Save screensaver to show it on the Display."})}catch(e){v({kind:'danger',t:e.message})}finally{R(!1),w.current&&(w.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:10},testID:"saver-logo-card",children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Screensaver logo"}),(0,j.jsx)(i.Muted,{center:!0,children:'logo'===o.style?'Shown drifting slowly round the Display.':'Shown with the Logo style, and small on the clock and covers screens.'}),(0,j.jsx)(n.default,{style:{minWidth:132,maxWidth:240,height:132,paddingHorizontal:12,borderRadius:14,backgroundColor:'#000000',borderWidth:1,borderColor:c.colours.border,alignItems:'center',justifyContent:'center'},accessible:!0,accessibilityLabel:C?'Your uploaded logo':`Your standard logo, ${M}`,children:(0,j.jsx)(h.SaverLogoPreview,{rid:e,path:o.logo,size:108})}),(0,j.jsx)(i.Muted,{center:!0,children:C?'Your uploaded logo':'Your standard logo'}),y?(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:C?'secondary':'primary',label:S?'Uploading\u2026':C?'Replace logo':'Upload logo',disabled:S,onPress:()=>{x&&w.current?.click()},testID:"saver-logo-upload",accessibilityLabel:C?'Replace the screensaver logo':'Upload a logo for the screensaver'}),C?(0,j.jsx)(i.Button,{kind:"ghost",label:"Remove",disabled:S,onPress:()=>k(!0),testID:"saver-logo-remove",accessibilityLabel:"Remove the uploaded logo and go back to the standard one"}):null]}):null,(0,j.jsx)(i.Muted,{center:!0,children:"PNG, JPG or SVG, up to 2 MB (an SVG is saved as a picture). A square logo on a transparent or black background looks best."})]}),x?s.default.createElement('input',{ref:w,type:'file',accept:Object.keys(p.LOGO_TYPES).join(','),style:{display:'none'},'aria-hidden':!0,onChange:e=>{T(e.target.files)}}):null,D?(0,j.jsx)(i.Sheet,{visible:!0,onClose:()=>k(!1),title:"Remove the uploaded logo?",maxWidth:520,testID:"saver-logo-remove-confirm",children:(0,j.jsxs)(n.default,{style:{gap:12,alignItems:'center'},children:[(0,j.jsx)(i.Muted,{center:!0,children:"The screensaver goes back to your standard logo once you save. The uploaded file is kept, and the standard logo isn\u2019t changed."}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep it",onPress:()=>k(!1),testID:"saver-logo-remove-no"}),(0,j.jsx)(i.Button,{kind:"danger",label:"Remove logo",onPress:()=>{l({logo:null}),k(!1),v({kind:'success',t:'Logo removed. Tap Save screensaver to go back to the standard logo on the Display.'})},testID:"saver-logo-remove-yes"})]})]})}):null]})}},1435,[34,236,402,102,426,794,840,1300,847,1302,827,985,1303,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1436,[804,982,1376,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableQrPage=function(){const{rid:e,me:t}=(0,h.useCtx)(6e4),b=t.replace(' (example)','');return(0,u.jsxs)(s.default,{style:{gap:14,width:'100%',maxWidth:760,alignSelf:'center'},testID:"table-qr-page",children:[(0,u.jsx)(l.T,{center:!0,size:22,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Table QR codes"}),(0,u.jsx)(l.Muted,{center:!0,children:"Guests scan the code on their table, see the menu and send their order to the kitchen. They pay at the bar or with their server."}),(0,u.jsx)(c.TableOrderSettings,{rid:e,me:b}),(0,u.jsx)(l.T,{center:!0,size:20,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Orders from the tables"}),(0,u.jsx)(n.StaffTableOrders,{rid:e,me:b})]})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),n=r(d[5]),h=r(d[6]),u=r(d[7])},1437,[34,102,794,840,1358,1427,1100,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=m,_e.HelpPage=function({go:e}){const[i,o]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[m,y]=(0,s.useState)(null),w=(0,s.useMemo)(()=>i.trim()?(0,c.searchHelp)(r.HELP,i,10).map(e=>e.a):r.HELP.filter(e=>!h||e.topic===h),[i,h]);return(0,x.jsxs)(n.default,{style:{gap:10},testID:"help-page",children:[(0,x.jsxs)(n.default,{style:[a.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\ud83d\udd0d"}),(0,x.jsx)(t.TextInput,{testID:"help-search",value:i,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:u.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),i?(0,x.jsx)(l.default,{onPress:()=>o(''),accessibilityLabel:"Clear search",children:(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\u2715"})}):null]}),(0,x.jsx)(j,{go:e}),i?(0,x.jsx)(a.Muted,{children:w.length?`${w.length} result${1===w.length?'':'s'} for \u201c${i.trim()}\u201d`:`Nothing for \u201c${i.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:[null,...r.HELP_TOPICS].map(e=>(0,x.jsx)(a.Chip,{label:e??'All',selected:h===e,onPress:()=>p(e)},e??'all'))}),w.map((t,s)=>(0,x.jsx)(f,{a:t,go:e,open:m===t.id||!!i&&0===s&&null===m,onToggle:()=>y(m===t.id?'':t.id)},t.id)),(0,x.jsxs)(a.Card,{style:{alignItems:'center'},children:[(0,x.jsx)(a.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:"Chat with CoverCharge support"}),(0,x.jsx)(a.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,x.jsx)(a.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=j;var t=_r(d[0]),s=_r(d[1]),l=e(_r(d[2])),n=e(_r(d[3])),a=_r(d[4]),i=_r(d[5]),o=_r(d[6]),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),p=_r(d[11]),x=_r(d[12]);function m(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>o.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function f({a:e,go:t,open:s,onToggle:i}){return(0,x.jsx)(n.default,{testID:`help-${e.id}`,children:(0,x.jsxs)(a.Card,{children:[(0,x.jsx)(l.default,{accessibilityRole:"button",onPress:i,children:(0,x.jsxs)(a.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,x.jsxs)(n.default,{style:{flex:1},children:[(0,x.jsx)(a.T,{weight:"semibold",children:e.title}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,x.jsx)(a.Muted,{size:12,children:e.topic})]})]}),(0,x.jsx)(a.T,{colour:u.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,x.jsxs)(a.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,x.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,x.jsx)(a.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>m(e,t)})}):null]})})}function j({go:e}){const{rid:t,today:l}=(0,p.useCtx)(6e4),i={rid:t,today:l,go:(t,s)=>e(t,s??null)},[o,c]=(0,s.useState)(''),[f,j]=(0,s.useState)(null),[b,C]=(0,s.useState)(null),k=async()=>{const e=o.trim();if(!e)return;C(null),j(null);const t=(0,h.matchIntent)(e,l);if('action'!==t.kind)'help'!==t.kind?C({text:'Sorry, I didn\u2019t follow that. Try \u201cadd a walk-in for 4 at table 7\u201d, \u201cput Ellie on Friday 5 till 11\u201d, or ask \u201chow do I export hours?\u201d.',kind:'note'}):C({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,h.needsConfirm)(t.action.risk)){const e=await(0,h.runAction)(t.action.id,t.params,i);return void C({text:'done'===e.status?e.message:e.message??'',kind:'done'})}j({action:t.action,params:{...y(t.action,l),...t.params},asked:e})}};return(0,x.jsx)(n.default,{testID:"ask-assistant",children:(0,x.jsxs)(a.Card,{highlight:u.colours.gold,children:[(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(n.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,x.jsxs)(n.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,x.jsx)(a.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:c,placeholder:"Ask in plain words",onSubmitEditing:k,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,x.jsx)(a.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:k,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:['Add a walk-in for 4 at table 7','Put a shift on Friday 5 till 11','How do I export hours for payroll?','Pay out the tips'].map(e=>(0,x.jsx)(a.Chip,{label:e,onPress:()=>c(e)},e))}),f?(0,x.jsx)(w,{p:f,today:l,onChange:e=>j({...f,params:e}),onConfirm:async()=>{if(!f)return;const e=await(0,h.runAction)(f.action.id,f.params,i,!0);j(null),c(''),C('done'===e.status?{text:e.message,kind:'done'}:'demo_only'===e.status?{text:e.message,kind:'demo'}:{text:e.message??'Couldn\u2019t do that.',kind:'error'})},onCancel:()=>{j(null),C({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,b?(0,x.jsxs)(n.default,{style:{gap:6},testID:"assistant-reply",children:[(0,x.jsx)(a.Banner,{kind:'done'===b.kind?'success':'error'===b.kind?'warn':'demo'===b.kind?'demo':'info',title:b.text}),b.help?.map(t=>{const s=(0,r.helpById)(t);return(0,x.jsxs)(a.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,x.jsx)(a.T,{style:{flex:1},children:s.title}),s.showMe?(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>m(s,e)}):null]},t)})]}):null,(0,x.jsx)(a.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})}function y(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function w({p:e,today:t,onChange:s,onConfirm:l,onCancel:o}){const r=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,h.demoOnly)(e.action.risk),p=(t,l)=>s({...e.params,[t]:l}),m=e.action,f=e.params,j=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,x.jsxs)(n.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?u.colours.red:u.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':u.colours.okBg},children:[(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:c?'red':'ok',label:h.RISK_LABEL[m.risk]}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>p('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>p('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{size:12,children:"Who"}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:r.slice(0,14).map(e=>(0,x.jsx)(a.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>p('staffId',e.id)},e.id))}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1.3},children:(0,x.jsx)(a.Field,{label:"Date (YYYY-MM-DD)",value:String(f.date??t),onChangeText:e=>p('date',e)})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>p('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>p('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,x.jsx)(a.T,{children:j?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,x.jsx)(a.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,x.jsx)(a.Muted,{children:"Nothing happens until you tap Confirm."}),(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(a.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!j,onPress:l,style:{flex:1}}),(0,x.jsx)(a.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1438,[796,34,402,102,794,865,1390,1439,1440,1441,840,1100,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1439,[]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1440,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${O[t.risk]}${$(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if($(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(c.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const c=(0,l.searchHelp)(p.HELP,e,3);return c.length?{kind:'help',ids:c.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,O={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},$=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);return e.staffId&&e.date&&a>t?(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`):'That shift isn\u2019t complete.'}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...u.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1441,[1442,1098,829,1443,1444,865,848,1014,1390,1439,1440,1446,1445,1448,1449,1012,1013]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1442,[1398,1397,1038]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1443,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1444,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1445,1443]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1445,[804,1098,829,1120,1205,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1446,1447]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1446,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1447,[808,815,818]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1448,[800,865,989,836,1445,1032]); -__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1449,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceSettingsPage=function(){const{rid:e,r:s,now:t}=(0,f.useCtx)(6e4),o=(0,p.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"Staff hold the gold button, say what they need and let go. It sits at the top right in Managers, Head Chef, the Staff app (the full voice assistant, without team financial or HR information) and on the Display (no money, tips or HR either), never in the customer app. Tap it to type or open the Assistant. Replies and change confirmations are shown in text, never spoken. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts for you."}),(0,x.jsx)(c.VoiceUsageCard,{rid:e,now:t}),(0,x.jsxs)(i.Card,{children:[(0,x.jsxs)(i.T,{weight:"semibold",children:["Who gets the voice button at ",s.name]}),(0,x.jsx)(n.default,{style:{gap:6,marginTop:8},children:p.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:p.VOICE_ROLE_LABEL[s],value:(0,p.voiceOn)(o.enabled,e,s),onChange:t=>o.setEnabled(e,s,t)},s))}),(0,x.jsx)(i.Muted,{children:"Saved on this device for now; set it on each device."})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{testID:"voice-text-only",weight:"semibold",children:"The helper replies in text only. It never speaks."}),(0,x.jsx)(i.Row,{gap:8,wrap:!0,style:{marginTop:8},children:(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Show the microphone explanation again",onPress:()=>o.setMicExplained(!1)})})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{weight:"semibold",children:"Privacy"}),(0,x.jsxs)(i.Muted,{children:["What is said while the button is held (up to 30 seconds) is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. Each device asks once to use the microphone. ",(0,u.canListen)()?'This device can listen.':'This device can\u2019t listen, so the button offers \u201ctype instead\u201d.']})]})]})},_e.DraftsPage=function(){const{rid:e,me:o,role:h}=(0,f.useCtx)(6e4),p=(0,r.useDrafts)(e=>e.drafts),u=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[j,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=p.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),C='owner'===h||'manager'===h,D=e=>e.supplier?d.SUPPLIER_PORTALS.find(s=>s.id===e.supplier):void 0,P=e=>(0,x.jsx)(i.Card,{children:(0,x.jsxs)(n.default,{testID:`draft-${e.id}`,style:{gap:6},children:[(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Badge,{label:r.DRAFT_LABEL[e.kind],kind:"gold"}),'draft'!==e.status?(0,x.jsx)(i.Badge,{label:'approved'===e.status?'Approved':'Dismissed',kind:'approved'===e.status?'ok':'neutral'}):null]}),(0,x.jsx)(i.T,{weight:"semibold",children:e.title}),e.lines.map((s,t)=>(0,x.jsxs)(i.T,{size:15,children:['shopping'===e.kind?'\u2022 ':'',s]},t)),(0,x.jsxs)(i.Muted,{children:["From ",e.by," (",e.app,"), ",b(e.at),e.decidedBy?` \xb7 ${e.status} by ${e.decidedBy}, ${b(e.decidedAt)}`:'']}),'draft'===e.status&&C?(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Button,{small:!0,kind:"success",label:"Approve",testID:`draft-approve-${e.id}`,onPress:()=>y({d:e,status:'approved'})}),(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Dismiss",testID:`draft-dismiss-${e.id}`,onPress:()=>y({d:e,status:'dismissed'})}),D(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${D(e).name} ordering`,onPress:()=>{t.default.openURL(D(e).links.order)}}):null]}):null]})},e.id);return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Nothing here has been sent, ordered or paid",children:"The voice helper and the Assistant save bookings, supplier shopping lists, offers, events, specials, messages and payments here for you to check. Approving marks it approved and takes you to the right screen; you still do the booking, the order or the post yourself."}),C?null:(0,x.jsx)(i.Banner,{kind:"warn",title:"Owners and managers approve drafts",children:"You can see the drafts but not approve them."}),B.length?B.map(P):(0,x.jsx)(i.Muted,{children:"No drafts waiting. Try holding the voice button and saying \u201cadd blue roll to the Booker list\u201d."}),S.length?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:k?'Hide approved and dismissed':`Show approved and dismissed (${S.length})`,onPress:()=>w(!k)}):null,k?S.map(P):null,(0,x.jsx)(i.Sheet,{visible:!!j,onClose:()=>y(null),title:'approved'===j?.status?'Approve this draft?':'Dismiss this draft?',children:j?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:j.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===j.status?`This marks it approved${v[j.d.kind]?` and opens ${v[j.d.kind].label}`:''}. Nothing is sent, ordered or paid automatically.`:'It moves to the dismissed list. Nothing is sent.'}),(0,x.jsx)(i.Button,{kind:'approved'===j.status?'success':'danger',label:'approved'===j.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{u(j.d.id,j.status,o.replace(' (example)',''));const e=v[j.d.kind];y(null),'approved'===j.status&&e&&c&&c(e.tab,e.sub)}}),(0,x.jsx)(i.Button,{kind:"secondary",label:"Back",onPress:()=>y(null)})]}):null})]})},_e.ShiftNotesPage=function(){const{rid:e}=(0,f.useCtx)(6e4),s=(0,h.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,h.useShiftNotes)(e=>e.setDone);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.Muted,{children:"Notes left for the next shift, by voice (\u201ctell the next shift the glass washer is leaking\u201d) or the Assistant. Kept on this device for now."}),s.length?s.slice(0,60).map(e=>(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{style:{textDecorationLine:e.done?'line-through':'none'},colour:e.done?o.colours.muted:o.colours.text,children:e.text}),(0,x.jsxs)(i.Row,{style:{justifyContent:'space-between',marginTop:6},children:[(0,x.jsxs)(i.Muted,{children:[e.by," (",e.app,"), ",b(e.at)]}),(0,x.jsx)(i.Button,{small:!0,kind:e.done?'ghost':'success',label:e.done?'Reopen':'Done',onPress:()=>t(e.id,!e.done)})]})]},e.id)):(0,x.jsx)(i.Muted,{children:"No shift notes yet."})]})};var s=_r(_d[0]),t=e(_r(_d[1])),n=e(_r(_d[2])),i=_r(_d[3]),o=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),l=_r(_d[7]),h=_r(_d[8]),p=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),f=_r(_d[12]),x=_r(_d[13]);const b=e=>new Date(e).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});const v={booking:{tab:'bookings',sub:null,label:'Bookings'},offer:{tab:'more',sub:'offers',label:'Specials & offers'},event:{tab:'more',sub:'events',label:'Events'},special:{tab:'more',sub:'specialsboard',label:'Specials board'},shopping:{tab:'more',sub:'suppliers',label:'Suppliers'}}},1450,[34,379,102,794,840,1386,1446,1400,1447,1117,929,1407,1100,25]); -__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1451,[34,102,794,830,1202,1452,1453,840,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1452,[830]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1453,[985,1452,1205]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:s,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,d.useCashUp)(e=>e.cashUps),k=(0,d.useCashSettings)(e),w=(0,o.useNightlyPrefs)(l=>l.email[e]??!1),T=(0,o.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(l=>l.rid===e&&l.on).map(e=>e.name),[N,P]=(0,l.useState)((0,u.addDaysYmd)(v,-1)),U=(0,u.cashFieldsForRecord)(k.cashFields,s.settings.cashUpRecord),_=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:U,soldOut:C}),D='anchorage'!==e&&w,E=[0,1,2].map(e=>(0,u.addDaysYmd)(v,-e));return(0,j.jsxs)(t.default,{testID:"nightly-report",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,j.jsx)(n.Muted,{center:!0,children:"Spend per head, Covers and the cash-up for one night. Blank means it was not entered."}),(0,j.jsx)(t.default,{style:{width:'100%',gap:8},children:E.map(e=>(0,j.jsx)(n.Button,{kind:e===N?'primary':'secondary',label:e===v?'Today':e===(0,u.addDaysYmd)(v,-1)?'Yesterday':e,accessibilityLabel:`Nightly report for ${e}`,onPress:()=>P(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:_.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(_.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(_.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(_.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:_.takings}),(0,j.jsx)(x,{label:"Tips",value:_.tips}),(0,j.jsx)(x,{label:"Takings last week",value:_.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:_.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:_.soldOut.length?_.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),_.cashUp.length?_.cashUp.map(e=>(0,j.jsx)(x,{label:e.label,value:e.value},e.label)):(0,j.jsx)(n.Muted,{center:!0,children:"No cash-up fields for this venue."})]}),p.RELEASE.nightlyEmail&&'anchorage'!==e?(0,j.jsx)(n.Toggle,{testID:"nightly-email",label:"Also email the nightly report",value:D,onChange:l=>T(e,l)}):null]})};var e,l=_r(_d[0]),s=_r(_d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),d=_r(_d[4]),o=_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=({label:e,value:l})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${l}`,style:{width:'100%',alignItems:'center',gap:2,paddingVertical:8},children:[(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,children:e}),(0,j.jsx)(n.T,{center:!0,children:l})]})},1454,[34,102,794,848,1024,1455,977,13,1456,1035,840,1100,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useNightlyPrefs",{enumerable:!0,get:function(){return s}});var e,t=r(d[0]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);const s=(0,n.create)()((0,o.persist)(e=>({email:{},setEmail:(t,l)=>e(e=>({email:{...e.email,[t]:'anchorage'!==t&&l}}))}),{name:'covercharge-nightly-email-v1',storage:(0,o.createJSONStorage)(()=>l.default),version:1}))},1455,[808,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(o){const{rid:u,date:c,bookings:f,cashUps:p,fields:v,soldOut:h}=o,b=f.filter(t=>t.restaurantId===u&&t.date===c),k=p.find(t=>t.rid===u&&t.date===c&&t.confirmedAt),y=p.find(n=>n.rid===u&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),N=k?(0,t.grossOf)(k.vals)??(0,t.takings)(k.vals):null,O=(0,n.coversOn)(f,u,c),S=null==N||O<=0?null:Math.round(N/O*100)/100,_=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&_.set(n,(_.get(n)??0)+(t.partySize||0))}let w=null;for(const[t,n]of _)(!w||n>w.n)&&(w={hour:t,n:n});return{date:c,spendPerHead:s(S),covers:O,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(N),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(y?(0,t.grossOf)(y.vals)??(0,t.takings)(y.vals):null),busiestHour:w?`${String(w.hour).padStart(2,'0')}:00 \xb7 ${w.n} Covers`:'Not entered',soldOut:h.filter(Boolean),cashUp:v.map(t=>({label:t.label,value:k?l(k.vals[t.key],t.kind):'Not entered'}))}};var t=r(d[0]),n=r(d[1]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t)},1456,[13,1424]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{rid:e,me:o,meId:S}=(0,m.useCtx)(6e4),j=(0,u.useSupportChat)(e=>e.messages).filter(t=>t.rid===e),C=(0,u.useSupportChat)(e=>e.send),y=(0,u.useSupportChat)(e=>e.markSent),[f,I]=(0,s.useState)(''),[M,w]=(0,s.useState)(''),T=S===b,v=async e=>{const t=await(0,p.writeSupportMessage)(e);if(t.ok)return y(e.id),void w('');w(t.message||c.SUPPORT_NOT_SENT)};return(0,x.jsxs)(n.default,{testID:"support-chat",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.Muted,{center:!0,children:"A message to the CoverCharge team. Nobody replies automatically."}),M?(0,x.jsx)(l.Muted,{center:!0,testID:"support-note",children:M}):null,j.length?j.map(e=>(0,x.jsxs)(l.Card,{style:{alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:e.from}),(0,x.jsx)(l.T,{center:!0,children:e.text}),(0,x.jsxs)(l.Muted,{center:!0,children:[e.sent?'Sent':'Not sent'," \xb7 ",new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]}),e.sent?null:(0,x.jsx)(l.Button,{kind:"ghost",label:"Send again",accessibilityLabel:`Send again: ${e.text}`,onPress:()=>{v(e)}})]},e.id)):(0,x.jsx)(l.Muted,{center:!0,children:"No messages yet."}),(0,x.jsx)(t.TextInput,{testID:"support-draft",accessibilityLabel:"Message to CoverCharge support",value:f,onChangeText:I,placeholder:"Write a message",placeholderTextColor:h.colours.muted,multiline:!0,style:{width:'100%',minHeight:88,borderWidth:1,borderColor:h.colours.border,borderRadius:12,padding:12,color:h.colours.text,textAlign:'center'}}),(0,x.jsx)(l.Button,{testID:"support-send",label:"Send",accessibilityLabel:"Send message to CoverCharge support",disabled:!f.trim(),onPress:()=>{const t=C(e,o||'Manager',S||'',f);t&&(I(''),v(t))}}),T?(0,x.jsxs)(n.default,{testID:"support-inbox",style:{width:'100%',alignItems:'center',gap:8},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Support inbox"}),(0,x.jsx)(l.Muted,{center:!0,children:j.length?`${j.length} message${1===j.length?'':'s'} from this venue.`:'No messages in the inbox.'})]}):null]})};var e,t=r(d[0]),s=r(d[1]),o=r(d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),p=r(d[7]),m=r(d[8]),x=r(d[9]);const b='st-gordon'},1457,[796,34,102,794,1458,1036,840,1459,1100,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSupportChat",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);let c=0;const u=(0,n.create)()((0,o.persist)(e=>({messages:[],send:(t,s,n,o)=>{const u=o.trim().slice(0,1e3);if(!u)return null;const l={id:`sm-${Date.now().toString(36)}${(c++).toString(36)}`,rid:t,at:(new Date).toISOString(),from:s.slice(0,80),staffRef:n,text:u,sent:!1};return e(e=>({messages:[...e.messages,l].slice(-200)})),l},markSent:t=>e(e=>({messages:e.messages.map(e=>e.id===t?{...e,sent:!0}:e)}))}),{name:'covercharge-support-chat-v1',storage:(0,o.createJSONStorage)(()=>s.default),version:1}))},1458,[808,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.writeSupportMessage=async function(S){if(!s.RELEASE.supportSync)return{ok:!1,message:t.SUPPORT_NOT_SENT};if(!(0,n.isSupabaseConfigured)())return{ok:!1,message:t.SUPPORT_NOT_SENT};const _=u.useSync.getState().venueId;if(!_)return{ok:!1,message:`${t.SUPPORT_NOT_SENT} Sign in and try again.`};try{const s=(0,o.getSupabase)(),{error:n}=await s.from('support_messages').insert({venue_id:_,body:S.text,from_name:S.from,staff_ref:S.staffRef||null});return n?{ok:!1,message:t.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:t.SUPPORT_NOT_SENT}}};var s=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4])},1459,[1035,1036,974,931,985]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1460,[236]); -__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopShell=function(){const{rid:e,r:c,role:g,today:_,now:$,meId:V,me:Q}=(0,z.useCtx)(3e4);(0,m.useTipsPosted)(e,_);const Y=(0,z.useSignedIn)();(0,x.useSoldOutLink)(!0,(Y?.name??Q).replace(' (example)',''));const[ee,te]=(0,a.useState)({kind:'tab',tab:'home'}),[se,ae]=(0,a.useState)(''),oe=(0,a.useRef)(null);(0,a.useEffect)(()=>{(0,z.ensureAttendance)(_,$),(0,M.ensureChat)($)},[_]),globalThis.__ccNow=$.getTime();const ne=(0,a.useCallback)((e,t=null)=>{if('more'===e&&t){const e=q[t];return void te(e?{kind:'edit',id:e}:{kind:'page',id:t})}te('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,a.useEffect)(()=>(S.useVoiceNav.setState({go:ne}),()=>S.useVoiceNav.setState({go:null})),[ne]),(0,a.useEffect)(()=>{D.PITCH&&(globalThis.__pitchGo=ne,globalThis.__deskGo=e=>te(e))},[ne]),(0,E.useAlertWatcher)(e,{nag:'staff'!==g}),(0,w.useScheduledNotices)({rid:e,staffId:Y?.id??'',name:Q,onOpen:()=>ne('more','orderlists')}),(0,y.useOffRotaAlerts)({enabled:'staff'!==g&&!!Y}),(0,a.useEffect)(()=>((0,T.warmDesktopStt)(),(0,C.installVoiceKeys)()),[]);const re=(0,a.useMemo)(()=>[...G,...U].map(e=>e.s),[]);(0,a.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void oe.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=re[Number(e.key)-1];return void(t&&(e.preventDefault(),te(t)))}if('z'===t&&!Z(e.target)){const t=(0,W.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!Z(e.target)){const t=(0,W.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[re]);const ie=O.PAGES.filter(e=>(!e.can||e.can(g))&&!q[e.id]),le=(0,a.useMemo)(()=>{const e=se.trim().toLowerCase(),t={};return ie.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[ie,se]),de=G.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(g)),ue=p.CAN.forecasts(g)?U:U.filter(e=>'rota'===e.s.id),ce='page'===ee.kind?(0,O.pageFor)(ee.id):void 0,be='tab'===ee.kind?G.find(e=>X(e.s,ee))?.label:'edit'===ee.kind?U.find(e=>X(e.s,ee))?.label:ce?.title,he='tab'===ee.kind?G.find(e=>X(e.s,ee))?.tip:'page'===ee.kind?`${ce?.sub??''}. Press ${(0,N.CMD)()}K to jump to any page, or hold Space and ask.`:'',fe=({label:e,s:t,n:s})=>{const a=X(t,ee);return(0,K.jsxs)(o.default,{accessibilityRole:"button",accessibilityState:{selected:a},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>te(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:a?A.colours.goldTint:e?A.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:a?A.colours.gold:'transparent'}),children:[(0,K.jsx)(f.T,{size:14,weight:a?'semibold':'regular',colour:a?A.colours.gold:A.colours.text,style:{flex:1},numberOfLines:1,children:e}),s?(0,K.jsxs)(f.T,{size:11,colour:A.colours.muted,children:[(0,N.CMD)(),s]}):null]})},ge=({t:e})=>(0,K.jsx)(f.T,{size:11,weight:"semibold",colour:A.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),pe='owner'===g?'OWNER':'manager'===g?'MANAGER':'STAFF';return(0,K.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:A.colours.bg},testID:"desktop-shell",children:[(0,K.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,K.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(f.Row,{gap:10,children:[(0,K.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsx)(u.VenueName,{name:c.name}),(0,K.jsx)(f.Row,{gap:6,children:(0,K.jsx)(l.AppBadge,{label:pe})})]})]}),(0,K.jsx)(u.PoweredBy,{}),(0,K.jsx)(s.TextInput,{ref:oe,testID:"side-filter",value:se,onChangeText:ae,placeholder:`Find a page (${(0,N.CMD)()}K)`,placeholderTextColor:A.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,K.jsxs)(n.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[se?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{t:"Run the day"}),de.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:t+1},e.label)),(0,K.jsx)(ge,{t:"Drag-and-drop editors"}),ue.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:de.length+t+1},e.label))]}),Object.entries(le).map(([e,t])=>(0,K.jsxs)(r.default,{children:[(0,K.jsx)(ge,{t:e}),t.map(e=>(0,K.jsx)(fe,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{flex:1},children:[(0,K.jsx)(r.default,{testID:"desk-title",children:(0,K.jsx)(f.T,{size:24,weight:"bold",children:be??''})}),(0,K.jsxs)(f.Muted,{size:12,children:[Y?`Signed in as ${Y.name} \xb7 ${p.ROLE_LABEL[g]}`:`Preview \xb7 ${p.ROLE_LABEL[g]}`," \xb7 ",c.name]})]}),(0,K.jsxs)(r.default,{style:{alignItems:'flex-end'},children:[(0,K.jsx)(f.T,{size:15,weight:"bold",colour:A.colours.gold,children:"Talk to CoverCharge"}),(0,K.jsxs)(f.Muted,{size:12,children:["Hold Space, or ",(0,N.CMD)(),"\u21e7G"]})]}),(0,K.jsx)(v.VoiceSlot,{size:76})]}),(0,K.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[he?(0,K.jsx)(F.Tip,{children:he}):null,'edit'===ee.kind?(0,K.jsx)(J,{id:ee.id,rid:e,me:Q,role:'owner'===g?'owner':'manager',today:_,venue:c.name}):(0,K.jsxs)(n.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===ee.kind&&'home'===ee.tab?(0,K.jsx)(H.Dashboard,{go:ne}):null,'tab'===ee.kind&&'orders'===ee.tab?(0,K.jsx)(I.Orders,{}):null,'tab'===ee.kind&&'bookings'===ee.tab?(0,K.jsx)(R.Bookings,{}):null,'tab'===ee.kind&&'forecast'===ee.tab?(0,K.jsx)(P.Forecasts,{go:ne}):null,'tab'===ee.kind&&'chat'===ee.tab?(0,K.jsx)(M.Chat,{go:ne}):null,ce?(0,K.jsx)(ce.C,{go:ne}):'page'===ee.kind?(0,K.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,K.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==g?(0,K.jsx)(h.PrintHost,{rid:e}):null,'staff'!==g?(0,K.jsx)(b.AlertHost,{variant:"managers",rid:e,me:Q,onOpen:e=>ne('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,K.jsx)(L.AssistantSheet,{}),(0,K.jsx)(B.OnboardingHost,{go:ne}),(0,K.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),s=_r(d[1]),a=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),i=_r(d[6]),l=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]),f=_r(d[12]),g=_r(d[13]),p=_r(d[14]),x=_r(d[15]),m=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),S=_r(d[22]),v=_r(d[23]),T=_r(d[24]),E=_r(d[25]),D=_r(d[26]),A=_r(d[27]),L=_r(d[28]),R=_r(d[29]),M=_r(d[30]),z=_r(d[31]),H=_r(d[32]),P=_r(d[33]),B=_r(d[34]),I=_r(d[35]),O=_r(d[36]);_r(d[37]);var _=_r(d[38]),N=_r(d[39]),W=_r(d[40]),$=_r(d[41]),V=_r(d[42]),F=_r(d[43]),K=_r(d[44]);const G=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Hold Space and say \u201chow many Covers tonight?\u201d for a quick answer without leaving this screen.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first. Say \u201cshow new orders\u201d to jump back any time.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber. Hold Space and say \u201caccept the 7 o\u2019clock\u201d.'},{label:'Forecasts',s:{kind:'tab',tab:'forecast'},tip:'The forecast learns from your past weeks; the more you trade, the better it gets.'},{label:'Staff chat',s:{kind:'tab',tab:'chat'},tip:'Messages here go to staff in the Staff app only, never by text or WhatsApp.'}],U=[{label:'Table plan',s:{kind:'edit',id:'plan'},tip:''},{label:'Menu',s:{kind:'edit',id:'menu'},tip:''},{label:'Rota',s:{kind:'edit',id:'rota'},tip:''},{label:'Branding & Display',s:{kind:'edit',id:'brand'},tip:''}],q={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},X=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),Z=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function J({id:e,rid:t,me:s,role:o,today:n,venue:i}){const l=(0,g.usePlan)(t),[u,b]=(0,a.useState)(0),[h,p]=(0,a.useState)('');return'menu'===e?(0,K.jsx)($.MenuEditor,{rid:t,me:s,role:o}):'rota'===e?(0,K.jsx)(V.RotaEditor,{today:n}):'brand'===e?(0,K.jsx)(_.BrandEditor,{rid:t}):(0,K.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,K.jsxs)(F.Tip,{children:["Drag tables to move them; they snap to the grid and line up with their neighbours (gold lines). Hold Option (Alt) to move freely. \u201cTidy up\u201d lines up a whole area. ",(0,N.CMD)(),"Z undoes, then Save."]}),h?(0,K.jsx)(f.T,{size:13,colour:A.colours.goldLight,children:h}):null,(0,K.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:A.colours.border,borderRadius:12,overflow:'hidden'},children:(0,K.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{g.useFloor.getState().setPlan(t,e),p('Table plan saved. The Display uses it straight away.'),b(e=>e+1)},onCancel:()=>{p('Changes thrown away.'),b(e=>e+1)}},u)})]})}},1461,[798,796,34,402,295,102,36,1289,847,1292,1174,1310,794,1014,865,977,1048,1390,1087,1086,1085,1462,1400,1116,929,1176,2,840,1410,1340,1135,1100,1355,1392,1384,1394,1378,1395,1463,1460,1465,1467,1469,1466,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1462,[815]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandEditor=function({rid:e}){const w=(0,l.useBrand)(e),k=(0,u.useOwner)(t=>t.branding[e]?.recent)??[],[D,B]=(0,t.useState)(w.accent);(0,t.useEffect)(()=>B(w.accent),[w.accent]);const[S,v]=(0,t.useState)(!1),[O,C]=(0,t.useState)(''),P=(0,j.useHistory)(()=>{const t=u.useOwner.getState().branding[e];return t?{...t}:void 0},t=>{u.useOwner.getState().setBranding(e,null),t&&u.useOwner.getState().setBranding(e,t)},'branding'),R=(0,h.checkAccent)(D,x.colours.bg,x.colours.onGold,x.colours.text),T=async t=>{t.preventDefault(),v(!1);const o=(0,b.filesOf)(t)[0];if(o)try{const t=await(0,b.shrinkImage)(o,512,'image/png'===o.type?'image/png':'image/jpeg');P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:t}),C('Logo updated in all apps.')}catch{C('That picture couldn\u2019t be read.')}else C('Drop a picture file (PNG or JPEG).')};return(0,y.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:30},testID:"desk-brand",children:[(0,y.jsx)(f.Tip,{children:"Drop your logo from Finder onto the box, then pick an accent colour. \u2318Z undoes. Display layout settings are further down."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(n.default,{style:{flex:1}}),O?(0,y.jsx)(c.T,{size:13,colour:x.colours.goldLight,children:O}):null,(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"brand-undo"}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"brand-redo"})]}),(0,y.jsxs)(n.default,{style:{flexDirection:'row',gap:16,flexWrap:'wrap'},children:[(0,y.jsxs)(n.default,{style:{width:320,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Logo"}),(0,y.jsxs)("div",{"data-testid":"brand-logo-drop",onDragOver:e=>{(0,b.hasFiles)(e)&&(e.preventDefault(),v(!0))},onDragLeave:()=>v(!1),onDrop:e=>{T(e)},style:(0,f.box)({height:200,borderRadius:14,border:`2px dashed ${S?x.colours.gold:x.colours.accentBorder}`,background:S?x.colours.accentBg:x.colours.surface,display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',gap:10}),children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:96}),(0,y.jsx)("span",{style:(0,f.box)({fontSize:13,color:x.colours.muted}),children:"Drop a logo here (PNG with a clear background is best)"})]}),w.custom&&u.useOwner.getState().branding[e]?.logoUri?(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Use the standard logo",onPress:()=>{P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:void 0})}}):null,(0,y.jsx)(c.T,{weight:"semibold",children:"Preview"}),(0,y.jsxs)(n.default,{style:{backgroundColor:x.colours.bg,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12,gap:8},children:[(0,y.jsxs)(c.Row,{gap:10,children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:44}),(0,y.jsx)(c.T,{weight:"bold",children:w.name})]}),(0,y.jsx)(n.default,{style:{backgroundColor:D,borderRadius:10,padding:10,alignItems:'center'},children:(0,y.jsx)(c.T,{weight:"semibold",colour:R.onAccent,children:"Book a table"})})]})]}),(0,y.jsxs)(n.default,{style:{width:380,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Accent colour"}),(0,y.jsx)(s.ColourPicker,{value:D,onChange:B,onCommit:t=>{t!==w.accent&&(P.record('accent colour'),u.useOwner.getState().setBranding(e,{accent:t,recent:(0,h.pushRecent)(k,t)}),C(`Accent set to ${t}.`))},quick:l.ACCENTS,recent:k}),R.tips.length?(0,y.jsx)(c.Banner,{kind:"warn",children:R.tips.join(' ')}):(0,y.jsx)(c.Muted,{size:12,children:"Easy to read on the dark background."})]})]}),(0,y.jsxs)(n.default,{style:{maxWidth:760,gap:8},children:[(0,y.jsx)(c.T,{size:18,weight:"bold",children:"Display layout"}),(0,y.jsx)(p.DisplaySettingsPage,{})]})]})};var t=r(d[0]),o=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]),p=r(d[8]),x=r(d[9]),b=r(d[10]),j=r(d[11]),f=r(d[12]),y=r(d[13])},1463,[34,295,102,1419,847,794,865,799,1379,840,1464,1465,1466,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dragData",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"readDrag",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"filesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"hasFiles",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"readDataUrl",{enumerable:!0,get:function(){return i}}),_e.shrinkImage=async function(e,t=1024,r="image/jpeg"){const n=await i(e),o=await new Promise((e,t)=>{const r=new Image;r.onload=()=>e(r),r.onerror=t,r.src=n}),s=Math.min(1,t/Math.max(o.width,o.height)),c=document.createElement('canvas');return c.width=Math.round(o.width*s),c.height=Math.round(o.height*s),c.getContext('2d').drawImage(o,0,0,c.width,c.height),c.toDataURL(r,.82)};const e=(e,t,r)=>{try{e.dataTransfer.setData('text/plain',`${t}:${r}`),e.dataTransfer.effectAllowed='copyMove'}catch{}},t=e=>{const t=e.dataTransfer?.getData('text/plain')??'',r=t.indexOf(':');return r>0?{kind:t.slice(0,r),id:t.slice(r+1)}:null},r=e=>Array.from(e.dataTransfer?.files??[]).filter(e=>/^image\//.test(e.type)),n=e=>Array.from(e.dataTransfer?.types??[]).includes('Files'),i=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error),n.readAsDataURL(e)})},1464,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"activeUndo",{enumerable:!0,get:function(){return u}}),e.useHistory=function(u,c,s="change",l=60){const o=(0,t.useRef)([]),f=(0,t.useRef)([]),[,h]=(0,t.useState)(0),[v,b]=(0,t.useState)(''),w=(0,t.useRef)(u);w.current=u;const R=(0,t.useRef)(c);R.current=c;const p=(0,t.useCallback)((t=s)=>{o.current=[...o.current,{v:w.current(),what:t}].slice(-l),f.current=[],b(t),h(t=>t+1)},[s,l]),_=(0,t.useCallback)(()=>{const t=o.current.pop();t&&(f.current.unshift({v:w.current(),what:t.what}),R.current(t.v),b(`Undid: ${t.what}`),h(t=>t+1))},[]),k=(0,t.useCallback)(()=>{const t=f.current.shift();t&&(o.current.push({v:w.current(),what:t.what}),R.current(t.v),b(`Redid: ${t.what}`),h(t=>t+1))},[]),y={undo:_,redo:k,canUndo:o.current.length>0,canRedo:f.current.length>0,label:s,record:p,last:v};return(0,t.useEffect)(()=>(n=y,()=>{n===y&&(n=null)})),y};var t=r(d[0]);let n=null;const u=()=>n},1465,[34]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Tip=function({children:e}){return(0,c.jsxs)(t.default,{testID:"desk-tip",style:{flexDirection:'row',gap:8,alignItems:'flex-start',borderWidth:1,borderColor:n.colours.accentBorder,backgroundColor:n.colours.accentBg,borderRadius:10,paddingHorizontal:12,paddingVertical:8},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:n.colours.gold,children:"Tip"}),(0,c.jsx)(l.T,{size:13,colour:n.colours.text,style:{flex:1},children:e})]})},Object.defineProperty(_e,"box",{enumerable:!0,get:function(){return s}}),r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},l=r(d[2]),n=r(d[3]),c=r(d[4]);const s=(e={})=>({fontFamily:'Poppins_400Regular',color:n.colours.text,boxSizing:'border-box',...e})},1466,[34,102,794,840,25]); -__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuEditor=function({rid:e,me:o,role:s}){const a=(0,d.useAllMenu)(e),c=(0,l.useStore)(o=>o.restaurants.find(o=>o.id===e)),[u,h]=(0,t.useState)('dishes'),[D,O]=(0,t.useState)(null),[k,w]=(0,t.useState)(null),[C,I]=(0,t.useState)(''),z=(0,t.useMemo)(()=>{const e=[...c?.sections??[]];return a.forEach(o=>{e.includes(o.section)||e.push(o.section)}),e},[c?.sections,a]),M=a.filter(e=>!e.hidden||e.recipeCardId),P=e=>(0,p.hasRecipeCards)()?(0,p.recipeCards)().byMenuItem(e):void 0,T={name:o,role:s},R=(0,b.useHistory)(()=>({sections:[...z],items:Object.fromEntries(l.useStore.getState().menu.filter(o=>o.restaurantId===e).map(e=>{const o=a.find(o=>o.id===e.id)??e;return[e.id,{section:o.section,sort:e.sort,price:o.price,allergens:{...o.allergens},soldOut:e.soldOut,photo:P(e.id)?.photo}]}))}),o=>{const t=l.useStore.getState();c&&o.sections.join('|')!==(c.sections??[]).join('|')&&t.updateRestaurant(e,{sections:o.sections});for(const[e,s]of Object.entries(o.items)){const o=a.find(o=>o.id===e),n=t.menu.find(o=>o.id===e);if(!o||!n)continue;const r={};o.section!==s.section&&(r.section=s.section),n.sort!==s.sort&&(r.sort=s.sort),o.price!==s.price&&(r.price=s.price),JSON.stringify(o.allergens)!==JSON.stringify(s.allergens)&&(r.allergens=s.allergens),n.soldOut!==s.soldOut&&(r.soldOut=s.soldOut),Object.keys(r).length&&t.updateMenuItem(e,r);const d=P(e);d&&d.photo!==s.photo&&(0,p.recipeCards)().update(d.id,{photo:s.photo},T)}},'menu change'),B=(e,o,t)=>{const s=a.find(o=>o.id===e);if(!s)return;R.record(`moved ${s.name}`);const n=l.useStore.getState(),r=a.map(t=>t.id===e?{...t,section:o}:t);s.section!==o&&n.updateMenuItem(e,{section:o}),(0,y.reorder)(r,e,o,t).forEach(e=>n.updateMenuItem(e.id,{sort:e.sort})),I(`${s.name} moved${s.section!==o?` to ${o}`:''}.`)},F=async(o,t)=>{const s=P(o),n=a.find(e=>e.id===o);if(s&&n)try{const o=await(0,f.shrinkImage)(t,1024);R.record(`photo for ${n.name}`);const r=await(0,p.recipeCards)().savePhoto(e,s.id,{dataUrl:o,width:0,height:0,bytes:Math.round(.75*o.length)});await(0,p.recipeCards)().update(s.id,{photo:r},T),I(`Photo added to ${n.name}. The dish needs the Head Chef\u2019s sign-off again.`)}catch{I('That picture couldn\u2019t be read. Try a JPEG or PNG.')}else I('This dish has no recipe card yet, so it can\u2019t hold a photo.')},_=a.find(e=>e.id===D),E=({m:e})=>{const o=P(e.id),t=o?.photo&&(0,p.hasRecipeCards)()?(0,p.recipeCards)().photoSource(o.photo):null,s=t?.uri,n=D===e.id,r=k===`d:${e.id}`;return(0,S.jsxs)("div",{"data-testid":`menu-dish-${e.id}`,draggable:!0,onDragStart:o=>(0,f.dragData)(o,'dish',e.id),onClick:()=>O(e.id),onDragOver:o=>{o.preventDefault(),w(`d:${e.id}`)},onDragLeave:()=>w(null),onDrop:o=>{o.preventDefault(),o.stopPropagation(),w(null);const t=(0,f.filesOf)(o)[0];if(t)return void F(e.id,t);const s=(0,f.readDrag)(o);'dish'===s?.kind&&s.id!==e.id&&B(s.id,e.section,e.id)},style:(0,j.box)({display:'flex',alignItems:'center',gap:10,padding:'8px 10px',borderRadius:10,cursor:'grab',userSelect:'none',marginBottom:6,background:n?x.colours.goldTint:x.colours.tile,border:`1px solid ${r?x.colours.gold:n?x.colours.accentBorder:x.colours.hairline}`,borderTop:r?`3px solid ${x.colours.gold}`:void 0}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted,fontSize:16}),children:"\u283f"}),(0,S.jsx)("div",{style:(0,j.box)({width:40,height:40,borderRadius:8,background:x.colours.surface2,backgroundImage:s?`url(${s})`:void 0,backgroundSize:'cover',backgroundPosition:'center',flexShrink:0,display:'flex',alignItems:'center',justifyContent:'center',fontSize:10,color:x.colours.muted}),children:s?'':'photo'}),(0,S.jsxs)("div",{style:(0,j.box)({flex:1,minWidth:0}),children:[(0,S.jsx)("div",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',fontSize:14,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',textDecoration:e.soldOut?'line-through':void 0}),children:e.name}),(0,S.jsxs)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[Object.keys(e.allergens).length?Object.keys(e.allergens).length+' allergens':'No allergens',e.hidden?' \xb7 hidden':'']})]}),e.soldOut?(0,S.jsx)("span",{style:(0,j.box)({fontSize:11,color:x.colours.amber,border:`1px solid ${x.colours.amber}`,borderRadius:6,padding:'1px 6px'}),children:"Sold out"}):null,(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',color:x.colours.gold,fontSize:14}),children:v(e.price)})]})};return(0,S.jsxs)(n.default,{style:{flex:1,gap:10},testID:"desk-menu",children:[(0,S.jsx)(j.Tip,{children:"Drag a dish (\u283f) to put it in order or onto another section. Drag a section name to move the whole section. Drop a photo from Finder onto a dish. \u2318Z undoes."}),(0,S.jsxs)(r.Row,{gap:8,children:[(0,S.jsx)(r.Chip,{label:"Dishes",selected:'dishes'===u,onPress:()=>h('dishes'),testID:"menu-tab-dishes"}),(0,S.jsx)(r.Chip,{label:"Sold out & counts",selected:'soldout'===u,onPress:()=>h('soldout'),testID:"menu-tab-soldout"}),(0,S.jsx)(n.default,{style:{flex:1}}),C?(0,S.jsx)(r.T,{size:13,colour:x.colours.goldLight,children:C}):null,(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!R.canUndo,onPress:R.undo,testID:"menu-undo"}),(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!R.canRedo,onPress:R.redo,testID:"menu-redo"})]}),'soldout'===u?(0,S.jsx)(n.default,{style:{maxWidth:760},children:(0,S.jsx)(m.SoldOutList,{rid:e,by:o})}):(0,S.jsxs)(n.default,{style:{flex:1,flexDirection:'row',gap:14,minHeight:0},children:[(0,S.jsx)("div",{style:(0,j.box)({flex:1,overflowY:'auto',paddingRight:6}),"data-testid":"menu-sections",children:z.map(o=>{const t=M.filter(e=>e.section===o),s=k===`s:${o}`;return(0,S.jsxs)("div",{style:(0,j.box)({marginBottom:14}),onDragOver:e=>{e.preventDefault(),w(`s:${o}`)},onDragLeave:()=>w(null),onDrop:t=>{t.preventDefault(),w(null);const s=(0,f.readDrag)(t);var n,r;'dish'===s?.kind&&B(s.id,o,null),'section'===s?.kind&&s.id!==o&&(n=s.id,r=o,c&&(R.record(`moved section ${n}`),l.useStore.getState().updateRestaurant(e,{sections:(0,y.moveSection)(z,n,r)}),I(`${n} moved.`)))},children:[(0,S.jsxs)("div",{draggable:!0,onDragStart:e=>(0,f.dragData)(e,'section',o),"data-testid":`menu-section-${o}`,style:(0,j.box)({display:'flex',alignItems:'center',gap:8,padding:'6px 4px',cursor:'grab',borderBottom:`${s?2:1}px solid ${s?x.colours.gold:x.colours.border}`,marginBottom:8}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted}),children:"\u283f"}),(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_700Bold',fontSize:16,color:x.colours.goldMuted,letterSpacing:.5,textTransform:'uppercase'}),children:o}),(0,S.jsxs)("span",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[t.length," dishes"]})]}),t.map(e=>(0,S.jsx)(E,{m:e},e.id)),t.length?null:(0,S.jsx)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted,padding:8,border:`1px dashed ${x.colours.border}`,borderRadius:8}),children:"Drop a dish here"})]},o)})}),(0,S.jsx)(n.default,{style:{width:340,gap:10},testID:"menu-inspector",children:_?(0,S.jsx)($,{rid:e,m:_,me:o,record:R.record,onPhoto:e=>{F(_.id,e)}},_.id):(0,S.jsx)(r.Muted,{children:"Click a dish to change its price, allergens and sold-out state."})})]})]})};var e,o=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),n=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),m=_r(_d[11]),x=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),S=_r(_d[17]);const v=e=>null==e?'Board':`\xa3${(e/100).toFixed(2)}`,D={none:'contains',contains:'may',may:void 0};function $({rid:e,m:s,me:d,record:p,onPhoto:m}){const[b,y]=(0,t.useState)(null==s.price?'':(s.price/100).toFixed(2)),v=(e,o)=>{p(o),l.useStore.getState().updateMenuItem(s.id,e)},$=(0,c.dishUsesFor)(e).find(e=>e.id===s.id),O=(0,c.itemsFor)(e),k=()=>{const e=b.trim(),o=''===e?null:Number(e.replace('\xa3',''));if(null!==o&&(!isFinite(o)||o<0))return void y(null==s.price?'':(s.price/100).toFixed(2));const t=null==o?null:Math.round(100*o);t!==s.price&&v({price:t},`price of ${s.name}`)},w=e=>{const o=s.allergens[e]??'none',t=D[o],n={...s.allergens};t?n[e]=t:delete n[e],v({allergens:n},`allergens on ${s.name}`)};return(0,S.jsxs)(n.default,{style:{gap:10,backgroundColor:x.colours.surface,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12},children:[(0,S.jsx)(r.T,{size:17,weight:"bold",children:s.name}),(0,S.jsxs)(r.Muted,{size:12,children:[s.section,s.signOff?` \xb7 signed off by ${s.signOff.by}`:' \xb7 awaiting Head Chef sign-off']}),(0,S.jsx)("div",{onDragOver:e=>{(0,f.hasFiles)(e)&&e.preventDefault()},onDrop:e=>{e.preventDefault();const o=(0,f.filesOf)(e)[0];o&&m(o)},"data-testid":"menu-photo-drop",style:(0,j.box)({border:`1px dashed ${x.colours.accentBorder}`,borderRadius:10,padding:12,textAlign:'center',fontSize:12,color:x.colours.muted}),children:"Drop a photo from Finder here"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Price (\xa3)"}),(0,S.jsx)(o.TextInput,{testID:"menu-price",value:b,onChangeText:y,onBlur:k,onSubmitEditing:k,placeholder:"Blank = on the specials board",placeholderTextColor:x.colours.muted,style:[r.styles.input,{width:160}]})]}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Allergens"}),(0,S.jsx)(r.Muted,{size:12,children:"Click to cycle: contains \u2192 may contain \u2192 none. Changes go to the recipe card and need the Head Chef\u2019s sign-off."}),(0,S.jsx)(r.Row,{gap:6,wrap:!0,children:h.ALLERGENS.map(e=>{const o=s.allergens[e.id];return(0,S.jsx)(r.Chip,{testID:`menu-al-${e.id}`,label:'may'===o?`${e.short} (may)`:e.short,selected:!!o,onPress:()=>w(e.id)},e.id)})})]}),(0,S.jsx)(r.Toggle,{label:"Sold out now",value:s.soldOut,onChange:e=>{p(`sold out ${s.name}`),(0,a.setSoldOut)(s.id,e,d)},testID:"menu-soldout"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Sold-out link"}),$&&$.uses.length?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r.Muted,{size:12,children:(0,u.usesText)($.uses,O)}),(0,S.jsx)(r.Badge,{kind:"gold",label:"Sells out on its own when the count runs out"})]}):(0,S.jsx)(r.Muted,{size:12,children:"Not linked to a count. Link it in \u201cSold out & counts\u201d."})]})]})}},1467,[796,34,102,794,850,800,977,979,980,830,856,1130,840,1464,1465,1466,1468,25]); -__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1468,[865]); -__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const y=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[$,j]=(0,t.useState)((0,i.mondayOfDate)(e)),[v,k]=(0,t.useState)(null),[w,D]=(0,t.useState)(''),B=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),O=b.map((e,t)=>(0,i.addDays)($,t)),P=(e,t,o)=>{e.preventDefault(),k(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=y.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=$&&e.date<=O[6]),I=T.filter(e=>!e.published||e.changed).length;return(0,p.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,p.jsx)(h.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,p.jsxs)(s.Row,{gap:8,children:[(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>j((0,i.addDays)($,-7))}),(0,p.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date($+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>j((0,i.addDays)($,7))}),(0,p.jsx)(d.default,{style:{flex:1}}),w?(0,p.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:w}):null,(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!B.canUndo,onPress:B.undo,testID:"rota-undo"}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!B.canRedo,onPress:B.redo,testID:"rota-redo"}),(0,p.jsx)(s.Button,{small:!0,label:I?`Publish (${I})`:'Published',disabled:!I,onPress:()=>{B.record('published the week');const e=i.useOwner.getState().publishWeek($);D(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,p.jsx)("div",{style:(0,h.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,p.jsxs)("div",{style:(0,h.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,p.jsx)("div",{style:(0,h.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),O.map((t,o)=>(0,p.jsxs)("div",{style:(0,h.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[b[o]," ",Number(t.slice(8))]},t)),y.map(e=>(0,p.jsxs)(o.default.Fragment,{children:[(0,p.jsxs)("div",{style:(0,h.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,p.jsx)("div",{style:(0,h.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,p.jsx)("div",{style:(0,h.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),O.map(t=>{const o=`${e.id}|${t}`,d=T.filter(o=>o.staffId===e.id&&o.date===t);return(0,p.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',k(o)},onDragLeave:()=>k(null),onDrop:o=>P(o,e.id,t),style:(0,h.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,p.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,h.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,p.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]),f=r(_d[9]),p=r(_d[10]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1469,[34,102,794,865,1103,840,1464,1465,1466,1468,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=W,_e.CarApp=function(){const{width:e,height:d}=(0,l.default)(),{role:h,today:b,now:x}=(0,f.useCtx)(3e4),[w,B]=(0,t.useState)(d),H=(0,D.railSizes)(e,w),z=Math.max(320,e-H.railW),[M,P]=(0,t.useState)(null),[A,_]=(0,t.useState)(null),[N,E]=(0,t.useState)(!1),[U,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,f.ensureAttendance)(b,x),(0,u.ensureChat)(x)},[b]),(0,t.useEffect)(()=>{W().then(_)},[]),(0,t.useEffect)(()=>{if(I.PITCH)return;const e=setInterval(()=>{(0,C.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==h&&j.useOwner.getState().setPreviewRole('owner')},[h]);const F=(0,t.useCallback)(()=>P(null),[]);(0,p.useBackLayer)(!!M,F);const Y=e=>P({btn:e,page:e.pages[0].id}),G=(0,t.useCallback)((e,t)=>{const n=e=>D.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return P(null);if('bookings'===e)return P({btn:n('@bookings'),page:'@bookings'});if('chat'===e)return P({btn:n('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return P(t=>({btn:t?.btn??D.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=n(t);return P(n=>({btn:e??n?.btn??D.CAR_BUTTONS[0],page:t}))}P(null)},[]),q=z<1400?z:Math.round(Math.min(z,Math.max(960,.72*z))),J=M?M.btn.pages.find(e=>e.id===M.page)?.label??(0,c.pageFor)(M.page)?.title??M.btn.label:'';return(0,v.jsxs)(s.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-w)>1&&B(t)},style:{flex:1,flexDirection:'row',backgroundColor:T.colours.bg,minHeight:0},children:[(0,v.jsxs)(s.default,{testID:"car-board",style:{width:z,minWidth:0,minHeight:0},children:[(0,v.jsx)(a.DisplayBoard,{embedded:!0,noVoice:!0,boardW:z,headerExtra:(0,v.jsx)(S.ParkedOnly,{small:e<1400}),subHeader:(0,v.jsx)($,{onRota:()=>Y(D.CAR_BUTTONS[0]),onAccount:()=>E(!0)})}),M?(0,v.jsxs)(s.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:q,zIndex:40,backgroundColor:T.colours.bg,borderLeftWidth:1,borderColor:T.colours.gold,boxShadow:'-18px 0 40px rgba(0,0,0,0.55)'},children:[(0,v.jsxs)(s.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,v.jsx)(n.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${J}, back to the board`,onPress:()=>{(0,p.runBackLayer)()||F()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:T.colours.border,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(y.T,{weight:"semibold",center:!0,children:"Close"})}),(0,v.jsx)(s.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,v.jsx)(y.T,{size:20,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:M.btn.label})}),(0,v.jsx)(s.default,{style:{minWidth:96}})]}),M.btn.pages.length>1?(0,v.jsx)(s.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:M.btn.pages.map(e=>{const t=e.id===M.page;return(0,v.jsx)(n.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>P({btn:M.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?T.colours.gold:T.colours.border,backgroundColor:t?R:'transparent',alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(y.T,{weight:"semibold",colour:t?T.colours.goldLight:T.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,v.jsx)(o.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:'assistant'===M.page&&!1===A?(0,v.jsx)(L,{}):(0,v.jsx)(O,{id:M.page,go:G},M.page)})]}):null]}),(0,v.jsxs)(s.default,{testID:"car-rail",accessibilityRole:"toolbar",accessibilityLabel:"Owner tools",style:{width:H.railW,borderLeftWidth:1,borderColor:T.colours.border,backgroundColor:'#0A0A0A',paddingTop:6,paddingBottom:6,alignItems:'stretch',minHeight:0},children:[(0,v.jsx)(s.default,{style:{height:32,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(y.T,{size:11,weight:"semibold",colour:T.colours.goldMuted,center:!0,style:{letterSpacing:1},children:"OWNER"})}),(0,v.jsx)(s.default,{style:{flex:1,justifyContent:'space-between',minHeight:0},children:D.CAR_BUTTONS.map(e=>{const t=M?.btn.id===e.id;return(0,v.jsxs)(n.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>t?F():Y(e),style:{height:H.per,alignItems:'center',justifyContent:'center',gap:2},children:[(0,v.jsx)(s.default,{style:{width:H.circle,height:H.circle,borderRadius:H.circle/2,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:t?T.colours.gold:R,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(k.CarGlyph,{name:e.icon,size:H.icon,colour:t?'#0B0B0B':T.colours.goldLight})}),(0,v.jsx)(y.T,{size:H.label,weight:t?'semibold':'medium',colour:t?T.colours.goldLight:T.colours.text,center:!0,numberOfLines:1,children:H.railW<150?e.short:e.label})]},e.id)})})]}),N?(0,v.jsxs)(y.Sheet,{visible:!0,onClose:()=>E(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,v.jsx)(y.T,{center:!0,children:"This car is signed in to The Anchorage as you, with your own rights. Use it only when the car is in Park."}),(0,v.jsx)(y.Muted,{center:!0,children:"To sign it out from your phone: Managers, More, Car screen."}),(0,v.jsx)(y.Button,{testID:"car-sign-out",kind:"secondary",label:"Sign this car out",onPress:()=>{E(!1),V(!0)},style:{minHeight:56}}),(0,v.jsx)(y.Button,{kind:"ghost",label:"Close",onPress:()=>E(!1),style:{minHeight:56}})]}):null,U?(0,v.jsxs)(y.Sheet,{visible:!0,onClose:()=>V(!1),title:"Sign this car out?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,v.jsx)(y.T,{center:!0,children:"You\u2019ll need a new code, approved on your phone, to use it again."}),(0,v.jsx)(y.Button,{testID:"car-sign-out-yes",label:"Yes, sign this car out",onPress:()=>{V(!1),(0,C.carSignOut)()},style:{minHeight:56}}),(0,v.jsx)(y.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]);r(_d[1]);var n=e(r(_d[2])),o=e(r(_d[3])),s=e(r(_d[4])),l=e(r(_d[5])),a=r(_d[6]),c=r(_d[7]);r(_d[8]);var d=r(_d[9]),u=r(_d[10]),h=r(_d[11]),b=r(_d[12]),f=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),w=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),S=r(_d[24]),B=r(_d[25]),v=r(_d[26]);const R='rgba(201,162,74,0.14)';async function W(){try{const e='undefined'!=typeof navigator?navigator.mediaDevices:null;if(!e?.getUserMedia||!e?.enumerateDevices)return!1;return(await e.enumerateDevices()).some(e=>'audioinput'===e.kind)}catch{return!1}}function $({onRota:e,onAccount:o}){const l=(0,f.useSignedIn)(),a=(0,j.useOwner)(e=>e.attendance),c=(0,j.useOwner)(e=>e.staff),[d,u]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>u(Date.now()),3e4);return()=>clearInterval(e)},[]);const h=a.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(c.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),b=[...new Set(h)],p=b.length?`On now: ${b.join(' \xb7 ')}`:'Nobody clocked in';return(0,v.jsxs)(s.default,{testID:"car-strip",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,v.jsx)(n.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${p}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,v.jsx)(y.T,{size:14,weight:"semibold",colour:T.colours.goldLight,numberOfLines:1,center:!0,children:p})}),l?(0,v.jsx)(n.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:`Signed in as ${l.name}. Car sign-in options.`,onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:T.colours.gold,flexShrink:0},children:(0,v.jsxs)(y.T,{size:13,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,children:[l.name.replace(' (example)','')," \u25be"]})}):null,(0,v.jsx)(B.CarGameButton,{})]})}function H({go:e}){const{rid:t,now:n}=(0,f.useCtx)(3e4),o=(0,x.useBookings)(t),l=(0,w.ymd)(n),a=(0,w.ymd)(new Date(n.getTime()-24192e5)),c=o.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=l).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),d=o.filter(e=>e.date===l&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,v.jsxs)(s.default,{testID:"car-noshows",style:{gap:10},children:[(0,v.jsx)(y.T,{center:!0,size:18,weight:"semibold",colour:T.colours.goldLight,children:c.length?`${c.length} no-show${1===c.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),d.length?(0,v.jsxs)(s.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:T.colours.amber,borderRadius:12,padding:12},children:[(0,v.jsx)(y.T,{center:!0,weight:"semibold",colour:T.colours.amber,children:"Running more than 15 minutes late"}),d.map(e=>(0,v.jsx)(y.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,v.jsx)(y.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,c.map(e=>(0,v.jsxs)(s.default,{style:{borderWidth:1,borderColor:T.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,v.jsx)(y.T,{center:!0,weight:"semibold",children:`${e.date===l?'Today':(0,w.niceDate)((0,w.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,v.jsx)(y.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,v.jsx)(y.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function L(){return(0,v.jsxs)(s.default,{testID:"car-no-mic",accessibilityLiveRegion:"polite",style:{gap:10,alignItems:'center',paddingVertical:24},children:[(0,v.jsx)(y.T,{center:!0,size:20,weight:"semibold",colour:T.colours.goldLight,children:"The Assistant needs the car\u2019s microphone"}),(0,v.jsx)(y.Muted,{center:!0,style:{maxWidth:520},children:"Sorry, this car\u2019s browser isn\u2019t letting the page use a microphone. For now, please use the Assistant in Managers on your phone."})]})}function O({id:e,go:t}){if('@bookings'===e)return(0,v.jsx)(d.Bookings,{go:t});if('@chat'===e)return(0,v.jsx)(u.Chat,{go:t});if('@noshows'===e)return(0,v.jsx)(H,{go:t});if('@orders'===e)return(0,v.jsx)(h.Orders,{});if('@forecast'===e)return(0,v.jsx)(b.Forecasts,{go:t});const n=(0,c.pageFor)(e);if(!n)return(0,v.jsx)(y.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const o=n.C;return(0,v.jsx)(o,{go:t})}},1470,[34,236,402,295,102,426,1278,1378,1395,1340,1135,1394,1392,1100,1041,794,848,865,827,985,2,840,1471,1472,1473,1474,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),e.railSizes=function(s,o){const l=s>=1600?168:s>=1200?136:120,t=Math.floor((o-44)/12),n=Math.max(44,Math.min(72,t-18));return{railW:l,per:t,circle:n,label:t>=80?13:t>=66?11:10,icon:Math.round(.46*n)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return o}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}];const o=s=>s.split('').join(' ')},1471,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGlyph=function({name:e,size:x,colour:n}){const c={stroke:n,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'},l={rota:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h3M14 14h3M7 17h3",...c})]}),signoff:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...c}),(0,h.jsx)(s.Path,{d:"M12 7v5l3 2",...c}),(0,h.jsx)(s.Path,{d:"M15.5 18.5l1.8 1.8 3.4-3.6",...c})]}),menu:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M6 3v8a2 2 0 0 0 2 2v8M10 3v8a2 2 0 0 1-2 2M8 3v6",...c}),(0,h.jsx)(s.Path,{d:"M16 21V3c2.5 1.5 3 5 3 8h-3",...c})]}),bookings:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...c})]}),noshow:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...c}),(0,h.jsx)(s.Path,{d:"M3 21c0-4 3-6 7-6s7 2 7 6M17 9l4 4M21 9l-4 4",...c})]}),chat:(0,h.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...c}),stock:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M3 7l9-4 9 4-9 4z",...c}),(0,h.jsx)(s.Path,{d:"M3 7v10l9 4 9-4V7M12 11v10",...c})]}),loyalty:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"2",...c}),(0,h.jsx)(s.Circle,{cx:"8",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"16",cy:"12",r:"1.5",...c})]}),takings:(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...c})}),safety:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M10 14V5a2 2 0 0 1 4 0v9a4 4 0 1 1-4 0z",...c}),(0,h.jsx)(s.Path,{d:"M12 9v7",...c})]}),reviews:(0,h.jsx)(s.Path,{d:"M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z",...c}),assistant:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",...c}),(0,h.jsx)(s.Path,{d:"M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6",...c})]})};return(0,h.jsx)(t.default,{width:x,height:x,viewBox:"0 0 24 24",children:l[e]})},_e.GameGlyph=function({size:e,colour:x}){const n={stroke:x,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,h.jsxs)(t.default,{width:e,height:e,viewBox:"0 0 24 24",children:[(0,h.jsx)(s.Path,{d:"M7 8h10a4 4 0 0 1 4 4v3a3 3 0 0 1-5.4 1.8L14.5 15h-5l-1.1 1.8A3 3 0 0 1 3 15v-3a4 4 0 0 1 4-4z",...n}),(0,h.jsx)(s.Path,{d:"M7 11v3M5.5 12.5h3",...n}),(0,h.jsx)(s.Circle,{cx:"16",cy:"11.5",r:"0.9",...n}),(0,h.jsx)(s.Circle,{cx:"18",cy:"13.5",r:"0.9",...n})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},h=r(d[2])},1472,[34,900,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1473,[34,102,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGameButton=function(){const e=(0,c.useStore)(e=>!1!==e.restaurants.find(e=>e.id===y.VENUE_RID)?.settings?.games),C=(0,f.useSession)(e=>e.meId),_=(0,b.useSignedIn)(),[p,G]=(0,n.useState)(!1),[I]=(0,n.useState)(()=>new Date),S=(0,l.useGameClock)(C,p?new Date:I);return e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(t.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>G(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:j.colours.gold,flexShrink:0},children:(0,x.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6},children:[(0,x.jsx)(o.GameGlyph,{size:18,colour:j.colours.gold}),(0,x.jsx)(h.T,{size:13,weight:"semibold",colour:j.colours.gold,center:!0,numberOfLines:1,children:"Game"})]})}),p?(0,x.jsx)(l.BreakRoom,{car:!0,staffId:C??null,name:_?.name??'Owner',playable:(0,u.gamePlayable)(S),clock:S,onClose:()=>G(!1)}):null]}):null};var n=r(d[0]),t=e(r(d[1])),s=e(r(d[2])),o=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),f=r(d[7]),b=r(d[8]),y=r(d[9]),h=r(d[10]),j=r(d[11]),x=r(d[12])},1474,[34,402,102,1472,1137,1138,800,997,1100,5,794,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1475,[30,34,846,1476,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1476,[1379,1477,798,991,1073,1427,1160,1040,1041,1428,1451,1430,1130,977,1042,2,1047,1048,1404,993,34,1132,1185,1189,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1340,1070,1085,1086,1082,1043,1025,1100,1422,1417,1436,1478,1348,997,236,1191,1145,1151,1377,1155,1154,1391,1148,15,1161,1162,899,793,985,25]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1477,[34,102,794,1100,985,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1478,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); -__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]})}},1479,[30,34,846,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1480,[1373,985,795,1334,1481,1011,30,1508,496,34,385,336,236,41,102,5,847,846,1510,36,848,1014,865,840,1348,997,1010,1511,1512,1513,1514,1099,2,1024,1516,1303,25,1517,1518,1519,1520]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1481,[1482,1505,1507]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1482,[215,1483,1486,1500,1501,1502,1503,1504]); -__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1483,[215,1484]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1484,[1485]); -__d(function(g,r,i,a,m,e,d){},1485,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1486,[1487,215,1483,1500,1501]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1487,[1488,1489,1499]); -__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1488,[1489,1493,1498]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1489,[215,372,1490,1494,1495,1496,1497,1493,1498]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1490,[215,1491,339,280,1492,1493]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1491,[504]); -__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1492,[215,339]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1493,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1494,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1495,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1496,[1494]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1497,[]); -__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1498,[372,1492]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1499,[34,1489]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1500,[1487,215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1501,[1487,1500]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1502,[1483]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1503,[215,1483,1486,1484]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1504,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1505,[215,54,1506]); -__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1506,[215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1507,[34,1482]); -__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]}})})},1508,[1509]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1509,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1510,[34,41,102,426,794,847,997,985,2,5,840,1471,1473,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1511,[986,857,856,985]); -__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1512,[798,796,34,1380,1015,402,102,846,985,1007,1014,5,840,794,1286,974,2,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1513,[796,34,236,402,102,840,985,1045,2,25]); -__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1514,[5,796,34,385,283,364,380,236,402,295,426,102,1410,1116,2,900,1100,15,865,794,840,1441,930,1515,1439,1440,1400,1117,1408,929,1462,1449,25,277]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1515,[865,800,1014]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=f(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),A=[],k=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);i.includes(c)||(A.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0}),d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:u(d,23.5)}:void 0}):d===y&&e<=m&&k.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:u(d,e-.05),inSite:!0}))}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!A.some(e=>e.staffId===t.staffId&&e.date===t.date)),...A],attendance:[...S.attendance,...k]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:u(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:u((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',f=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,u=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1516,[848,800,865,1024,15,997,846]); -__d(function(e,o,s,p,t,n,a){"use strict";t.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1517,[]); -__d(function(o,e,s,p,t,c,d){"use strict";t.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1518,[]); -__d(function(o,e,s,p,t,d,f){"use strict";t.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1519,[]); -__d(function(o,s,e,p,d,t,n){"use strict";d.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1520,[]); -__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]})}},1521,[30,34,846,25]); -__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1522,[1523]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1523,[25,1524,591]); -__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1524,[34,172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1525,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1526,[25,499,34,270,651]); +__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]})}},1337,[30,34,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1338,[30,34,1339,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1339,[34,846,1340,1473,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnerApp=function(){return(0,ie.isDesktop)()?(0,de.jsx)(le.DesktopShell,{}):(0,de.jsx)(he,{})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),n=_r(d[3]),r=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),x=_r(d[13]),j=e(_r(d[14])),w=e(_r(d[15])),y=e(_r(d[16])),S=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),I=_r(d[24]),L=_r(d[25]),E=_r(d[26]),B=_r(d[27]),O=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var M=_r(d[33]),H=_r(d[34]),V=_r(d[35]),D=_r(d[36]),W=_r(d[37]),$=_r(d[38]),z=_r(d[39]),U=_r(d[40]),F=_r(d[41]),G=_r(d[42]),K=_r(d[43]),Y=_r(d[44]);_r(d[45]);var q=_r(d[46]),J=_r(d[47]),Q=_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]),ne=_r(d[55]),re=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]),de=_r(d[60]);const ce=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ue=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:I.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],fe={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function he(){const{rid:e,r:ie,role:le,today:he,now:ge,meId:me,me:pe}=(0,O.useCtx)(3e4);(0,h.useTipsPosted)(e,he,'staff'!==le);const be=(0,O.useSignedIn)();(0,l.useSoldOutLink)(!0,(be?.name??pe).replace(' (example)',''));const xe=(0,T.useOrders)(e),[je,we]=(0,x.useState)('home'),[ye,Se]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Te=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,O.ensureAttendance)(he,ge),(0,J.ensureChat)(ge)},[he]),globalThis.__ccNow=ge.getTime();const Ie=(0,J.useChatUnread)().total,Le=(0,x.useRef)({t:'home',s:null});Le.current={t:je,s:ye};const Ee=(0,x.useRef)([]),Be=(0,a.useScrollMemory)(Te),Oe=(0,x.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.s===s||(Ee.current=[...Ee.current,{...t,y:Be.leave()}].slice(-30),Be.restore(0)),we(e),Se(s)},[]),Pe=(0,x.useCallback)(()=>{if((0,c.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Be.leave(),we(t.t),Se(t.s),Be.restore(t.y??0),!0},[]);(0,c.useWebBack)(Pe);const Ne=(0,c.useInnerBackShown)();(0,x.useEffect)(()=>(oe.useVoiceNav.setState({go:Oe}),()=>oe.useVoiceNav.setState({go:null})),[Oe]),(0,x.useEffect)(()=>{u.PITCH&&(globalThis.__pitchGo=Oe)},[Oe]),(0,x.useEffect)(()=>{const e=j.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ue.find(e=>e.id===je);e?.can&&!e.can(le)&&Oe('home');const s=(0,K.pageFor)(ye);s?.can&&!s.can(le)&&Se(null)},[le]);const Me='more'===je?(0,K.pageFor)(ye):void 0,He=xe.filter(e=>(0,B.LIVE)(e)&&'new'===e.status).length,{unread:Ve,list:De,read:We}=(0,q.useNotifications)();(0,se.useAlertWatcher)(e,{nag:'staff'!==le}),(0,te.useReviewAlerts)(e),(0,ne.useScheduledNotices)({rid:e,staffId:be?.id??'',name:pe,onOpen:()=>Oe('more','orderlists')}),(0,re.useOffRotaAlerts)({enabled:'staff'!==le&&!!be});const $e=be?.role??le,ze='owner'===$e?'OWNER':'manager'===$e?'MANAGER':'STAFF',Ue=(0,se.useAlerts)(s=>s.history.filter(t=>t.rid===e&&(0,se.isUnread)(s,t)&&!(0,se.isCleared)(s,t)&&t.at>(s.seenAt[e]??0)).length),Fe=(0,se.useAlerts)(s=>s.todoSeen[e]),Ge=Math.max(0,Ve-De.filter(e=>!We[e.id]&&(Fe??[]).includes(e.id)).length)+Ue;(0,se.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:Ge})},[Ge]);const Ke=(0,T.useBookings)(e).filter(e=>'pending'===e.status).length,Ye=s.IS_ISOLATED_VENUE?[{id:e,name:ie.name,place:ie.location||ie.address||''}]:ce,qe=Ye.find(s=>s.id===e)??Ye[0],Je=be?.ownerAccess&&'owner'!==be.role?'owner privileges':be?.managerAccess&&'staff'===be.role?'manager privileges':'',Qe=(0,H.ownerHomeLayout)(le,be);(0,A.default)().width;return(0,de.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:L.colours.bg},edges:['top','left','right','bottom'],children:[(0,de.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:L.colours.border,gap:6},children:[(0,de.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Oe('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(U.Icon,{name:"search",colour:L.colours.text})}),(0,de.jsx)(y.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:Ge?`Notifications, ${Ge} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Oe('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,de.jsxs)(k.default,{children:[(0,de.jsx)(U.Icon,{name:"bell",colour:L.colours.text}),Ge?(0,de.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:L.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,de.jsx)(C.T,{size:10,weight:"bold",children:Ge})}):null]})}),(0,de.jsx)(X.VoiceSlot,{size:44})]}),(0,de.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,de.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,de.jsx)(y.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${pe}. Account and role${Je?`, ${Je}`:''}`,disabled:'owner'!==V.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,de.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,de.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,de.jsxs)(k.default,{style:{flexShrink:1},children:[(0,de.jsxs)(C.T,{size:13,weight:"semibold",colour:L.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[be?`${pe} \xb7 ${be.level??I.ROLE_LABEL[be.role]}`:`${pe} \xb7 ${I.ROLE_LABEL[le]}`,'owner'===V.APP_VARIANT?' \u25be':'']}),Je?(0,de.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:Je}):null]})]})})})}),(0,de.jsx)(y.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,de.jsx)(v.VenueHeaderBlock,{rid:e,name:ie.name,badge:ze,place:`${'staff'===le?'Staff preview \xb7 ':'Managers \xb7 '}${qe.place}`})}),le!==(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner')&&'owner'===V.APP_VARIANT?(0,de.jsx)(y.default,{onPress:()=>I.useOwner.getState().setPreviewRole(be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,de.jsx)(C.T,{size:12,colour:L.colours.gold,children:'staff'===le?`Staff app preview: what staff see in the Staff app. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`:`Previewing the ${I.ROLE_LABEL[le].toLowerCase()} view. Tap to return to ${I.ROLE_LABEL[be?.ownerAccess?'owner':be?.managerAccess?'manager':be?.role??'owner']}.`})}):null]}),(0,de.jsxs)(S.default,{ref:Te,...Be.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,de.jsx)(c.BackTitleRow,{back:!('home'===je&&!ye||Ne),onBack:Pe,title:Me?Me.title:'staff'===le&&'home'===je?'Staff app preview':fe[je]}),'home'===je&&be&&'staff'===be.role&&'owner'===V.APP_VARIANT?(0,de.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:L.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",colour:L.colours.gold,children:"Your manager access is off"}),(0,de.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,de.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Oe('more','clock')})]}):null,'home'!==je||Qe?null:(0,de.jsx)(r.WhoBar,{}),'home'===je&&!Qe&&be?(0,de.jsx)(ae.MyShiftCard,{go:Oe}):null,'home'===je&&!Qe&&be?(0,de.jsx)(f.MyTasksToday,{rid:e,staffId:be.id,name:be.name,onShift:(0,p.shiftNow)(be.id,Date.now()).on}):null,'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TodaysTipsCard,{rid:e,today:he}),'home'!==je||Qe||'staff'===le?null:(0,de.jsx)(h.TipsPotCard,{rid:e,today:he}),'home'===je?'staff'===le?(0,de.jsx)($.StaffHome,{go:Oe}):(0,de.jsx)(M.Dashboard,{go:Oe,ownerHome:Qe}):null,'orders'===je?(0,de.jsx)(Y.Orders,{}):null,'bookings'===je?(0,de.jsx)(E.Bookings,{go:Oe}):null,'forecast'===je?(0,de.jsx)(z.Forecasts,{go:Oe}):null,'chat'===je?(0,de.jsx)(J.Chat,{go:Oe}):null,'more'===je?Me?(0,de.jsx)(Me.C,{go:Oe}):(0,de.jsx)(K.MoreMenu,{go:Oe}):null]}),(0,de.jsx)(b.SeatAllergenReminder,{rid:e}),'staff'!==le?(0,de.jsx)(ee.PrintHost,{rid:e}):null,'staff'!==le?(0,de.jsx)(Z.AlertHost,{variant:"managers",rid:e,me:pe,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,de.jsx)(Q.AssistantSheet,{}),(0,de.jsx)(F.BottomTabs,{background:(0,t.soutersSurface)('#0d0d0d'),active:je,onPress:e=>Oe(e),tabs:ue.filter(e=>!e.can||e.can(le)).map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ie?{text:String(Ie),bg:L.colours.red}:'bookings'===e.id&&Ke?{text:String(Ke),bg:L.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&He?{text:String(He),bg:L.colours.red}:null}))}),(0,de.jsx)(w.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ye.filter(e=>!Re||'saltmarsh'!==e.id).map(s=>(0,de.jsx)(y.default,{accessibilityRole:"button",onPress:()=>{I.useOwner.getState().setSite(s.id),ke(!1),Oe('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:s.id===e?L.colours.gold:L.colours.border},children:(0,de.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,de.jsxs)(k.default,{children:[(0,de.jsx)(C.T,{weight:"medium",children:s.name}),(0,de.jsx)(C.Muted,{children:s.place})]}),s.id===e?(0,de.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},s.id)),(0,de.jsx)(C.Muted,{children:s.IS_ISOLATED_VENUE?`This app belongs only to ${ie.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,de.jsx)(w.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,de.jsx)(y.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,de.jsxs)(k.default,{style:{backgroundColor:L.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[be?(0,de.jsxs)(C.Row,{gap:10,children:[(0,de.jsx)(_.StaffAvatar,{id:be.id,size:44}),(0,de.jsxs)(k.default,{style:{flex:1},children:[(0,de.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",be.name]}),(0,de.jsx)(C.Muted,{children:(0,N.levelJob)(be.level??I.ROLE_LABEL[be.role],be.job)})]})]}):(0,de.jsxs)(k.default,{style:{gap:6},children:[(0,de.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,de.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,de.jsx)(P.SignInWithLink,{})]}),s.IS_QUEUED_VENUE||s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_GREENSIDE||!be?null:(0,de.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=s.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():s.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,de.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!be||(0,O.clampRole)(e,be.ownerAccess?'owner':be.managerAccess?'manager':be.role)===e).map(e=>(0,de.jsx)(C.Button,{kind:e===le?'primary':'secondary',label:'staff'===e?'Staff app preview':`${I.ROLE_LABEL[e]} view`,onPress:()=>{I.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,de.jsx)(D.OnboardingHost,{go:Oe}),(0,de.jsx)(W.CoachHost,{})]})}},1340,[5,798,985,1173,1161,1040,977,1041,2,1047,1048,1070,1087,34,373,395,402,295,426,102,36,794,847,848,865,840,1341,1147,1100,899,1349,997,236,1356,13,846,1385,1391,1392,1393,1153,1192,1394,1379,1395,1396,1377,1135,1413,1116,1175,1311,1177,1190,1401,1085,1086,1160,1463,1464,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1341,[5,1342,11,1343,796,806,1112,1113,1091,1115,1114,1328,1329,1100,1282,1012,1089,14,1344,1186,1345,1316,1081,1075,1090,34,102,794,1291,848,830,836,827,1267,840,1147,1096,1014,1346,1347,1136,1348,1177,985,1149,1324,852,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1342,[34,794,25]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1343,[6,34,102,794,985,1215,25]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1344,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1345,[34,402,1143,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1346,[34,102,848,1014,794,840,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1347,[34,402,102,794,840,25]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1348,[34,102,853,848,833,840,794,25]); +__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1349,[5,1350,1351,1352,1353,1354,34,236,41,102,846,997,840,1355,794,985,2,1072,996,865,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1350,[34,102,847,794,5,6,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1351,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1352,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1353,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1354,[34,102,847,794,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1355,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:a=!1}){const{rid:n,r:b,now:O,role:te,me:le,today:oe}=(0,S.useCtx)(5e3),ae=(0,p.useOrders)(n),ne=(0,p.useBookings)(n),ie=(0,p.useWaitlist)(n),de=(0,p.useEvents)(n),ue=(0,p.useRatings)(n),he=(0,k.useOwner)(e=>e.staff),ge=(0,k.useOwner)(e=>e.attendance),xe=(0,k.useOwner)(e=>e.shifts),ye=(0,P.useRealHistory)(n,O),be=(0,o.useMemo)(()=>(0,t.forecastToday)(b,ne,ae,de,O,ye??void 0),[b,ne,ae,de,ye,O.getTime()/6e4|0]),fe=(0,N.useExamples)(),me=(0,M.useCashUp)(e=>e.cashUps),je=ne.filter(e=>e.date===oe),pe=ae.filter(A.LIVE),ke=ie.filter(e=>'waiting'===e.status||'notified'===e.status),we=je.filter(e=>['seated','finished'].includes((0,T.shownStatus)(e))).reduce((e,s)=>e+s.partySize,0),$e=(0,ee.coversSplit)(je,oe),ve=$e.walkIns,Ce=$e.bookings,Ie=pe.filter(e=>(0,G.chainNeedsAction)(e,ne)),Te=je.filter(e=>['confirmed','seated'].includes(e.status)&&(0,G.bookingNeedsAction)(e,pe)),Be=pe.flatMap(e=>(0,C.readinessFor)(e,b,O).map(s=>({...s,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),De=be.nextHour,Ae=(0,A.busyLevel)(De?.coversHigh??0,be.busy.busy),Se=(0,A.restOfDayLevel)(be,b),Le=ae.filter(e=>e.paid>0).reduce((e,s)=>e+s.paid,0)+(fe?186e3:0),Pe=(0,I.ymd)(new Date(O.getTime()-6048e5)),Ne=me.find(e=>e.rid===n&&e.date===Pe),Me=Ne?(0,F.takings)(Ne.vals):null,Fe=fe?(0,L.revenueHistory)(b,O,7).filter(e=>e.date.getDay()===O.getDay()).pop():null!=Me?{date:(0,I.parseYmd)(Pe),total:Math.round(100*Me)}:void 0,Oe=(0,o.useMemo)(()=>(0,L.insights)(b,ne,ae,de,ue,O,we),[b.id,ne.length,ue.length,we]),Re=((0,S.weekday)(O),ge.filter(e=>e.date===oe&&e.in&&!e.out)),He=(0,X.useFrontDoor)(oe),We=(0,h.useBookingWrite)(),Ee=(0,w.useOutstanding)(),ze=(0,r.useTravelDay)('owner',oe),Ge=(0,S.useSignedIn)(),Ue=(0,S.useInStaffApp)(),qe=(0,F.canSeeMonthTakings)(te,Ge,{inStaffApp:Ue,live:(0,H.isLive)()}),Ye=(0,R.homeSetupNagsHidden)(n),Ke=(0,k.useOwner)(e=>e.socialPosts.reduce((e,s)=>e+('awaiting approval'===s.status?1:0),0)),[Qe,Ve]=(0,o.useState)(!1),Xe=le.replace(' (example)',''),Ze=k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return ze?(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(r.DayView,{rid:n,day:ze,today:oe,app:"owner"})]}):a?(0,se.jsxs)(m.default,{style:{gap:12},testID:"owner-home",children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),k.CAN.takings(te)?(0,se.jsx)(j.Row,{wrap:!0,gap:10,children:(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})})}):null,(0,se.jsx)(Q.TodaysTipsCard,{rid:n,today:oe}),(0,se.jsx)(Q.TipsPotCard,{rid:n,today:oe}),k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(Y.WhoBar,{}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ge&&'owner'!==Ge.role?(0,se.jsx)(_.MyShiftCard,{go:e}):null,Ge?(0,se.jsx)(K.MyTasksToday,{rid:n,staffId:Ge.id,name:Ge.name,onShift:(0,V.shiftNow)(Ge.id,Date.now()).on}):null,k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]}):(0,se.jsxs)(m.default,{style:{gap:12},children:[Ze,(0,se.jsx)(r.DayBar,{app:"owner",today:oe}),(0,se.jsx)(i.CoversToday,{rid:n,onPress:()=>e('bookings')}),(0,se.jsx)(ce,{split:$e}),(0,se.jsx)(Z.BlocksBanner,{rid:n,now:O,by:le}),(0,se.jsx)(y.KitchenSignoffs,{rid:n,today:oe,by:le,app:"owner",canConfirm:k.CAN.manage(te)}),qe?(0,se.jsx)(W.FadeIn,{children:(0,se.jsx)(re,{rid:n,today:oe})}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(U.SetupCard,{go:e}):null,k.CAN.manage(te)&&!Ye?(0,se.jsx)(l.SeasonsTodo,{go:e}):null,(0,se.jsx)(d.LastFoodBanner,{rid:n,now:O}),(0,se.jsx)(c.NextTableFreeCard,{rid:n,now:O}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:We.hint,disabled:!We.ok,onPress:()=>e('more','blocks')}):null,(0,se.jsx)(j.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ve(!0),style:{minHeight:56}}),(0,se.jsxs)(m.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,se.jsx)(u.QuietButton,{label:"New booking",onPress:He.openBooking,testID:"home-booking",disabled:!We.ok,accessibilityHint:We.hint}),k.CAN.manage(te)?(0,se.jsx)(Z.CloseGardenButton,{quiet:!0,short:!0,rid:n,r:b,now:O,by:le}):null]}),He.elements,k.CAN.manage(te)?(0,se.jsx)(q.PaydaysCard,{go:e}):null,(0,se.jsx)(W.FadeIn,{children:(0,se.jsxs)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center'},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",De?` \xb7 ${(0,S.fmtH)(De.hour)}\u2013${(0,S.fmtH)(De.hour+1)}`:'']}),be.example?(0,se.jsx)(P.ExampleBadge,{}):be.enough?(0,se.jsx)(j.Badge,{kind:"amber",label:"ESTIMATE"}):(0,se.jsx)(j.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,se.jsx)(W.Gauge,{pct:De?Ae.pct:0,label:De?Ae.label:be.open?'Kitchen closing':'Closed today',sub:De&&!be.enough?`${De.booked} booked${De.walkIns?` + ${De.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:De?`Estimated ${(0,t.coversRange)(De.coversLow,De.coversHigh)} \xb7 Busy at ${be.busy.busy} Covers an hour \xb7 ${De.booked} booked + about ${De.walkIns} walk-ins${(0,x.showTakeaway)(b)?` \xb7 about ${De.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,se.jsxs)(j.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[be.enough?(0,se.jsx)(j.Badge,{kind:"gold",label:`Rest of today: ${Se.level.label}${Se.peak?`, peak ${(0,S.fmtH)(Se.peak.hour)}`:''}`}):null,be.enough?(0,se.jsx)(j.Badge,{kind:"neutral",label:`${(0,t.coversRange)(be.restOfDay.low,be.restOfDay.high)}${(0,x.showTakeaway)(b)?` \xb7 about ${be.restOfDay.takeaway} takeaways`:''}`}):(0,se.jsx)(j.Badge,{kind:"neutral",label:`Booked so far: ${be.restOfDay.booked} Covers`})]}),be.flags.length?(0,se.jsxs)(j.Muted,{center:!0,children:["Calendar: ",be.flags.join(', ')]}):null,k.CAN.forecasts(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,se.jsxs)(j.Row,{wrap:!0,gap:10,children:[k.CAN.manage(te)?(0,se.jsx)(W.FadeIn,{delay:40,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{testID:"home-specials-board",label:"Specials board",value:"",accessibilityLabel:"Specials board. Opens the specials board.",onPress:()=>e('more','specialsboard'),sub:"Open the specials board"})}):null,(0,se.jsx)(W.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${we} seated (${ve} walk-in) \xb7 ${Ce} booked`,children:(0,se.jsx)(W.CountUp,{value:we})})}),(0,se.jsx)(W.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${je.filter(e=>['confirmed','pending'].includes((0,T.shownStatus)(e))).length} still to arrive`,children:(0,se.jsx)(W.CountUp,{value:je.length})})}),(0,x.showTakeaway)(b)||pe.length?(0,se.jsx)(W.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Live orders",value:"",accent:pe.some(e=>'new'===e.status)?D.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(b)?`${pe.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${pe.filter(e=>'table'===e.type).length} table`:`${pe.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,se.jsx)(W.CountUp,{value:pe.length})})}):null,ke.length>0?(0,se.jsx)(W.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ke.reduce((e,s)=>e+s.partySize,0)} Covers waiting`,children:(0,se.jsx)(W.CountUp,{value:ke.length})})}):null,k.CAN.takings(te)?(0,se.jsx)(W.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:fe?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:Fe?`Last ${(0,I.niceDate)(Fe.date).slice(0,3)}: ${(0,v.gbp)(Fe.total)}`:void 0,children:(0,se.jsx)(W.CountUp,{value:Le,format:e=>(0,v.gbp)(100*Math.round(e/100)).replace('.00','')})})}):null,(0,se.jsx)(W.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,se.jsx)(A.Tile,{label:"Allergy alerts",value:"",accent:Ie.length+Te.length?D.colours.red:D.colours.ok,sub:"Need a sign-off",children:(0,se.jsx)(W.CountUp,{value:Ie.length+Te.length,colour:Ie.length+Te.length?D.colours.red:D.colours.ok})})})]}),Ie.length+Te.length+Be.length?(0,se.jsx)(A.SectionHead,{title:"Needs action now"}):null,Ie.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.AllergyChain,{o:e,me:le,compact:!0})]},e.id)),Te.map(e=>(0,se.jsxs)(A.AlertBox,{colour:D.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,se.jsx)(j.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,se.jsx)(z.BookingAllergyChain,{b:e,me:le})]},e.id)),Be.map(s=>(0,se.jsxs)(A.AlertBox,{colour:'overdue'===s.state?D.colours.red:D.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,I.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,se.jsx)(j.T,{size:14,children:s.detail}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),k.CAN.manage(te)&&(Ee.days.length||Ee.requests)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`HOURS \xb7 ${Ee.days.length?`${Ee.days.length} earlier day${Ee.days.length>1?'s':''} to sign off`:''}${Ee.days.length&&Ee.requests?' \xb7 ':''}${Ee.requests?`${Ee.requests} correction request${Ee.requests>1?'s':''}`:''}`,children:[(0,se.jsx)(j.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Ke&&k.CAN.publishSocial(te)?(0,se.jsxs)(A.AlertBox,{colour:D.colours.amber,title:`SOCIAL \xb7 ${Ke} post${Ke>1?'s':''} awaiting approval`,children:[(0,se.jsx)(j.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,se.jsx)(A.SectionHead,{title:"Quick actions"}),(0,se.jsxs)(f.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:e?D.colours.goldTint:D.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,se.jsxs)(j.Row,{gap:4,children:[(0,se.jsx)(E.Mark,{p:"facebook"}),(0,se.jsx)(E.Mark,{p:"instagram"}),(0,se.jsx)(E.Mark,{p:"tiktok"}),(0,se.jsx)(E.Mark,{p:"youtube"})]}),(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"bold",children:"Post to social"}),(0,se.jsx)(j.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,se.jsx)(j.T,{colour:D.colours.gold,size:20,children:"\u203a"})]}),(0,se.jsx)(E.QuickLinksSection,{go:e,heading:e=>(0,se.jsx)(A.SectionHead,{title:e})}),(0,se.jsx)(A.SectionHead,{title:"Who\u2019s on now",right:(0,se.jsx)(j.Badge,{kind:"ok",label:`${Re.length} clocked in`})}),(0,se.jsxs)(j.Card,{children:[0===Re.length?(0,se.jsx)(j.Muted,{children:"Nobody clocked in yet."}):null,Re.map(e=>{const s=he.find(s=>s.id===e.staffId),t=(0,k.shiftOf)(xe,e.staffId,oe),l=new Date(e.in),o=!!t&&l.getHours()+l.getMinutes()/60-t.start>.08333333333333333;return(0,se.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,se.jsxs)(m.default,{style:{flex:1},children:[(0,se.jsx)(j.T,{weight:"semibold",children:s?.name??e.staffId}),(0,se.jsxs)(j.Muted,{children:[s?.job," \xb7 in ",(0,I.hm)(l),t?` \xb7 shift ${(0,S.fmtH)(t.start)}\u2013${(0,S.fmtH)(t.end)}`:' \xb7 unscheduled']})]}),o?(0,se.jsx)(j.Badge,{kind:"amber",label:"Late"}):(0,se.jsx)(j.Badge,{kind:"ok",label:"On site"})]},e.id)}),k.CAN.manage(te)?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),'staff'!==te?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(A.SectionHead,{title:"Insights",sub:fe?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Oe.slice(0,4).map((s,t)=>(0,se.jsx)(W.FadeIn,{delay:100+90*t,children:(0,se.jsxs)(j.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:D.colours.gold,red:D.colours.red,amber:D.colours.amber,ok:D.colours.ok,blue:D.colours.blue}[s.tone]},children:[(0,se.jsxs)(j.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,se.jsx)(j.Muted,{children:s.body}),s.action?(0,se.jsx)(j.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,se.jsx)(j.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null,(0,se.jsx)(J.SoldOutSheet,{visible:Qe,onClose:()=>Ve(!1),rid:n,by:Xe,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ie,_e.MonthTakingsCard=re,_e.WalkInSplitCard=ce;var s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),o=_r(_d[3]),a=_r(_d[4]),n=e(a),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),x=_r(_d[11]),y=_r(_d[12]),b=e(_r(_d[13])),f=e(_r(_d[14])),m=e(_r(_d[15])),j=_r(_d[16]),p=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),T=_r(_d[24]),B=_r(_d[25]),D=_r(_d[26]),A=_r(_d[27]),S=_r(_d[28]),L=_r(_d[29]),P=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),F=_r(_d[33]),O=_r(_d[34]),R=_r(_d[35]),H=_r(_d[36]),W=_r(_d[37]),E=_r(_d[38]),z=_r(_d[39]),G=_r(_d[40]),U=_r(_d[41]),q=_r(_d[42]),Y=_r(_d[43]),_=_r(_d[44]),K=_r(_d[45]),Q=_r(_d[46]),V=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]);const te=18,le=18,oe=150,ae=34;function ne(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const s=e.length,t=[],l=[];for(let l=0;l9){const n=3/Math.sqrt(a);l[e]=n*s*t[e],l[e+1]=n*o*t[e]}}let o=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let t=0;tte+(s-1)/Math.max(1,e-1)*t,o=[1,5,10,15,20,25].filter(s=>s=36)&&a.push(e);for(;a.length&&l(e)-l(a[a.length-1])<36;)a.pop();return[...a,e]}function re({rid:e,today:s}){const t=(0,M.useCashUp)(e=>e.cashUps),[l,i]=(0,o.useState)(s.slice(0,7)),[r,d]=(0,o.useState)(0),[c,u]=(0,o.useState)(null),h=(0,o.useMemo)(()=>(0,F.monthTakings)(t,e,l,s),[t,e,l,s]),x=(0,o.useMemo)(()=>(0,F.firstTakingsMonth)(t,e),[t,e]),y=!!x&&xte+(e-1)/Math.max(1,k-1)*w,I=e=>$-e/v*128,T=[];h.days.forEach((e,s)=>{if('recorded'!==e.state)return;const t={x:C(e.day),y:I(e.value)};s&&'recorded'===h.days[s-1].state?T[T.length-1].push(t):T.push([t])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),S=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===s):void 0)??A??B[B.length-1],L=e=>{const s=B.findIndex(e=>e.date===S?.date),t=B[Math.max(0,Math.min(B.length-1,s+e))];t&&(u(t.date),b.default.announceForAccessibility?.(P(t)))},P=e=>`${(0,F.longDay)(e.date)}, ${'recorded'===e.state?(0,F.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,N=h.current?`so far in ${h.month}`:`in ${h.month} ${l.slice(0,4)}`,R=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,F.monthName)((0,F.addMonths)(l,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,H=h.recorded?`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. ${(0,F.poundsWhole)(h.total)} ${N}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,F.longDay)(h.best.date)}, ${(0,F.poundsWhole)(h.best.value)}.${R?` ${R.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${l.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,W=r?ie(k,r):[],E=(e,s,t,o,a)=>(0,se.jsx)(f.default,{testID:a,accessibilityRole:"button",accessibilityLabel:s,accessibilityState:{disabled:!t},disabled:!t,onPress:()=>{i((0,F.addMonths)(l,o)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:t?e?.6:1:.25}),children:(0,se.jsx)(j.T,{size:24,colour:D.colours.gold,center:!0,children:e})});return(0,se.jsx)(j.Card,{highlight:D.colours.gold,style:{alignItems:'center',gap:6},children:(0,se.jsxs)(m.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,se.jsxs)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),y||p?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[E('\u2039',`Previous month, ${(0,F.monthName)((0,F.addMonths)(l,-1))}`,y,-1,'mt-prev'),(0,se.jsxs)(j.T,{center:!0,colour:D.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",l.slice(0,4)]}),E('\u203a',`Next month, ${(0,F.monthName)((0,F.addMonths)(l,1))}`,p,1,'mt-next')]}):null,(0,se.jsx)(m.default,{accessible:!0,accessibilityLabel:H,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(j.T,{size:38,weight:"bold",colour:D.colours.gold,center:!0,testID:"mt-total",children:(0,F.poundsWhole)(h.total)}),(0,se.jsx)(j.T,{center:!0,colour:D.colours.goldLight,children:N}),(0,se.jsxs)(j.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,F.shortDay)(h.best.date)," \xb7 ",(0,F.poundsWhole)(h.best.value)]}),R?(0,se.jsx)(j.Muted,{center:!0,testID:"mt-vs",children:R}):null]}):(0,se.jsx)(j.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,se.jsxs)(m.default,{style:{width:'100%',minWidth:0},children:[(0,se.jsxs)(m.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:oe,width:'100%',overflow:'visible'},children:[r?(0,se.jsxs)(n.default,{width:r,height:oe,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,se.jsx)(a.Defs,{children:(0,se.jsxs)(a.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,se.jsx)(a.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,se.jsx)(a.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,se.jsx)(a.Line,{x1:te,y1:$,x2:r-le,y2:$,stroke:D.colours.hairline,strokeWidth:1}),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:`${ne(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${s}`)),T.filter(e=>e.length>1).map((e,s)=>(0,se.jsx)(a.Path,{d:ne(e),stroke:D.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${s}`)),T.filter(e=>1===e.length).map((e,s)=>(0,se.jsx)(a.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:D.colours.gold},`s${s}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,se.jsx)(a.Circle,{cx:C(e.day),cy:$,r:2,fill:"none",stroke:D.colours.muted,strokeWidth:1},e.date)),S&&'recorded'===S.state?(0,se.jsx)(a.Line,{x1:C(S.day),y1:10,x2:C(S.day),y2:$,stroke:D.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===s);return(0,se.jsx)(a.Circle,{cx:C(e.day),cy:'recorded'===e.state?I(e.value):$,r:4.5,fill:D.colours.gold,stroke:D.colours.surface,strokeWidth:1.5})})():null,S&&'recorded'===S.state&&S.date!==s?(0,se.jsx)(a.Circle,{cx:C(S.day),cy:I(S.value),r:5,fill:D.colours.surface,stroke:D.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,se.jsx)(f.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:P(e),accessibilityState:{selected:S?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:oe,left:C(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,se.jsx)(m.default,{testID:"mt-axis",style:{height:O.AXIS_BAND+6,minHeight:O.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:W.map(e=>(0,se.jsx)(j.T,{size:O.AXIS_FONT,colour:D.colours.muted,style:{position:'absolute',left:C(e)-17,width:ae,top:0,textAlign:'center'},children:String(e)},e))})]}),S&&B.length?(0,se.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,se.jsx)(f.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===S.date,onPress:()=>L(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u2039"})}),(0,se.jsxs)(m.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:P(S),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,se.jsx)(j.Muted,{center:!0,children:S.date===s?`Today \xb7 ${(0,F.shortDay)(S.date)}`:(0,F.shortDay)(S.date)}),(0,se.jsx)(j.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===S.state?D.colours.goldLight:D.colours.muted,children:'recorded'===S.state?(0,F.poundsWhole)(S.value):'pending'===S.state?'Not cashed up yet':'No cash-up'})]}),(0,se.jsx)(f.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===S.date,onPress:()=>L(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===S.date?.25:e?.6:1}),children:(0,se.jsx)(j.T,{size:20,colour:D.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,se.jsx)(j.Muted,{center:!0,size:13,children:"From confirmed cash ups: gross takings, or card + cash. \u25cb = no cash up that day."})]})})}const de='#3A2F1E';function ce({split:e}){return(0,se.jsx)(j.Card,{style:{alignItems:'center',gap:8},children:(0,se.jsxs)(m.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,se.jsx)(j.T,{weight:"semibold",colour:D.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,se.jsx)(j.Muted,{center:!0,children:"No Covers yet"}):(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",colour:D.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,se.jsxs)(m.default,{style:{alignItems:'center',minWidth:120},children:[(0,se.jsx)(j.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,se.jsx)(j.T,{size:14,colour:D.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,se.jsxs)(m.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:de,borderWidth:1,borderColor:D.colours.gold},children:[(0,se.jsx)(m.default,{style:{width:`${e.walkInPct}%`,backgroundColor:D.colours.gold}}),(0,se.jsx)(m.default,{style:{flex:1,backgroundColor:de}})]})]})]})})}},1356,[829,1120,1357,34,900,1073,1148,1077,1078,1345,1282,851,1081,281,402,102,794,848,865,1157,830,836,1134,827,1075,855,840,1147,1100,1119,1125,1126,1024,13,1325,925,985,1366,1367,1136,838,1370,1151,1161,1160,1047,1048,1070,1096,1316,1130,1281,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:m,rid:L,today:P,me:O}=(0,R.useCtx)(6e4),Y=O.replace(" (example)",""),Z=m.settings,J=e=>k.useStore.getState().updateSettings(L,e),[X,se]=(0,b.useState)(()=>(0,d.takeAdvancedPrefill)()),[te,oe]=(0,b.useState)(null),ae=e=>{if(e.onReset)return e.onReset(),void oe(`${e.title}: back to the defaults.`);J(Object.fromEntries(e.reset.map(e=>[e,void 0]))),oe(`${e.title}: back to the defaults.`)},ne=(0,D.useBookings)(L),le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,N.jsx)(y.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,N.jsx)(y.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,N.jsx)(y.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,S.dogQuestionOn)(m),onChange:e=>J({dogQuestion:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,N.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:Z.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>J({maxDogsPerSlot:e||void 0})})]}),(0,N.jsx)(y.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,S.accessQuestionOn)(m),onChange:e=>J({accessQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,S.dietQuestionOn)(m),onChange:e=>J({dietQuestion:e})}),(0,N.jsx)(y.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==Z.tableRequests,onChange:e=>J({tableRequests:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),re=(0,S.dwellBands)(m),ie=(e,s)=>J({dwellBands:re.map((t,o)=>o===e?{...t,mins:s}:t)}),de=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),re.map((e,s)=>{const t=(0,S.dwellFor)(m,9999===e.upTo?20:e.upTo,ne);return(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{style:{flex:1},children:(0,S.bandLabel)(re,s)}),(0,N.jsx)(K,{label:`table time for ${(0,S.bandLabel)(re,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>ie(s,e)})]}),t.learned&&t.mins!==e.mins?(0,N.jsxs)(y.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,N.jsx)(y.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==Z.dwellLearn,onChange:e=>J({dwellLearn:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),he=Z.reservables??(0,C.reservablesOf)(m),ue=Z.reservables??('anchorage'===L?he:[]),ce=(e,s)=>J({reservables:ue.map(t=>t.id===e?{...t,...s}:t)}),pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[ue.length?ue.map(e=>(0,N.jsxs)(f.default,{style:{gap:4},children:[(0,N.jsx)(y.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>ce(e.id,{active:s})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.Muted,{children:"Price"}),(0,N.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>ce(e.id,{price:100*s})})]}),(0,N.jsxs)(y.Muted,{size:12,children:["Uses: ",e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')," from the counted stock. Held from the Display count and shown as \u201cReserved\u201d."]})]},e.id)):(0,N.jsx)(y.Muted,{children:"No reservable dishes yet."}),(0,N.jsx)(y.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==Z.reserveStock,onChange:e=>J({reserveStock:e})}),(0,N.jsx)(y.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),ge=(0,S.regularEventsOf)(m),[be,me]=(0,b.useState)(null),xe=e=>J({regularEvents:e}),fe=be?be.name.trim()?be.time&&!W.test(be.time)?'Start time looks wrong (use 20:00).':be.lastFood&&!W.test(be.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==be.rule.kind||U.test(be.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',ye=(0,N.jsxs)(f.default,{style:{gap:8},children:[ge.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,N.jsx)(y.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,N.jsx)(y.Badge,{kind:"neutral",label:"OFF"})]}),(0,N.jsxs)(y.Muted,{children:[(0,S.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,N.jsxs)(y.Muted,{size:12,children:["Next: ",(0,S.nextOccurrence)(e,P)??'\u2014']}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>me({...e})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>xe(ge.filter(s=>s.id!==e.id))})]})]},e.id)),be?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Name"}),(0,N.jsx)(q,{label:"Event name",width:220,value:be.name,onChange:e=>me({...be,name:e}),placeholder:"Open Mic Night"})]}),(0,N.jsx)(y.Muted,{children:"Repeats"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(y.Chip,{label:"Last \u2026 of the month",selected:'last'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'last',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"Every week",selected:'weekly'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'weekly',weekday:'weekday'in be.rule?be.rule.weekday:0}})}),(0,N.jsx)(y.Chip,{label:"One-off date",selected:'once'===be.rule.kind,onPress:()=>me({...be,rule:{kind:'once',date:P}})})]}),'weekday'in be.rule?(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:_.map(e=>(0,N.jsx)(y.Chip,{label:G[e],selected:be.rule.weekday===e,onPress:()=>me({...be,rule:{...be.rule,weekday:e}})},e))}):(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Event date",width:130,value:be.rule.date,onChange:e=>me({...be,rule:{kind:'once',date:e}}),placeholder:"2026-12-31"})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts (optional)"}),(0,N.jsx)(q,{label:"Start time",value:be.time??'',onChange:e=>me({...be,time:e||void 0}),placeholder:"20:00",bad:!!be.time&&!W.test(be.time)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Last food orders (optional)"}),(0,N.jsx)(q,{label:"Last food orders",value:be.lastFood??'',onChange:e=>me({...be,lastFood:e||void 0}),placeholder:"19:00",bad:!!be.lastFood&&!W.test(be.lastFood)})]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Notes"}),(0,N.jsx)(q,{label:"Notes",width:240,value:be.notes??'',onChange:e=>me({...be,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,N.jsx)(y.Toggle,{label:"Expect busier (raises the forecast)",value:be.busier,onChange:e=>me({...be,busier:e})}),(0,N.jsx)(y.Toggle,{label:"On",value:be.active,onChange:e=>me({...be,active:e})}),fe?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:fe}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save event",disabled:!!fe,testID:"event-save",onPress:()=>{const e={...be,name:be.name.trim()};xe(ge.some(s=>s.id===e.id)?ge.map(s=>s.id===e.id?e:s):[...ge,e]),me(null),oe(`Saved ${e.name}.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>me(null)})]})]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>me({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,N.jsx)(y.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),je=(0,v.hourSetsOf)(m),we=(0,v.seasonOn)(m,new Date),[ke,ve]=(0,b.useState)(null),[Ce,Se]=(0,b.useState)(null),Te=Z.hourOverrides??[],Re=ke?ke.start&&!H.test(ke.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ke.hours&&Object.values(ke.hours).some(e=>e&&(!W.test(e[0])||!W.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',De=Object.values(Z.lastFoodByDay??{}).some(e=>e&&!W.test(e)),Me=[];je.some(e=>!e.hours)&&Me.push(`${je.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);je.filter(e=>e.hours).length>=1&&je.length>1&&je.some(e=>!e.start)&&Me.push('the date each season starts');const Le=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Me.length?(0,N.jsxs)(y.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Me.join(' and '),". Until then the app uses ",we?.name??'your weekly'," hours all year."]}):null,we?(0,N.jsxs)(y.T,{colour:T.colours.goldLight,children:["In use today: ",we.name]}):null,je.map(e=>(0,N.jsxs)(y.Card,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",children:e.name}),we?.id===e.id?(0,N.jsx)(y.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,N.jsx)(y.Badge,{kind:"amber",label:"NOT SET"})]}),(0,N.jsx)(y.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,N.jsx)(y.Muted,{size:13,children:_.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,N.jsx)(y.Muted,{size:13,children:"No hours yet."}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>ve({...e,hours:e.hours?{...e.hours}:{...je.find(e=>e.hours)?.hours??m.kitchenHours}})})]},e.id)),ke?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.T,{weight:"semibold",children:[ke.name," hours"]}),(0,N.jsxs)(y.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Muted,{children:"Starts every year on (MM-DD)"}),(0,N.jsx)(q,{label:"Season start date",value:ke.start??'',onChange:e=>ve({...ke,start:e||void 0}),placeholder:"04-01",bad:!!ke.start&&!H.test(ke.start)})]}),_.map(e=>{const s=ke.hours?.[e]??null,t=s=>ve({...ke,hours:{...ke.hours,[e]:s}});return(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.T,{style:{width:44},children:G[e]}),(0,N.jsx)(y.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:`${S.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!W.test(s[0])}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!W.test(s[1])||s[0]>=s[1]})]}):null]},e)}),Re?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:Re}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save hours",disabled:!!Re,testID:"season-save",onPress:()=>{var e;e=je.map(e=>e.id===ke.id?ke:e),J({hourSets:e}),ve(null),oe(`Saved ${ke.name} hours.`)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ve(null)})]})]}):null,(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,N.jsx)(y.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Te.map(e=>(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(y.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>J({hourOverrides:Te.filter(s=>s.date!==e.date)})})]},e.date)),Ce?(0,N.jsxs)(y.Card,{highlight:T.colours.gold,children:[(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Date"}),(0,N.jsx)(q,{label:"Special day date",width:130,value:Ce.date,onChange:e=>Se({...Ce,date:e}),placeholder:"2026-12-31",bad:!U.test(Ce.date)})]}),(0,N.jsxs)(y.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,N.jsx)(y.Chip,{label:Ce.hours?'Open':'Closed',selected:!!Ce.hours,onPress:()=>Se({...Ce,hours:Ce.hours?null:['12:00','19:00']})}),Ce.hours?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(q,{label:"Opens",width:74,value:Ce.hours[0],onChange:e=>Se({...Ce,hours:[e,Ce.hours[1]]})}),(0,N.jsx)(y.Muted,{children:"to"}),(0,N.jsx)(q,{label:"Last food orders",width:74,value:Ce.hours[1],onChange:e=>Se({...Ce,hours:[Ce.hours[0],e]})})]}):null]}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.Muted,{children:"Note"}),(0,N.jsx)(q,{label:"Note",width:220,value:Ce.note??'',onChange:e=>Se({...Ce,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=U.test(Ce.date)?Ce.hours&&(!W.test(Ce.hours[0])||!W.test(Ce.hours[1])||Ce.hours[0]>=Ce.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,N.jsxs)(N.Fragment,{children:[e?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:e}):null,(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{J({hourOverrides:[...Te.filter(e=>e.date!==Ce.date),Ce].sort((e,s)=>e.date.localeCompare(s.date))}),Se(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Se(null)})]})]})})()]}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Se({date:P,hours:null})}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,N.jsx)(y.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:_.map(e=>(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.Muted,{size:12,children:G[e]}),(0,N.jsx)(q,{label:`${S.DAYS[e]} last food orders`,width:74,value:Z.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!Z.lastFoodByDay?.[e]&&!W.test(Z.lastFoodByDay[e]),onChange:s=>J({lastFoodByDay:{...Z.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),De?(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,N.jsx)(y.Muted,{children:"After last food orders, booking times are\u2026"}),(0,N.jsxs)(y.Row,{gap:6,children:[(0,N.jsx)(y.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'drinks'})}),(0,N.jsx)(y.Chip,{label:"Not offered",selected:'block'===(0,S.afterLastFood)(m),onPress:()=>J({afterLastFood:'block'})})]})]}),Pe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,S.coversCounterOn)(m),onChange:e=>J({coversCounter:e})}),(0,N.jsx)(y.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,S.nextTableOn)(m),onChange:e=>J({nextTableFree:e})}),(0,N.jsx)(y.Toggle,{label:"Show takeaway on home screens",value:(0,S.showTakeaway)(m),onChange:e=>J({showTakeaway:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,N.jsx)(y.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),Oe=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!Z.holidayFullNames,onChange:e=>J({holidayFullNames:e})}),(0,N.jsx)(y.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[ze,Ie]=(0,b.useState)(null),$e=ze??Z.whatsapp??'',Be=!$e.trim()||!!(0,M.waNumber)($e),Ae=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.T,{children:"The venue\u2019s WhatsApp number"}),(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:$e,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{Ie(e),e.trim()?(0,M.waNumber)(e)&&J({whatsapp:e.trim()}):J({whatsapp:void 0})}}),$e.trim()&&Be?(0,N.jsx)(y.Badge,{kind:"gold",label:`wa.me/${(0,M.waNumber)($e)}`}):null]}),Be?null:(0,N.jsx)(y.T,{size:13,colour:T.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,N.jsx)(y.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Fe=(0,E.soldOutSettingsOf)(Z.soldOut),Ee=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Fe.auto,onChange:e=>J({soldOut:{...Fe,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,N.jsx)(y.Muted,{size:13,children:Fe.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,N.jsx)(y.T,{children:"Clear sold out dishes by themselves"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-soldout-${e}`,label:E.SOLD_OUT_CLEAR_LABEL[e],selected:Fe.clear===e,onPress:()=>J({soldOut:{...Fe,clear:e}})},e))}),'manual'!==Fe.clear?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(y.T,{children:"Next morning means"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,N.jsx)(y.Chip,{label:e,selected:Fe.morningAt===e,onPress:()=>J({soldOut:{...Fe,morningAt:e}})},e))})]}):null,(0,N.jsx)(y.Muted,{size:13,children:'close'===Fe.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Fe.clear?`Dishes go back on at ${Fe.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),Ne=(0,s.venueBusy)(m,ne,new Date),We=(0,F.clampWeeks)(Z.forecastMinWeeks),He=(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsxs)(f.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:Ne.words,children:[(0,N.jsx)(y.T,{center:!0,size:20,weight:"semibold",children:Ne.words}),(0,N.jsx)(y.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:Z.busyCoversPerHour??30,min:1,max:200,onChange:e=>J({busyCoversPerHour:e,busyLearning:!1})}),(0,N.jsx)(y.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,N.jsx)(y.Toggle,{label:"Learn the busy level from our real history",value:!1!==Z.busyLearning,onChange:e=>J({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,N.jsx)(y.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),Ne.enough?null:(0,N.jsx)(y.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,N.jsx)(y.T,{children:"History needed before forecasts show"}),(0,N.jsx)(y.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,N.jsx)(y.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:We===e,onPress:()=>J({forecastMinWeeks:e})},e))}),(0,N.jsx)(y.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===We?'1 week':`${We} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,N.jsx)(n.ForecastDaySettings,{r:m,set:J})]}),Ue=(0,j.depositOf)(Z),Ge=e=>J({deposit:{...Ue,...e}}),qe=t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsxs)(f.default,{style:{gap:8},children:[(0,N.jsx)(y.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ue.on,onChange:e=>Ge({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Amount per person"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-amount",value:Ue.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"From a party of"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-party",value:Ue.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from party size"})]}),(0,N.jsx)(y.T,{children:"Refundable?"}),(0,N.jsxs)(y.Row,{wrap:!0,gap:8,children:[(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ue.refundable,onPress:()=>Ge({refundable:!0})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ue.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,N.jsx)(y.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ue.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ue.refundable?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Refunded if cancelled this many hours before"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-cutoff",value:Ue.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,N.jsx)(y.T,{children:"Words guests see (optional)"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ue.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:T.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,padding:10,fontSize:15}}),(0,N.jsx)(y.Muted,{size:13,children:Ue.on&&Ue.perPersonPence>0?`Guests booking for ${Ue.fromParty} or more see: \u201c${(0,j.depositWords)(Ue,Ue.fromParty,m.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,N.jsx)(y.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ue.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ue.wixLinksOn?(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{children:"Link works for"}),(0,N.jsx)(y.Stepper,{testID:"adv-deposit-linkhours",value:Ue.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,N.jsx)(y.Muted,{size:13,children:Ue.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,N.jsx)(y.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,N.jsx)(w.LoyaltySettingsPanel,{}),Qe=(0,N.jsx)(ee,{rid:L}),Ye=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:le,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:de,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:pe,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:ye,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Le,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Pe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:t.IS_GREENSIDE?(0,N.jsx)(o.GreensideCashOnly,{}):(0,N.jsx)(l.TableOrderSettings,{rid:L,me:Y}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Ae,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>V(L)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,N.jsx)(B.NotificationsSettings,{rid:L}),help:'adv-notifications',onReset:()=>A.useNotifs.getState().resetSeeds(L)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,N.jsx)(B.OrderListsSettings,{rid:L}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(L)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,N.jsx)(u.TaskLibrarySettings,{rid:L}),help:'adv-tasks',onReset:()=>g.useDailyTasks.getState().resetLibrary(L)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,N.jsx)(c.CashUpSettings,{rid:L}),help:'adv-cashup',onReset:()=>p.useCashUp.getState().resetFields(L)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,N.jsx)(c.TipsSettings,{rid:L}),help:'adv-tips',onReset:()=>p.useCashUp.getState().setShow(L,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,N.jsx)(B.ClockAreaSettings,{rid:L,me:Y}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(L,Y)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,N.jsx)(h.HrSettingsCard,{rid:L}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:He,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ee,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,N.jsx)(z.GridSettings,{rid:L,me:Y}),help:'adv-tablegrid',onReset:()=>{const e=$.useFloor.getState().settings[L];$.useFloor.getState().setSettings(L,{...$.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,N.jsx)(I.PrintersSettings,{rid:L,go:e}),help:'adv-printers',onReset:()=>{const e=$.useFloor.getState().settings[L];e&&$.useFloor.getState().setSettings(L,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,N.jsx)(i.BlockSettings,{rid:L}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,N.jsx)(r.GiftQrSettings,{rid:L}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:Oe,help:'adv-holidays'}],Ve=X.trim().toLowerCase(),Ze=(0,b.useMemo)(()=>Ye.filter(e=>!Ve||`${e.title} ${e.words}`.toLowerCase().includes(Ve)),[Ve,Ye]);return(0,N.jsxs)(f.default,{style:{gap:12},testID:"advanced-settings",children:[(0,N.jsx)(y.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:X,onChangeText:se,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:T.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:T.colours.accentBorder,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:12,fontSize:16}}),te?(0,N.jsx)(y.Banner,{kind:"success",title:te}):null,Ze.length?null:(0,N.jsxs)(y.Muted,{children:["No settings match \u201c",X,"\u201d."]}),Ze.map(s=>(0,N.jsx)(y.Card,{children:(0,N.jsxs)(f.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{size:17,weight:"semibold",colour:T.colours.gold,children:s.title}),e?(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,N.jsx)(y.T,{colour:T.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,N.jsx)(y.Row,{style:{justifyContent:'flex-end'},children:(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ae(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return Y}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,R.useCtx)(6e4),t=(0,v.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,N.jsx)(y.Card,{onPress:()=>e('more','advanced'),highlight:T.colours.gold,children:(0,N.jsxs)(f.default,{testID:"seasons-todo",style:{gap:4},children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(y.T,{weight:"semibold",colour:T.colours.gold,children:"Setup checklist: kitchen hours"}),(0,N.jsx)(y.T,{colour:T.colours.muted,children:"\u203a"})]}),(0,N.jsxs)(y.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=e(b),x=e(_r(_d[15])),f=e(_r(_d[16])),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),z=_r(_d[31]),I=_r(_d[32]),$=_r(_d[33]),B=_r(_d[34]),A=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]);const W=/^([01]\d|2[0-3]):[0-5]\d$/,H=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,U=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:n=90,bad:l,testID:r}){return(0,N.jsx)(a.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:T.colours.muted,style:{width:n,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?T.colours.red:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,N.jsx)(x.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:T.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,N.jsx)(y.T,{size:20,colour:T.colours.gold,children:a})});return(0,N.jsxs)(y.Row,{gap:8,children:[r('\u2212',-l),(0,N.jsx)(y.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const Y={DEFAULT_DWELL:S.DEFAULT_DWELL,ANCHORAGE_SEASONS:v.ANCHORAGE_SEASONS};function V(e){const s=L.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,L.chairsId)(e))}const Z=[1,2,3,4,5,6,0],J=e=>`${7===e.days.length?'Every day':Z.filter(s=>e.days.includes(s)).map(e=>P.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${P.AUDIENCE_LABEL[e.audience]}`;function X({init:e,onSave:s,onCancel:t}){const[o,n]=(0,b.useState)(e.text),[l,r]=(0,b.useState)(e.days),[i,d]=(0,b.useState)(e.time),[h,u]=(0,b.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,P.validTime)(i);return(0,N.jsxs)(f.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:T.colours.accentBorder,borderRadius:12,padding:10},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"What it says"}),(0,N.jsx)(a.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:n,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:T.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:T.colours.hairline,backgroundColor:T.colours.surface2,color:T.colours.text,paddingHorizontal:10,fontSize:15}}),(0,N.jsx)(y.T,{weight:"semibold",children:"Days"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,N.jsx)(y.Chip,{label:P.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,N.jsxs)(y.Row,{gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Time (UK)"}),(0,N.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,P.validTime)(i)})]}),(0,N.jsx)(y.T,{weight:"semibold",children:"Who sees it"}),(0,N.jsx)(y.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,N.jsx)(y.Chip,{label:P.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,N.jsx)(y.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,N.jsxs)(y.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,N.jsx)(y.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function ee({rid:e}){m.default.useEffect(()=>{L.useReminders.getState().ensure(e)},[e]);const s=(0,L.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,L.useReminders)(s=>s.rules[e]),a=(0,P.clampRules)(o??P.DEFAULT_BREAK_RULES),n=(0,L.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,O.useOwner)(e=>e.staff),r=L.useReminders.getState(),[i,d]=(0,b.useState)(null),[h,u]=(0,b.useState)(null),c=s=>r.setRules(e,s);return(0,N.jsxs)(f.default,{style:{gap:10},testID:"reminders-settings",children:[(0,N.jsx)(y.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,N.jsx)(y.T,{weight:"semibold",children:"Break reminders"}),(0,N.jsx)(y.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,N.jsx)(K,{label:"first break reminder",step:15,min:30,max:P.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"Remind once more after"}),(0,N.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,N.jsx)(y.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,N.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,N.jsxs)(y.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,N.jsx)(y.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,N.jsx)(f.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:T.colours.hairline,paddingBottom:8},children:i===e.id?(0,N.jsx)(X,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(y.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,N.jsx)(y.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,N.jsx)(y.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,N.jsx)(y.Muted,{size:13,children:J(e)}),h===e.id?(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,N.jsx)(y.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,N.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,N.jsx)(y.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,N.jsx)(y.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,N.jsx)(X,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,N.jsx)(y.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,N.jsxs)(f.default,{style:{gap:2},children:[(0,N.jsx)(y.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,N.jsxs)(y.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,N.jsxs)(y.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (Fri and Sun, 21:00); your own reminders stay."]}),(0,N.jsx)(y.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1357,[1121,5,1342,796,1358,1359,1361,1362,1363,1156,1047,1048,1024,1029,34,402,102,794,14,1364,800,852,1075,851,840,1100,848,1150,1001,1002,865,1365,1311,1014,1043,1021,1123,978,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1358,[796,34,102,794,1120,851,840,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1359,[829,34,236,102,794,848,1014,1131,1206,985,1277,1360,25]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1360,[829,1230]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrSettings=function({rid:e}){const s=(0,n.useFloor)(t=>t.settings[e]),h={...n.DEFAULT_SETTINGS,...s??{}},[p,y]=(0,t.useState)(h.giftQrUrl??''),[Q,b]=(0,t.useState)(''),S=t=>n.useFloor.getState().setSettings(e,{...h,...t}),x=(0,u.giftQrUrlOk)(p);return(0,c.jsxs)(l.default,{style:{gap:8},testID:"adv-giftqr-panel",children:[(0,c.jsx)(o.Toggle,{testID:"giftqr-on",label:"Show \u201cBuy a gift card\u201d on the Display",value:!!h.giftQrOn,disabled:!h.giftQrOn&&!(0,u.giftQrUrlOk)(h.giftQrUrl),onChange:e=>{S({giftQrOn:e}),b(e?'On: the Display shows Buy a gift card.':'Off: the Display hides Buy a gift card.')}}),(0,c.jsx)(o.Field,{testID:"giftqr-url",label:"Your gift card page (https://\u2026)",value:p,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>{y(e.slice(0,u.GIFT_QR_MAX)),b('')},placeholder:"https://www.example.com/gift-card"}),p&&!x?(0,c.jsx)(o.T,{size:13,colour:f.colours.amber,children:"Use the full address starting https://"}):null,(0,c.jsx)(o.Button,{small:!0,label:"Save the page address",testID:"giftqr-save",disabled:!x||p.trim()===(h.giftQrUrl??''),onPress:()=>{S({giftQrUrl:p.trim()}),b('Saved. The Display QR opens this page.')}}),Q?(0,c.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(o.Muted,{children:Q})}):null,(0,c.jsx)(o.Muted,{size:13,children:"Gift cards are sold through your website. The Display shows only a QR code and \u201cScan to buy a gift card on your phone\u201d: no prices or balances."})]})};var e,t=r(d[0]),s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),u=r(d[4]),f=r(d[5]),c=r(d[6])},1361,[34,102,794,1014,1286,840,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"websiteBlocksSynced",{enumerable:!0,get:function(){return m}}),_e.BlockSettings=function({rid:e}){const n=(0,s.useFloor)(n=>n.settings[e]),h={...s.DEFAULT_SETTINGS,...n??{}},b=h.serviceWindows??{},w=b.lunch??['12:00','17:00'],f=b.dinner??['17:00','21:00'],k=(n,t)=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:{...b,[n]:t}}),y=(e,n,t,s)=>(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{style:{flex:1},children:e}),(0,u.jsx)(o.Stepper,{testID:s,label:e,value:(0,l.toMins)(n),min:360,max:1425,step:15,format:e=>(0,c.fmt12)((0,l.fromMins)(e)),onChange:t})]});return(0,u.jsxs)(t.default,{style:{gap:8},testID:"adv-blocks-panel",children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Lunch and dinner"}),(0,u.jsx)(o.Muted,{children:"Used by Block now (the Lunch and Dinner buttons) and Spend per head. Always kept inside the kitchen hours for the day."}),b.lunch||b.dinner?null:(0,u.jsx)(o.Muted,{testID:"sw-usual",children:"Usual times now: lunch from opening to 5:00pm, dinner from 5:00pm to close. Change a time below to set your own."}),y('Lunch starts',w[0],e=>k('lunch',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(w[1])-15)),w[1]]),'sw-lunch-from'),y('Lunch ends',w[1],e=>k('lunch',[w[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(w[0])+15))]),'sw-lunch-to'),y('Dinner starts',f[0],e=>k('dinner',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(f[1])-15)),f[1]]),'sw-dinner-from'),y('Dinner ends',f[1],e=>k('dinner',[f[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(f[0])+15))]),'sw-dinner-to'),b.lunch||b.dinner?(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Use the usual times",onPress:()=>s.useFloor.getState().setSettings(e,{...h,serviceWindows:void 0})}):null,(0,u.jsx)(o.T,{weight:"semibold",style:{marginTop:8},children:"Block on website bookings too"}),m(e)?(0,u.jsx)(o.Muted,{testID:"wix-block-sync-on",children:"On. A whole-day or time block made in CoverCharge also closes those times for online booking on your website, editing or removing it updates the website, and blocks made on the website show here too. Website bookings can only close the whole venue, not one area or some tables."}):(0,u.jsx)(o.Muted,{testID:"wix-block-sync-off",children:"Website bookings aren\u2019t connected for this venue yet. Once they are, a whole-day or time block made in CoverCharge also closes those times for online booking on your website. Until then, the website can still take bookings in a blocked time, so check those."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);const m=e=>!h.IS_ISOLATED_VENUE&&'anchorage'===e},1362,[34,102,794,1014,827,1319,5,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"advancedPrefill",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"takeAdvancedPrefill",{enumerable:!0,get:function(){return n}});const t={q:''},n=()=>{const n=t.q;return t.q='',n}},1363,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,u.staffServer)(),[s,h]=(0,t.useState)(null),[x,y]=(0,t.useState)([]),[p,j]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),v=(0,t.useCallback)(async()=>{try{const[e,t]=await Promise.all([(0,u.readSettings)(),(0,u.readOffers)()]);h(e),y(t)}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,u.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,c.jsx)(l.Banner,{kind:"info",title:"Not connected",children:"Loyalty settings are saved on the server. Not set up yet: sign in to the venue on this device to change them."});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const O=e=>{h({...s,...e}),j(null)},S=(0,o.checkSettings)(s),C=async()=>{if(!S){b(!0);try{await(0,u.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}b(!1)}},T=e=>e?`${e} days`:'Never';return(0,c.jsxs)(n.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Stamp card"}),(0,c.jsx)(l.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps for a reward"}),(0,c.jsx)(l.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,c.jsx)(l.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps run out after"}),(0,c.jsx)(l.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Rewards run out after"}),(0,c.jsx)(l.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Minutes between stamps (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most stamps a day (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,c.jsx)(l.T,{weight:"semibold",children:"Bring a friend"}),(0,c.jsx)(l.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,c.jsx)(l.Field,{label:"Reward for the guest who brings a friend",value:s.referralGiver,onChangeText:e=>O({referralGiver:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsx)(l.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most friend rewards a month (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:S}):null,p?(0,c.jsx)(l.Banner,{kind:p.kind,title:p.text}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{C()}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>h({...o.DEFAULT_LOYALTY})})]}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: a friend reward is given when the friend gets their first stamp, and a guest can\u2019t use their own code. Stamps only come from staff, or from a code or QR staff make."}),(0,c.jsx)(l.T,{weight:"semibold",children:"Offers"}),x.length?x.map(e=>(0,c.jsx)(f,{o:e,onSaved:v},e.id)):(0,c.jsx)(l.Muted,{children:"No offers yet."}),(0,c.jsx)(f,{onSaved:v}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: guests see an offer only while it\u2019s on and between its dates. Leave the dates blank to run it until you turn it off."})]})},_e.LoyaltySummaryCard=function({kind:e="card"}){const[s,a]=(0,t.useState)(null),[h,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,u.loyaltySummary)().then(a,e=>f((0,o.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,u.staffServer)())return x(),(0,u.watchLoyalty)(x)},[x]),!(0,u.staffServer)())return null;if(h)return(0,c.jsx)(l.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:h});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const y='card'===e?[['Guests with a card',s.members],['Joined this month',s.joinedMonth],['Stamps this week',s.stampsWeek],['Stamps this month',s.stampsMonth],['Rewards ready to use',s.rewardsReady],['Rewards used this month',s.rewardsUsedMonth],['Offers live now',s.offersLive]]:[['Friends waiting for their first stamp',s.referralsWaiting],['Friend rewards given',s.referralsRewarded]];return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,c.jsx)(l.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{children:e}),(0,c.jsx)(l.T,{weight:"semibold",children:t})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: these are your real numbers from the server. Change the card in Settings \u203a Advanced \u203a Loyalty."})]})})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=r(d[2]),l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]);const h=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function f({o:e,onSaved:s}){const[f,x]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[y,p]=(0,t.useState)(!!e),[j,w]=(0,t.useState)(null);if(!e&&!y)return(0,c.jsx)(l.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>p(!0)});const b=(!f.startsOn||h.test(f.startsOn))&&(!f.endsOn||h.test(f.endsOn))?(0,o.checkOffer)({title:f.title,details:f.details,startsOn:f.startsOn||null,endsOn:f.endsOn||null}):'Dates look like 2026-12-01.',v=async()=>{if(!b)try{await(0,u.saveOffer)({id:e?.id,title:f.title.trim(),details:f.details.trim(),startsOn:f.startsOn||null,endsOn:f.endsOn||null,isOn:f.isOn}),w('Saved.'),e||(x({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),p(!1)),s()}catch(e){w((0,o.plainError)(e))}};return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[e?(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{weight:"semibold",children:e.title}),(0,c.jsx)(l.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,c.jsx)(l.T,{weight:"semibold",children:"New offer"}),(0,c.jsx)(l.Field,{label:"Title",value:f.title,onChangeText:e=>x({...f,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,c.jsx)(l.Field,{label:"Details",value:f.details,onChangeText:e=>x({...f,details:e.slice(0,500)}),multiline:!0}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Field,{label:"Starts (optional)",value:f.startsOn,onChangeText:e=>x({...f,startsOn:e.trim()}),placeholder:"2026-12-01"}),(0,c.jsx)(l.Field,{label:"Ends (optional)",value:f.endsOn,onChangeText:e=>x({...f,endsOn:e.trim()}),placeholder:"2026-12-24"})]}),(0,c.jsx)(l.Toggle,{label:"Offer on",value:f.isOn,onChange:e=>x({...f,isOn:e})}),b&&(f.title||e)?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:b}):null,j?(0,c.jsx)(l.Muted,{size:13,children:j}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{small:!0,label:"Save offer",disabled:!!b,onPress:()=>{v()}}),e?null:(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>p(!1)})]})]})})}},1364,[34,102,840,794,1203,1206,25]); +__d(function(_g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.tidyWholePlan=u,_e.restoreTidy=h,_e.GridSettings=function({rid:e,me:s}){const p=(0,r.useFloor)(t=>t.settings[e]),c={...r.DEFAULT_SETTINGS,...p??{}},y=t=>r.useFloor.getState().setSettings(e,{...c,...t}),[b,S]=(0,t.useState)(''),f=(0,o.gridOf)(c.gridSize),v=c.tidyBackup,T=v?new Date(v.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'';return(0,g.jsxs)(n.default,{style:{gap:8},children:[(0,g.jsx)(a.Toggle,{testID:"adv-grid-snap",label:"Snap tables to the grid when dragging",value:!1!==c.gridSnap,onChange:e=>y({gridSnap:e}),a11y:"Snap tables to the grid when dragging"}),(0,g.jsx)(a.Muted,{size:13,children:!1!==c.gridSnap?'On: tables jump to the nearest grid line and line up with other tables (gold guides show when edges or centres match). Hold Alt (Option on a Mac) while dragging to move freely.':'Off: tables go exactly where you let go. Gold guides still help you line them up.'}),(0,g.jsx)(a.T,{children:"Grid size"}),(0,g.jsx)(a.Row,{wrap:!0,gap:8,children:o.GRID_SIZES.map(e=>(0,g.jsx)(a.Chip,{testID:`adv-grid-${e}`,label:10===e?'Fine (10)':25===e?'Normal (25)':'Coarse (50)',selected:f===e,onPress:()=>y({gridSize:e})},e))}),(0,g.jsx)(a.Button,{testID:"adv-grid-tidy",label:"Tidy up the whole plan",onPress:()=>{const t=u(e,s,(new Date).toISOString());S(t.moved?`Tidied: ${t.moved} tables lined up on the grid. The old positions are kept below.`:'Already tidy. Nothing moved.')}}),(0,g.jsx)(a.Muted,{size:13,children:"Tidy up snaps every table to the grid and evens out the rows, area by area. Only positions change: table numbers, areas, Covers, sizes and best tables stay as they are."}),v?(0,g.jsxs)(n.default,{testID:"adv-grid-backup",style:{borderWidth:1,borderColor:l.colours.gold,borderRadius:10,padding:10,gap:6},children:[(0,g.jsxs)(a.T,{size:14,children:["Positions from before the tidy on ",T,v.by?` (${v.by})`:''," are kept."]}),(0,g.jsx)(a.Button,{testID:"adv-grid-restore",kind:"secondary",label:"Put the tables back where they were",onPress:()=>{h(e)&&S('Done: every table is back where it was before the tidy.')}})]}):null,b?(0,g.jsx)(a.Banner,{kind:"success",title:b}):null,(0,g.jsx)(a.Muted,{size:13,children:"Tip: in the table plan editor, Tidy up does one area at a time and you can undo it with \u2318Z (Ctrl+Z)."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),g=_r(d[6]);function u(e,t,s){const n=r.useFloor.getState(),a=n.plans[e]??(0,r.planOf)(e),l={...r.DEFAULT_SETTINGS,...n.settings[e]??{}};let g=a;for(const e of a.areas)g=(0,o.tidyArea)(g,e.id,(0,o.gridOf)(l.gridSize));const u=(0,o.movedCount)(a,g);return u?(n.setSettings(e,{...l,tidyBackup:(0,o.backupOf)(a,s,t,'Before Tidy up')}),n.setPlan(e,g),{moved:u}):{moved:u}}function h(e){const t=r.useFloor.getState(),s={...r.DEFAULT_SETTINGS,...t.settings[e]??{}},n=s.tidyBackup;return!!n&&(t.setPlan(e,(0,o.restoreFrom)(t.plans[e]??(0,r.planOf)(e),n)),t.setSettings(e,{...s,tidyBackup:void 0}),!0)}},1365,[34,102,794,1014,1295,840,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1366,[798,34,283,364,236,102,426,900,794,796,840,1325,25]); +__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1367,[925,800,798,806,852,1061,1368,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1167,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1368,[499,1369]); +__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 t}});var t={}},1369,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProgressBar=B,_e.useSetupDone=O,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,C.useCtx)(6e4),n=O(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=f.SETUP_STEPS.findIndex(e=>e.id===a),s=f.SETUP_STEPS[e+1]?.id??null;return(0,E.jsx)(D,{id:a,wizard:!0,onBack:()=>l(e>0?f.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=f.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,E.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{gap:12,children:[(0,E.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsxs)(x.T,{size:20,weight:"bold",colour:S.colours.gold,children:["Set up ",t.name]}),(0,E.jsx)(x.Muted,{children:n.loading?'Checking what is already set up\u2026':i?'Everything is set up. Open any step to check or change it.':'Nine short steps. Do them in order or jump to any one; you can come back to each from Settings.'})]})]}),(0,E.jsx)(B,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,E.jsx)(x.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,E.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:S.colours.border,backgroundColor:S.colours.surface,overflow:'hidden'},children:f.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,E.jsxs)(h.default,{testID:`setup-step-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Step ${s+1}: ${e.title}${t?', done':o.length?`, still needed: ${o.join(', ')}`:''}`,onPress:()=>l(e.id),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',gap:12,padding:12,minHeight:60,borderTopWidth:s?1:0,borderColor:S.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,E.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?S.colours.gold:'transparent',borderWidth:1.5,borderColor:t?S.colours.gold:S.colours.border},children:(0,E.jsx)(x.T,{weight:"bold",colour:t?S.colours.onGold:S.colours.muted,children:t?'\u2713':s+1})}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"medium",children:e.title}),(0,E.jsx)(x.Muted,{children:e.sub}),o.length?(0,E.jsxs)(x.T,{size:13,colour:S.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,E.jsx)(x.Badge,{kind:"ok",label:"Done"}):null,(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=D,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return _}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,C.useCtx)(6e4),t=O(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,E.jsxs)(x.Card,{onPress:()=>e('more','setup'),highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:"Finish setting up"}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]}),(0,E.jsx)(B,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,E.jsxs)(x.Muted,{size:13,children:["Next: ",f.SETUP_STEPS.find(e=>!t.isDone(e.id))?.title]})]})};var s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),o=_r(_d[3]),a=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(_r(_d[4])),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=e(_r(_d[11])),g=e(_r(_d[12])),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),j=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),k=_r(_d[20]),w=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),T=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]),E=_r(_d[27]);const M=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],R=[1,2,3,4,5,6,0],z=/^([01]\d|2[0-3]):[0-5]\d$/,$=e=>{const s=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(s)&&s>0?Math.round(100*s):null},I=e=>f.SETUP_STEPS.findIndex(s=>s.id===e)+1;function B({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,E.jsxs)(g.default,{testID:t,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:s,now:e},accessibilityLabel:`${e} of ${s} steps done`,style:{gap:4},children:[(0,E.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:S.colours.gold,borderRadius:5}})}),(0,E.jsxs)(x.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function O(e){const s=(0,f.useSiteSetup)(e),t=(0,p.useBrand)(e),{status:n,live:o}=(0,r.useSetupStatus)(),a=(0,c.useMemo)(()=>n?(0,l.evalSetup)(n,{logo:!!t.logo,email:s.email,bookingUrl:s.bookingUrl}):null,[n,t.logo,s.email,s.bookingUrl]),d=(0,i.useSetupMarksLoaded)(),u=e=>a?(0,i.applyMark)(!!a[e]?.done,d[e]):!!s.done[e],h=f.SETUP_STEPS.filter(e=>u(e.id)).length;return{isDone:u,markOf:e=>d[e],missing:e=>a?a[e]?.missing??[]:[],prog:{done:h,total:f.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function D({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,C.useCtx)(6e4),l=O(a),r=l.prog,d=(0,i.useLiveVenue)(),u=f.SETUP_STEPS.find(s=>s.id===e),[p,b]=(0,c.useState)(null),m=U[e];return(0,E.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsxs)(x.T,{size:12,weight:"semibold",colour:S.colours.gold,children:["STEP ",I(e)," OF ",f.SETUP_STEPS.length]}),s&&o?(0,E.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,E.jsx)(x.T,{size:13,colour:S.colours.muted,children:"All steps"})}):null]}),(0,E.jsx)(x.T,{size:22,weight:"bold",children:u.title}),(0,E.jsx)(B,{done:r.done,total:r.total})]}),(0,E.jsx)(m,{rid:a,done:(t="Saved.")=>{f.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():b(t)},wizard:!!s}),p?(0,E.jsx)(x.Banner,{kind:"success",title:p}):null,(0,E.jsx)(W,{rid:a,id:e,title:u.title,onDone:b}),s?(0,E.jsxs)(x.Row,{gap:10,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,E.jsx)(x.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const L=({wizard:e,onPress:s,disabled:t,label:n})=>(0,E.jsx)(x.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const A=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function F({rid:e,done:n,wizard:o,payList:a=!1}){const l=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,j.useOwner)(e=>e.hourly),i=(0,C.useHourly)(),d=(0,f.useSiteSetup)(e),u=(0,f.useSetup)(e=>e.looks),[p,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),v=e=>{const s=d.grades.find(s=>s.id===d.staffGrade[e.id]);return e.salaried&&null==r[e.id]?'Salaried, no hourly wage':s&&!a?`${s.name} grade`:null==r[e.id]?'Pay not set':null!=i[e.id]?`${(0,w.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];m({id:e.id,name:e.name,job:e.job,access:(0,f.accessOf)(e.level,e.role),pay:e.salaried&&null==r[e.id]?'salaried':s?'grade':'own',gradeId:s??d.grades[0]?.id??'',wage:null!=i[e.id]?(i[e.id]/100).toFixed(2):'',noTax:!!e.noTax,look:u[e.id]??null}),T(null)},M=!!p?.id&&(R=p.id,k.ROSTER.some(e=>e.id===R));var R;const z=p?$(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=z||M&&!p.wage);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Muted,{children:[l.length," people. Tap someone to change their pay, tax or avatar. People from your roster keep their name, access and personal link."]}),(0,E.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,E.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>P(e),style:({pressed:s})=>({flexDirection:'row',alignItems:'center',gap:10,padding:10,borderRadius:14,borderWidth:1,borderColor:p?.id===e.id?S.colours.gold:S.colours.border,backgroundColor:s?'#1d1a14':S.colours.surface}),children:[(0,E.jsx)(b.StaffAvatar,{id:e.id,size:42}),(0,E.jsxs)(g.default,{style:{flex:1},children:[(0,E.jsx)(x.T,{weight:"semibold",children:e.name}),(0,E.jsxs)(x.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,f.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,E.jsx)(x.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,f.accessOf)(e.level,e.role)})]},e.id))}),y?(0,E.jsx)(x.Banner,{kind:"success",title:y}):null,p?(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsx)(x.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:S.colours.gold},children:(0,E.jsx)(b.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsx)(x.Muted,{children:"Choose an original icon or keep a crew look. A personal avatar takes priority. They can change their own in My avatar."}),(0,E.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>m({...p,look:e.look})}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>m({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>m({...p,look:null})}):null]})]})]}),M?(0,E.jsxs)(x.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,E.jsx)(x.Field,{label:"Name",value:p.name,onChangeText:e=>m({...p,name:e}),placeholder:"First and last name"}),(0,E.jsx)(x.Field,{label:"Job title",value:p.job,onChangeText:e=>m({...p,job:e}),placeholder:"e.g. Kitchen porter"}),M?null:(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Access level"}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,selected:p.access===e,onPress:()=>m({...p,access:e})},e))}),(0,E.jsxs)(x.Muted,{size:13,children:["Uses the ",f.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,E.jsxs)(g.default,{style:{gap:6},children:[(0,E.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Pay"}),(0,E.jsxs)(x.Row,{gap:6,wrap:!0,children:[a?null:(0,E.jsx)(x.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>m({...p,pay:'grade'})}),(0,E.jsx)(x.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>m({...p,pay:'own'})}),(0,E.jsx)(x.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>m({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,E.jsx)(x.Chip,{label:`${e.name} \xb7 ${(0,w.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>m({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,E.jsx)(x.Field,{label:"\xa3 per hour",value:p.wage,onChangeText:e=>m({...p,wage:e}),keyboardType:"decimal-pad",placeholder:M?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=z&&z<1271?(0,E.jsx)(x.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,E.jsx)(x.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>m({...p,noTax:e})}),(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>m(null),style:{flex:1}}),(0,E.jsx)(x.Button,{label:p.id?'Save':'Add to team',testID:"staff-save",disabled:!I,onPress:()=>{if(!p||!I)return;const s=j.useOwner.getState();let t=p.id;if(!t){const e=new Set(s.staff.map(e=>e.id));if(s.addStaff(p.name.trim(),f.ACCESS_ROLE[p.access],p.job.trim()||'Team member'),t=j.useOwner.getState().staff.find(s=>!e.has(s.id))?.id,!t)return}const n={job:p.job.trim()||'Team member',salaried:'salaried'===p.pay,noTax:p.noTax};M||Object.assign(n,{name:p.name.trim(),level:p.access,role:f.ACCESS_ROLE[p.access],dept:'Head Chef'===p.access?'Kitchen':void 0}),s.updateStaff(t,n);const o={...d.staffGrade};if('grade'===p.pay){const e=d.grades.find(e=>e.id===p.gradeId);e&&(a&&d.staffGrade[t]===p.gradeId||s.setRate(t,e.pence),o[t]=e.id)}else delete o[t],'own'===p.pay&&null!=z&&s.setRate(t,z);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),f.useSetup.getState().patch(e,{staffGrade:o}),f.useSetup.getState().setLook(t,p.look),T(`${p.name.trim()} ${p.id?'updated':'added'}.`),m(null)},style:{flex:1}})]}),p.id?null:(0,E.jsx)(x.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,E.jsx)(x.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{m(A(d.grades[0]?.id??'')),T(null)}}),(0,E.jsx)(L,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const U={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,f.useSiteSetup)(e),[i,d]=(0,c.useState)({name:o.name,address:o.address??o.location,phone:o.phone??'',email:r.email,tagline:o.tagline}),[u,h]=(0,c.useState)('');return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,E.jsx)(x.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,E.jsx)(x.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,E.jsx)(x.Field,{label:"Email",accessibilityLabel:"Venue email address",keyboardType:"email-address",inputMode:"email",autoCapitalize:"none",autoCorrect:!1,value:i.email,onChangeText:e=>d({...i,email:e})}),(0,E.jsx)(x.Field,{multiline:!0,numberOfLines:3,label:"Tagline",value:i.tagline,onChangeText:e=>d({...i,tagline:e}),placeholder:"e.g. Seafood and real ale by the harbour"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Logo"}),(0,E.jsxs)(x.Row,{gap:14,children:[(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:S.colours.border},children:(0,E.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,E.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,E.jsxs)(x.Muted,{children:[l.custom?'Your uploaded logo.':'anchorage'===e?'The Anchorage logo in black and gold.':'greenside'===e?'The Greenside Restaurant logo.':'abbotsford'===e?'The Abbotsford Hotel logo.':'kirkton'===e?'The Kirkton Inn logo.':'wildings'===e?'The Wildings Hotel & Restaurant logo.':'kirkmichael'===e?'The Kirkmichael Arms logo.':'souters'===e?'The Souter\u2019s Inn logo.':'Placeholder initials.'," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,E.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,label:"Upload a logo",onPress:async()=>{const s=await a.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(s.canceled||!s.assets?.[0])return;const t=s.assets[0];j.useOwner.getState().setBranding(e,{logoUri:t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri})}}),l.custom?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,E.jsx)(P.OrderAtTableCard,{rid:e,compact:!0}),u?(0,E.jsx)(x.Banner,{kind:"warn",title:u}):null,(0,E.jsx)(L,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(m.useStore.getState().updateRestaurant(o.id,{name:i.name.trim(),address:i.address.trim(),phone:i.phone.trim(),contactEmail:i.email.trim(),tagline:i.tagline.trim()}),h(''),s('Venue details saved.')):h('Check the email address.')}})]})},hours:function({done:e,wizard:s}){const{r:t}=(0,C.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=R.filter(e=>{const s=n[e];return s&&(!z.test(s[0])||!z.test(s[1]))});return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),M.map((e,s)=>{const t=R[s],l=n[t];return(0,E.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:S.colours.border,paddingTop:s?6:0},children:[(0,E.jsx)(x.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,E.jsxs)(x.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"to"}),(0,E.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,E.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,E.jsx)(x.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries(R.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,E.jsx)(x.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,E.jsx)(L,{wizard:s,disabled:!!l.length,onPress:()=>{m.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,y.usePlan)(e),o=(0,y.planCounts)(n);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v.TablePlan,{startStep:"areas"}),(0,E.jsx)(L,{wizard:t,disabled:!o.tables,label:t?`Looks right (${o.tables} tables, ${o.seats} seats), continue`:'Mark as done',onPress:()=>s('Table plan step marked as done.')})]})},paygrades:function(e){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{center:!0,children:"Your team's hourly rates. Tap a person to edit. Existing grades are retained in the background; opening this list never changes pay."}),(0,E.jsx)(F,{...e,payList:!0})]})},staff:F,permissions:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)('Manager'),l=e=>f.PERMS.filter(s=>n.perms[e]?.[s.id]).length;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Tick what each access level can do. We\u2019ve started you with sensible defaults; change any of them."}),(0,E.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,E.jsx)(x.Chip,{label:e,sub:`${l(e)} of ${f.PERMS.length}`,selected:o===e,onPress:()=>a(e)},e))}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:o}),'Owner'===o?(0,E.jsx)(x.Muted,{children:"The owner can always do everything."}):null,f.PERMS.map((s,t)=>{const a=!!n.perms[o]?.[s.id],l='Owner'===o;return(0,E.jsxs)(h.default,{testID:`perm-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:a,disabled:l},accessibilityLabel:`${o}: ${s.label}`,disabled:l,onPress:()=>f.useSetup.getState().setPerm(e,o,s.id,!a),style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:50,borderTopWidth:t?1:0,borderTopColor:S.colours.border,opacity:l?.75:1},children:[(0,E.jsx)(g.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:a?S.colours.gold:S.colours.muted,backgroundColor:a?S.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:a?(0,E.jsx)(x.T,{weight:"bold",colour:S.colours.onGold,children:"\u2713"}):null}),(0,E.jsx)(x.T,{style:{flex:1},children:s.label})]},s.id)})]}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Back to the suggested defaults",onPress:()=>f.useSetup.getState().resetPerms(e)}),(0,E.jsx)(x.Banner,{kind:"info",title:"Saved on this device",children:"For now the apps still follow the built-in Owner, Manager and Staff rules. These ticks will control access once staff accounts go live."}),(0,E.jsx)(L,{wizard:t,onPress:()=>s('Permissions saved.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Work email address",value:o,onChangeText:a,placeholder:"e.g. hello@yourvenue.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),l?null:(0,E.jsx)(x.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,E.jsx)(x.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Link your inbox"}),(0,E.jsx)(x.Badge,{kind:"amber",label:"Coming soon"})]}),(0,E.jsx)(x.Muted,{children:"Later you\u2019ll be able to link your inbox so booking emails appear in CoverCharge. Nothing is linked yet: CoverCharge doesn\u2019t read or send email from here."}),(0,E.jsx)(x.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,E.jsx)(L,{wizard:t,disabled:!l,onPress:()=>{m.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,C.useCtx)(6e4),a=(0,f.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,T.appUrl)('/customer-app/index.html'),[]),[d,u]=(0,c.useState)(!1),h=l.trim()&&!/^https?:\/\//i.test(l.trim())?`https://${l.trim()}`:l.trim(),p=!h||/^https?:\/\/[^\s.]+\.[^\s]+$/i.test(h);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,E.jsx)(x.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Your booking link"}),(0,E.jsx)(x.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,E.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:S.colours.border,padding:10},children:(0,E.jsx)(x.T,{size:14,colour:S.colours.goldLight,children:i})}),(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,T.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(x.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,E.jsx)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,E.jsx)(x.Badge,{kind:"gold",label:"Coming soon"})}),(0,E.jsx)(x.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,E.jsx)(L,{wizard:t,disabled:!p,onPress:()=>{m.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),f.useSetup.getState().patch(e,{website:h,bookingUrl:i}),s('Website saved.')}})]})},invites:function({rid:e,done:s,wizard:t}){const n=(0,j.useOwner)(e=>e.staff).filter(e=>e.active),{role:o}=(0,C.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.Muted,{children:"Every person has an Android app download and an iPhone app link. Both sign in automatically. Share privately; nothing is sent from here."}),n.map(e=>(0,E.jsxs)(x.Card,{children:[(0,E.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,E.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,E.jsx)(L,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},_=e=>function(){return(0,E.jsx)(D,{id:e})};function W({rid:e,id:s,title:t,onDone:n}){const o=O(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,E.jsxs)(g.default,{style:{gap:4},children:[(0,E.jsx)(x.Button,{kind:"secondary",label:r?'Saving\u2026':'Mark as not done',disabled:r,testID:`setup-notdone-${s}`,accessibilityLabel:`${t}, mark as not done`,style:{minHeight:44},onPress:async()=>{d(!0),f.useSetup.getState().markDone(e,s,!1);const o=!a||await i.useSetupMarks.getState().set(a,s,!1);d(!1),n(o?`${t} marked as not done.`:'Could not save. Check the connection and try again.')}}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: use this if a step needs another look. It goes back on your to-do list until you mark it done again."})]}):l&&!1===l.done&&l.by?(0,E.jsxs)(x.Muted,{size:13,testID:`setup-notdone-by-${s}`,children:["Marked as not done by ",l.by,l.at?` on ${new Date(l.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})}`:'',"."]}):null}},1370,[927,926,798,796,1061,1371,1372,1373,1374,1376,34,402,102,847,899,794,848,865,1014,925,15,836,840,1100,1377,1380,1384,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1371,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1372,[34,985]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1373,[34,815,985]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1374,[2,796,34,236,383,102,794,1375,985,840,1151,997,865,988,25]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1375,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1376,[34,402,794,985,840,1374,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1377,[796,1120,985,900,1175,1177,34,281,379,236,402,102,426,853,794,848,1186,865,836,827,840,1147,1100,838,1367,1135,1378,1379,1119,1126,1125,1024,13,1123,1366,1167,25]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1378,[796,34,1173,1041,839,379,402,102,794,865,836,827,840,1147,1100,1167,25]); +__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1379,[1042,34,402,102,794,865,840,1100,985,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1380,[796,34,1033,395,102,1107,1108,1293,1316,794,1011,1014,827,840,1100,1015,1381,1382,1035,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1381,[796,34,402,102,794,840,1014,5,1015,846,985,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1382,[34,102,794,1014,1383,828,840,1060,931,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1383,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderAtTableCard=c,_e.OrderAtTableSettings=function(){const e=(0,h.useOwner)(e=>e.site);return(0,u.jsxs)(n.default,{style:{gap:10},children:[(0,u.jsx)(c,{rid:e}),(0,u.jsx)(o.Banner,{kind:"info",title:"Takeaway is separate",children:"Takeaway ordering, slots and the live takeaway queue work the same whichever way this is set. Each venue sets this for itself."})]})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var r,s=_r(d[3]),n=(r=s)&&r.__esModule?r:{default:r},o=_r(d[4]),l=_r(d[5]),h=_r(d[6]),u=_r(d[7]);function c({rid:r,compact:s}){const h=(0,l.useOrderAtTable)(r),c=(0,l.useStore)(e=>e.restaurants.find(e=>e.id===r)?.name??'this venue');return e.IS_GREENSIDE?(0,u.jsx)(t.GreensideCashOnly,{}):(0,u.jsx)(n.default,{testID:"order-at-table-card",children:(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Order at table"}),(0,u.jsx)(o.Muted,{children:"Guests scan a QR code on the table and order from their phone, then pay at the bar or till. Tables, hours and QR codes: Settings \u203a Advanced \u203a Order at the table."})]}),(0,u.jsx)(o.Toggle,{label:"Order at table",value:h,onChange:e=>l.useStore.getState().updateSettings(r,{orderAtTable:e})})]}),(0,u.jsx)(o.T,{size:13,colour:h?'#E2C489':'#D8CFBF',children:h?`On for ${c}: table QR codes, table orders and table tickets are shown.`:`Off for ${c}: in-house orders go through your till. Takeaway ordering stays on.`}),s?null:(0,u.jsx)(o.Muted,{children:"When it is off: no Order at table or table QR screen in the customer app, no Tables & QR codes page or Table option in Take an order here, no table orders in Live orders, and no table tickets in the Head Chef app."})]})})}},1384,[5,1342,34,102,794,848,865,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=M,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=M(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',O[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:O[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withWildingsQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function M(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const O={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':O[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from Bidfood or Booker? Add them here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1385,[801,1153,34,281,283,364,395,236,295,102,36,794,847,850,865,1014,1051,1052,5,828,1049,1059,840,846,1100,1386,1389,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=k,_e.importQuestionnaireAccounts=T,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Listing them lets the Assistant help with them later. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:i}=(0,x.useCtx)(6e4),j='owner'===n,B=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],A=(0,p.useQuestionnaire)(e),{mark:M}=(0,p.useProvenance)(e),[P,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(A?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!B.some(n=>n.provider===e.provider)),[A,B]),W=(A?.accounts??[]).some((e,n)=>M('accounts',n,'provider'));return(0,y.jsxs)(l.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:i})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>A&&T(e,A,i)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${B.length}`})]}),B.length?B.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(A?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(l.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:M('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:I[e.status].kind,label:I[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(k,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=B.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:P,owner:j,by:i,onClose:()=>z(null)}),$?(0,y.jsx)(C,{rid:e,c:$,by:i,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),i=e(r(d[4])),l=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(l.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function k({rid:e,compact:n}){const{role:o,me:i}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,k]=(0,t.useState)({}),[T,B]=(0,t.useState)(null),I=u.useAccounts.getState();return(0,y.jsxs)(l.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(l.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(l.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(l.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(l.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>k({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(l.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>I.update(e,o.id,{accountNo:u},i,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>B(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>I.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:i})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),T?(0,y.jsx)(C,{rid:e,c:T,by:i,onClose:()=>B(null)}):null]})}function C({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(l.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["The Assistant will stop using ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function T(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const i of n.accounts??[])o.some(e=>e.provider===i.provider)||s.add(e,{provider:i.provider,handle:i.handle,status:'listed',from:'questionnaire',addedBy:t})}function B({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,k]=(0,t.useState)(p?.handle??''),[C,T]=(0,t.useState)(p?.customName??''),[B,I]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const A=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${A?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(i.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:A?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),A?(0,y.jsx)(a.Field,{label:"Service name",value:C,onChangeText:T,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>I(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),B?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below so the Assistant knows you use it, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:k,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:A?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:A&&C.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:A?C.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:A&&!C.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(l.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(l.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const I={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(B,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1386,[796,34,379,402,295,102,794,1387,1388,840,1385,1100,865,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1387,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.looksSecret=l,Object.defineProperty(_e,"useAccounts",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),s=r(d[2]);const c=/^\s*(password|passwd|pwd|passcode|pin|otp|secret|token|api[ _-]?key)\s*[:=]/i,u=/\b(sk|pk|rk)_(live|test)_|\bghp_|\bxox[abp]-|\bAKIA[0-9A-Z]{12}|\beyJ[A-Za-z0-9_-]{10,}\./;function l(e){return!(!c.test(e)&&!u.test(e))||e.split(/\s+/).some(e=>e.length>=24&&/[A-Za-z]/.test(e)&&/\d/.test(e)&&!/^[\w.+-]+@[\w-]+\.[\w.]+$/.test(e)&&!/^(https?:\/\/|www\.)/i.test(e))}const b=e=>e&&!l(e)&&e.trim().slice(0,120)||void 0,p=e=>{const t=e?.trim();return t&&/^[A-Za-z0-9 -]{1,20}$/.test(t)?t:void 0},y=(0,n.create)()((0,s.persist)(e=>({byVenue:{},log:{},add:(t,o)=>e(e=>{const n={...o,handle:b(o.handle),customName:b(o.customName),accountNo:p(o.accountNo),id:`c-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,addedAt:(new Date).toISOString()};return{byVenue:{...e.byVenue,[t]:[...e.byVenue[t]??[],n]},log:{...e.log,[t]:[{at:n.addedAt,by:o.addedBy,what:`Added ${o.customName??o.provider}`},...e.log[t]??[]].slice(0,200)}}}),update:(t,o,n,s,c)=>e(e=>({byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).map(e=>e.id===o?{...e,...n,handle:void 0!==n.handle?b(n.handle):e.handle,accountNo:void 0!==n.accountNo?p(n.accountNo):e.accountNo}:e)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:s,what:c},...e.log[t]??[]].slice(0,200)}})),remove:(t,o,n)=>e(e=>{const s=(e.byVenue[t]??[]).find(e=>e.id===o);return{byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).filter(e=>e.id!==o)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:n,what:`Removed ${s?.customName??s?.provider??'an account'}`},...e.log[t]??[]].slice(0,200)}}})}),{name:'covercharge-accounts-v1',version:1,storage:(0,s.createJSONStorage)(()=>o.default)}))},1388,[808,815,818]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1389,[34,402,102,794,850,1388,1014,828,1390,1059,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1390,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1391,[798,34,283,364,236,402,102,815,794,840,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const L=(0,m.useInStaffApp)(),{now:N,meId:A,me:O,r:R,today:z}=(0,m.useCtx)(3e4),H=(0,s.useTravelDay)('staff',z),P=(0,h.useOwner)(e=>e.shifts),F=(0,h.useOwner)(e=>e.attendance),_=(0,h.useOwner)(e=>e.staffCanViewSuppliers),E=(0,h.useOwner)(e=>e.quickLinks),W=(0,h.useOwner)(e=>e.chat),q=(0,h.useOwner)(e=>e.swaps),V=(0,h.useOwner)(e=>e.leave),G=P.filter(e=>e.staffId===A&&e.published&&e.date>=z).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),U=G.find(e=>e.date===z),Y=F.filter(e=>e.staffId===A&&e.in&&!e.out&&N.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Q=(0,x.usePay)(A,0),K=(0,b.useOrders)(R.id),J=(0,b.useBookings)(R.id),X=K.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,J))),Z=J.filter(e=>e.date===z&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,K.filter(T.LIVE))),ee=J.filter(e=>(0,S.undoKind)(e,z)||e.walkIn&&'cancelled'===e.status&&e.date===z).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),se=W.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],te=q.filter(e=>e.fromId===A&&'open'===e.status).length+V.filter(e=>e.staffId===A&&'pending'===e.status).length,ie=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],..._?[['Suppliers',()=>e('more','suppliers')]]:[]];return!L&&H?(0,v.jsxs)(o.default,{style:{gap:10},children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(s.DayView,{rid:R.id,day:H,today:z,app:"staff"})]}):(0,v.jsxs)(o.default,{style:{gap:10},children:[L?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(t.CoversToday,{rid:R.id})]}),(0,v.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,v.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,v.jsx)(C.StaffAvatar,{id:A,size:52})}),(0,v.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",O.replace(' (example)','').split(' ')[0]]})]}),(0,v.jsx)(r.Badge,{kind:"gold",label:L?R.name:'Staff app preview'})]}),(0,v.jsx)(r.Muted,{children:L?`${N.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,v.jsx)(M.StaffTipsTile,{rid:R.id,today:z,onPress:()=>e('more','mytips')}),(0,v.jsxs)(r.Card,{highlight:Y?u.colours.ok:void 0,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{weight:"semibold",children:Y?`On shift since ${(0,c.hm)(new Date(Y.in))}`:'Not clocked in'}),Y?(0,v.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((N.getTime()-new Date(Y.in).getTime())/6e4)))}):null]}),U?(0,v.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(U.start),"\u2013",(0,m.fmtH)(U.end)]}):G[0]?(0,v.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[G[0].day]," ",Number(G[0].date.slice(8))," ",(0,m.fmtH)(G[0].start),"\u2013",(0,m.fmtH)(G[0].end)]}):(0,v.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,v.jsx)(r.Button,{small:!0,kind:Y?'secondary':'success',label:Y?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),A?(0,v.jsx)($.RequestTimeOff,{meId:A,me:O,testID:"staff-home-time-off"}):null,(0,v.jsx)(p.ShellfishTile,{rid:R.id,by:O.replace(' (example)',''),app:"staff"}),ee.length?(0,v.jsx)(r.Card,{children:(0,v.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ee.length,")"]}),(0,v.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),ee.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,v.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,v.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,v.jsxs)(r.Muted,{children:[e.table?(0,I.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,v.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(R.id,e)}):null,e.walkIn?(0,v.jsx)(a.CancelWalkInButton,{rid:R.id,b:e,small:!0}):null,e.walkIn?(0,v.jsx)(a.ReinstateWalkInButton,{rid:R.id,b:e,today:z,small:!0}):null,(0,v.jsx)(S.BookingUndo,{b:e,rid:R.id,today:z,who:s})]})]},e.id)})]})}):null,X.length+Z.length?(0,v.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",X.length+Z.length,")"]}),(0,v.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),X.map(e=>(0,v.jsx)(j.AllergyChain,{o:e,me:O},e.id)),Z.map(e=>(0,v.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,D.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,v.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,I.tablesLabel)(e.table)}`:'']}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsx)(j.BookingAllergyChain,{b:e,me:O}),(0,v.jsx)(o.default,{style:{flexDirection:'row'},children:(0,v.jsx)(w.WhatsAppGuest,{b:e,rid:R.id,kind:"auto"})})]},e.id))]}):null,se?(0,v.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,v.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,v.jsx)(r.T,{size:14,children:se.text})]}):null,(0,v.jsxs)(r.Card,{children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,v.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Q.paid)," paid hours"]})]}),te?(0,v.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,v.jsxs)(r.T,{size:14,children:["You have ",te," request",te>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(E,'staff').length?(0,v.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,v.jsx)(y.QuickLinksRow,{compact:!0})]}):null,L?null:(0,v.jsx)(o.default,{style:{gap:6},children:ie.map(([e,s])=>(0,v.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27]),v=_r(d[28])},1392,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1367,1136,850,1149,838,1147,899,1346,1014,829,1096,1154,1159,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:C,now:$,today:S}=(0,x.useCtx)(3e4),{width:T}=(0,r.default)(),B=(0,n.useBookings)(v),M=(0,n.useOrders)(v),D=(0,n.useEvents)(v),[H,R]=(0,t.useState)(7),A=(0,b.useRealHistory)(v,$),P=(0,t.useMemo)(()=>(0,s.forecastToday)(C,B,M,D,$,A??void 0),[C,B,M,D,A,$.getTime()/6e4|0]),E=(0,t.useMemo)(()=>Array.from({length:H},(e,t)=>{const o=(0,c.addMins)((0,c.parseYmd)(S),1440*t);return{d:o,f:(0,s.forecastToday)(C,B,M,D,o,A??void 0)}}),[C,B,M,D,S,H,A]),F=P.hours.reduce((e,s)=>e+s.booked,0),L=Math.max(C.settings.capacityPerHour,...P.hours.map(e=>e.coversHigh)),I=(0,i.showTakeaway)(C),[N,O]=(0,t.useState)(I),_=D.filter(e=>e.date>=S).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),z=Math.min(T,900)-60,Y=e=>E.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,p.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,p.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:H===e,onPress:()=>R(e),testID:`forecast-range-${e}`},e))});return P.enough?(0,p.jsxs)(a.default,{style:{gap:12},children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsxs)(d.Muted,{children:["Hourly labels use the upper end of the Covers range. Steady starts at ",P.busy.steady,"; Busy starts at ",P.busy.busy,"."]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(d.T,{weight:"semibold",colour:u.colours.gold,children:["Today by hour \xb7 ",(0,c.niceDate)($)]}),P.example?(0,p.jsx)(b.ExampleBadge,{}):(0,p.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),P.open?(0,p.jsx)(y.Bars,{data:P.hours.map(e=>({key:String(e.hour),label:String(e.hour),a:e.booked,b:e.walkIns})),max:L,highlight:P.nextHour?String(P.nextHour.hour):void 0}):(0,p.jsx)(d.Muted,{children:"Closed today."}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#9C7C45'}}),(0,p.jsx)(d.Muted,{children:"Booked"})]}),(0,p.jsxs)(d.Row,{gap:4,children:[(0,p.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#6B5A3A'}}),(0,p.jsx)(d.Muted,{children:"Expected walk-ins and later bookings"})]})]}),P.hours.map(e=>{const t=(0,y.busyLevel)(e.coversHigh,P.busy.busy);return(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{size:14,children:(0,x.fmtH)(e.hour)}),(0,p.jsxs)(d.T,{size:14,colour:u.colours.muted,children:[(0,s.coversRange)(e.coversLow,e.coversHigh),I?` \xb7 about ${e.takeaway} takeaway`:'']}),(0,p.jsx)(d.T,{size:14,weight:"semibold",colour:t.colour,children:t.label})]},e.hour)})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),P.suggestions.map((e,s)=>(0,p.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,p.jsx)(d.Muted,{children:P.example?`${l.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Next ",H," days (covers)"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Covers for the next ${H} days`}),E.filter(e=>e.f.flags.length).map(e=>(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",colour:I?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,p.jsx)(d.Button,{small:!0,kind:"ghost",label:N?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>O(!N)})]}),N?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,p.jsx)(j.LineChart,{width:z,series:[P.hours.map(e=>e.takeaway),P.hours.map(e=>e.takeawayPlaced)],labels:P.hours.map(e=>String(e.hour))}),(0,p.jsxs)(d.Row,{gap:12,children:[(0,p.jsx)(d.Muted,{children:"Gold: forecast"}),(0,p.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.map(s=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(s.title)}),(0,p.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,p.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${k(s.date,S)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${k(s.date,S)}`,body:`${s.title} at ${C.name} ${k(s.date,S)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,p.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${f(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:f(s.title),body:`${f(s.title)} at ${C.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,p.jsxs)(a.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,p.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:P.busy.words}),(0,p.jsx)(b.NotEnoughHistory,{weeks:P.minWeeks,booked:F}),(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",H," days"]}),G,(0,p.jsx)(j.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${H} days`}),(0,p.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,p.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),_.slice(0,6).map(e=>(0,p.jsxs)(d.Card,{children:[(0,p.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(e.title)}),(0,p.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,p.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,p.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=e(_r(_d[3])),r=e(_r(_d[4])),d=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),j=_r(_d[14]),b=_r(_d[15]),p=_r(_d[16]);const k=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},f=e=>`${(0,o.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1393,[1120,34,1075,102,426,794,848,1122,851,827,840,865,1147,1100,1366,1125,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1394,[815]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=P,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,x]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)).slice(0,8),R=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),A=R.filter(e=>'due'===e.state||'overdue'===e.state),M=R.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,B.jsxs)(o.default,{style:{gap:12},children:[(0,B.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),b?(0,B.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,B.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,B.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,B.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,B.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,B.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===A.length?(0,B.jsx)(i.Muted,{children:"Nothing due right now."}):null,A.map(e=>(0,B.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,y.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,B.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,B.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),M.map(e=>(0,B.jsxs)(i.Muted,{children:[(0,y.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,y.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,B.jsx)(k.SectionHead,{title:"Live orders",right:(0,B.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,B.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,B.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,B.jsx)(P,{o:e},e.id)),v.length?(0,B.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,B.jsx)(i.Card,{style:{opacity:.7},children:(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,B.jsx)(O,{onClose:e=>{h(!1),e&&x(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),x=_r(d[13]),y=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]);const R={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function O({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),y=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,R]=(0,r.useState)(''),[O,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[N,$]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,F]=(0,r.useState)(''),[_,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,x.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries(N).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(y.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.ukPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(_),J=K.length>0&&Y&&(Q?O.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(y.map(e=>e.section)));return(0,B.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,B.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,B.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,B.jsx)(i.Field,{label:"Table number",value:O,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,B.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:R,placeholder:"e.g. Mrs Reid"}),Q?null:(0,B.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:F,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,B.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,B.jsx)(i.Field,{label:"Email (optional)",value:_,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too"}),'phone'===T?(0,B.jsxs)(o.default,{style:{gap:4},children:[(0,B.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,B.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,B.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,B.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),y.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,B.jsxs)(o.default,{style:{flex:1},children:[(0,B.jsx)(i.T,{size:15,children:e.name}),(0,B.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,B.jsx)(i.Stepper,{value:N[e.id]??0,min:0,max:20,label:e.name,onChange:t=>$({...N,[e.id]:t})})]},e.id)),(0,B.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,B.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,B.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,B.jsx)(l.GreensideCashOnly,{}):(0,B.jsx)(i.Banner,{kind:"demo",title:"Card payments: not set up yet",children:"Pay on collection or at the table. Nothing is charged in the app."}),(0,B.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?O.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:_.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${O.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function P({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),x=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,B.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,y.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",R[e.channel??(e.type,'app')]," \xb7 ",(0,y.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,B.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,B.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,B.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,B.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,B.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,B.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,y.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,B.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,B.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,B.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,B.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:x,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,B.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,B.jsx)(i.Button,{small:!0,kind:"ghost",label:"Reject",onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1395,[5,1342,829,1311,34,102,794,848,850,855,830,836,1134,1104,827,840,1147,1100,1135,1136,838,1348,833,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return le}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),p=_r(d[8]),b=_r(d[9]),h=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),v=_r(d[16]),w=_r(d[17]),E=_r(d[18]),N=_r(d[19]),P=_r(d[20]),W=_r(d[21]),A=_r(d[22]),T=_r(d[23]),R=_r(d[24]),M=(e=R)&&e.__esModule?e:{default:e},B=_r(d[25]),O=_r(d[26]),G=_r(d[27]),x=_r(d[28]),D=_r(d[29]),I=_r(d[30]),L=_r(d[31]),H=_r(d[32]),F=_r(d[33]),_=_r(d[34]),Q=_r(d[35]),V=_r(d[36]),q=_r(d[37]),U=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),$=_r(d[42]),J=_r(d[43]),K=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),ae=_r(d[49]),se=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),de=_r(d[55]);const le=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},ue=e=>n.CAN.manage(e);(0,y.register)([{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>ue(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:ue,C:o.ServiceBoard},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:ue,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:ue,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',badge:'NEW',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:ue,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:ue,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:ue,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:ue,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:b.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:ue,badge:'NEW',C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:h.PLAN_SUB,group:'Account',can:n.CAN.billing,C:h.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',badge:'NEW',C:W.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',badge:'NEW',C:N.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:N.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',badge:'NEW',can:ue,C:P.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:N.Timesheets}]),(0,y.register)([{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:A.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:A.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',badge:'NEW',can:ue,C:w.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',badge:'NEW',can:ue,C:E.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'Photo of the cash up sheet, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',badge:'NEW',can:ue,C:v.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:A.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:A.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:A.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:ue,C:A.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:ue,C:A.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:ue,C:A.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:ue,C:A.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:ue,C:A.ReviewEmailSettings},{id:'compliance',title:'Daily checks & allergen log',sub:'Fridge temps, opening checks, audit log',group:'Compliance',C:A.Compliance},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:A.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:ue,badge:'NEW',C:A.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:A.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:T.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>le(),C:T.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:ue,C:T.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:ue,C:T.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:T.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:ue,C:T.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:ue,C:T.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:ue,C:T.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:ue,C:T.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:T.TabletPreview}]);const ge=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',badge:'NEW',C:()=>M.default.createElement(O.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:B.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',badge:'NEW',can:ge,C:B.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',badge:'NEW',can:ge,C:O.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',badge:'NEW',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:G.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',badge:'NEW',C:x.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:ue,C:x.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:ue,badge:'NEW',C:x.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:ue,badge:'NEW',C:D.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:ue,badge:'NEW',C:D.DisplaySettingsPage}]);const ce=e=>'owner'===e||'manager'===e;I.ASSISTANT_AVAILABLE&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ce,badge:'NEW',C:I.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off, voice, connected services',group:'Account',can:ce,C:I.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',badge:'NEW',can:e=>'owner'===e&&!r.IS_CAR,C:H.CarScreen}]);const pe=e=>'owner'===e||'manager'===e,be=()=>{const e=l.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,u.costsAllowedFor)(t)},he=e=>pe(e)&&be();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:pe,badge:'NEW',C:L.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Creator},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:he,badge:'NEW',C:L.SafetyPages.Prices},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning, allergen checks; filters; CSV and print for the EHO',group:'Compliance',can:pe,badge:'NEW',C:L.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:pe,badge:'NEW',C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',badge:'NEW',C:L.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:ue,badge:'NEW',C:F.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:ue,badge:'NEW',C:F.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:ue,badge:'NEW',C:F.Outbox}]);const fe=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:fe,badge:'NEW',C:Q.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:fe,badge:'NEW',C:_.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:fe,badge:'NEW',C:V.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:fe,badge:'NEW',C:q.OrderSheetSettings},...U.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:fe,C:(0,_.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:fe,badge:'NEW',C:Y.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:fe,badge:'NEW',C:j.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:ue,badge:'NEW',C:j.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:fe,badge:'NEW',C:j.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:fe,badge:'NEW',C:z.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:ue,badge:'NEW',C:$.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:ue,badge:'NEW',C:$.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:ue,badge:'NEW',C:$.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:ue,badge:'NEW',C:J.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos, Show me where, or ask the Assistant',group:'Start here',can:ue,badge:'NEW',C:K.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:ue,badge:'NEW',C:Z.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, Booker and Bidfood lists, offers, events and specials the voice helper prepared; nothing is sent',group:'Run the day',can:ue,badge:'NEW',C:ee.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift, left by voice or typing',group:'Run the day',badge:'NEW',C:ee.ShiftNotesPage},{id:'voice',title:'Voice helper',sub:'Hold-to-talk input, text-only replies, who gets it and microphone privacy',group:'Settings',can:ue,badge:'NEW',C:ee.VoiceSettingsPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(te.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update',group:'Compliance',can:pe,badge:'NEW',C:function(){return M.default.createElement(ae.FoodSafetyCard,null)}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,se.useCtx)(6e4),o=(0,se.useSignedIn)();return M.default.createElement(ie.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:pe,badge:'NEW',C:function(){const{rid:e,today:t}=(0,se.useCtx)(6e4);return M.default.createElement(ie.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',badge:'NEW',C:function(){const{rid:e,me:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(re.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:ue,badge:'NEW',C:X.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',badge:'NEW',C:function(){const{me:e,role:t}=(0,se.useCtx)(6e4),s=(0,se.useSignedIn)();return M.default.createElement(oe.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:ue,C:ne.NightlyReportPage},{id:'support',title:'Chat with CoverCharge support',sub:'A message to the CoverCharge team',group:'Start here',can:ue,C:de.SupportChatPage}])},1396,[806,1397,846,1400,865,997,988,800,855,1402,1409,1419,1379,1420,1421,1423,1424,1425,1426,1155,1157,1428,1377,1429,34,1154,1145,1378,1367,1380,1413,1434,1435,1436,1370,1357,1384,1437,925,1438,1439,1440,1151,1385,1441,1311,1386,1453,1082,1043,1100,1156,1130,1454,1457,1460]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LookBackResult=k,_e.monthCells=v,_e.calendarDayLabel=C,_e.LookBackCalendar=T,_e.LookBack=function(){const{rid:e,today:s}=(0,d.useCtx)(3e4),[o,l]=(0,t.useState)((0,c.addDays)(s,-1)),[x,j]=(0,t.useState)((0,b.ukHistoryDate)(o)),[p,f]=(0,t.useState)(0),[m,D]=(0,t.useState)(!1),v=(0,u.useHistoricalBookingDay)(e,o,s,p),C=(0,b.parseHistoryInput)(x),w=!!C&&(0,b.validPastDate)(C,s);if(!v.allowed)return(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"Sign in to the Managers app with manager or owner access to Look back."})});const $=e=>{l(e),j((0,b.ukHistoryDate)(e))};return(0,h.jsxs)(i.default,{style:{gap:14},testID:"look-back",children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Look back"}),(0,h.jsx)(n.T,{size:18,center:!0,children:"Find bookings for one exact past date. Read-only; nothing is sent or changed."}),(0,h.jsx)(n.Field,{label:"Past booking date (DD MM YYYY)",value:x,onChangeText:j,placeholder:"05 11 2025",accessibilityLabel:"Exact past booking date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"look-back-date",style:{textAlign:'center'}}),w?null:(0,h.jsx)(n.T,{size:18,center:!0,children:"Enter a past date as DD MM YYYY, for example 09 11 2026, including the four-digit year."}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Pick a date",testID:"look-back-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,c.longDay)(o)}`,onPress:()=>D(!0)}),(0,h.jsx)(n.Button,{label:"Show bookings",accessibilityLabel:`Look back at bookings for ${w&&C?(0,b.historyDateLabel)(C):'a valid past date'}`,disabled:!w,onPress:()=>{C&&$(C),f(p+1)}})]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{kind:"secondary",label:"Previous day",accessibilityLabel:`Previous day, ${(0,c.longDay)((0,c.addDays)(o,-1))}`,onPress:()=>$((0,c.addDays)(o,-1))}),(0,h.jsx)(n.Button,{kind:"secondary",label:"Next day",accessibilityLabel:`Next day, ${(0,c.longDay)((0,c.addDays)(o,1))}`,disabled:!(0,b.validPastDate)((0,c.addDays)(o,1),s),onPress:()=>$((0,c.addDays)(o,1))})]})]})}),(0,h.jsx)(T,{visible:m,today:s,selected:o,onClose:()=>D(!1),onPick:e=>{$(e),D(!1)}}),v.data?(0,h.jsx)(k,{day:v.data}):(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:v.error||'Loading booking history\u2026'})})]})};var t=r(_d[0]),s=e(t),o=e(r(_d[1])),l=e(r(_d[2])),i=e(r(_d[3])),n=r(_d[4]),c=r(_d[5]),d=r(_d[6]),u=r(_d[7]),b=r(_d[8]),y=r(_d[9]),h=r(_d[10]);function k({day:e}){return(0,h.jsxs)(i.default,{testID:"look-back-result",style:{gap:14},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.T,{size:24,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:(0,b.historyDateLabel)(e.date)}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`Booked Covers: ${null===e.booked_covers?'not recorded':e.booked_covers}`,children:[(0,h.jsx)(n.T,{size:20,children:"Booked Covers"}),(0,h.jsx)(n.T,{size:36,weight:"bold",colour:y.colours.gold,children:null===e.booked_covers?'Not recorded':e.booked_covers})]}),e.historical_records?(0,h.jsx)(n.T,{size:20,colour:y.colours.gold,weight:"semibold",children:b.HISTORY_LABEL}):null,(0,h.jsx)(n.T,{size:18,children:b.HISTORY_NOTE}),e.missing_covers?(0,h.jsxs)(n.T,{size:18,children:[e.missing_covers," booking records have no party size; not filled in."]}):null]})}),e.bookings.length?null:(0,h.jsx)(n.Card,{children:(0,h.jsx)(n.T,{size:20,children:"No booking records found for this date. The history is incomplete; this does not prove there were no bookings."})}),e.bookings.map((e,t)=>(0,h.jsx)(n.Card,{children:(0,h.jsxs)(i.default,{testID:"look-back-booking",style:{gap:8},accessible:!0,accessibilityLabel:`${e.time??'Time not recorded'}, party size ${null===e.covers?'not recorded':`${e.covers} Covers`}, ${e.table?`table ${e.table}`:'table not recorded'}, ${e.status??'status not recorded'}${e.counted?'':', excluded from Booked Covers'}`,children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:20,children:[(0,h.jsx)(n.T,{size:26,weight:"bold",colour:y.colours.gold,children:e.time??'Time not recorded'}),(0,h.jsxs)(n.T,{size:22,children:["Party size: ",null===e.covers?'Not recorded':`${e.covers} Covers`]})]}),(0,h.jsxs)(n.T,{size:20,children:["Table: ",e.table??'Not recorded']}),(0,h.jsxs)(n.T,{size:18,children:[e.status??'Status not recorded',e.counted?'':' \xb7 excluded from Booked Covers']}),(0,h.jsxs)(n.T,{size:18,colour:y.colours.muted,children:['favourite_table'===e.source?'previous booking system':'CoverCharge'," \xb7 ",e.ref]})]})},`${e.source}:${e.ref}:${t}`))]})}const x=['January','February','March','April','May','June','July','August','September','October','November','December'],j=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],p=e=>String(e).padStart(2,'0'),f=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=(e,t)=>{const[s,o]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1+t,1,12));return`${l.getUTCFullYear()}-${p(l.getUTCMonth()+1)}`},D=e=>{const[t,s]=e.split('-').map(Number);return`${x[s-1]} ${t}`};function v(e){const[t,s]=e.split('-').map(Number),o=new Date(Date.UTC(t,s,0)).getUTCDate();return[...Array(f(`${e}-01`)).fill(null),...Array.from({length:o},(t,s)=>`${e}-${p(s+1)}`)]}function C(e,t,s){const o=(0,b.validPastDate)(e,t);return`${(0,c.longDay)(e)}${e===t?', today':''}${e===s?', selected':''}${o?'':', not available. Look back is for past days only'}`}function T({visible:e,today:d,selected:u,onPick:k,onClose:x}){const[p,f]=(0,t.useState)(u.slice(0,7)),[T,w]=(0,t.useState)(0);s.default.useEffect(()=>{e&&f(u.slice(0,7))},[e,u]);const $=v(p),L=m(p,-1),z=m(p,1),P=`${z}-01`I>=46?e.slice(0,3):e.slice(0,2);return(0,h.jsx)(n.Sheet,{visible:e,onClose:x,title:"Pick a day",maxWidth:420,testID:"look-back-calendar",footer:(0,h.jsx)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,h.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:"look-back-cal-close",onPress:x})}),children:(0,h.jsxs)(i.default,{style:{gap:10,alignItems:'stretch'},children:[(0,h.jsx)(n.T,{size:20,weight:"bold",colour:y.colours.goldLight,center:!0,accessibilityRole:"header",testID:"look-back-cal-month",children:D(p)}),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:`Previous month, ${D(L)}`,testID:"look-back-cal-prev",onPress:()=>f(L)}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:P?`Next month, ${D(z)}`:`Next month, ${D(z)}, not available. Look back is for past days only`,disabled:!P,testID:"look-back-cal-next",onPress:()=>f(z)})]}),(0,h.jsxs)(i.default,{onLayout:e=>w(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,h.jsx)(i.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:j.map(e=>(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,h.jsx)(n.T,{size:13,colour:y.colours.muted,center:!0,children:S(e)})},e))}),(0,h.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:"look-back-cal-grid",children:$.map((e,t)=>{if(!e)return(0,h.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`blank-${t}`);const s=(0,b.validPastDate)(e,d),x=e===u;return(0,h.jsx)(l.default,{testID:`look-back-cal-${e}`,accessibilityRole:"button",accessibilityLabel:C(e,d,u),accessibilityState:{selected:x,disabled:!s},disabled:!s,onPress:()=>{k(e),o.default.announceForAccessibility?.(`Looking back at ${(0,c.longDay)(e)}`)},style:{width:"14.285714285714286%",height:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:x||e===d?1.5:0,borderColor:y.colours.gold,backgroundColor:x?y.colours.goldTint:'transparent',opacity:s?1:.35},children:(0,h.jsx)(n.T,{size:17,weight:x?'bold':'regular',colour:x?y.colours.goldLight:y.colours.text,center:!0,children:Number(e.slice(8))})},e)})})]})]})})}},1397,[34,281,402,102,794,1347,1100,1398,1399,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1398,[34,846,1399,827,985,931]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1399,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return k}}),_e.DashCorners=I,_e.ServiceBoard=function(){const{role:e}=(0,j.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,D.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,D.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,D.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,D.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,D.jsx)(I,{onLeave:y}),(0,D.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,D.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,D.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,D.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,D.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,D.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?w((0,D.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]),D=r(d[16]);const k=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function C({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,D.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,D.jsxs)(s.default,{children:[(0,D.jsx)(p.Icon,{name:t,colour:h.colours.gold}),u?(0,D.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,D.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function I({onLeave:e}){const t=(0,x.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>y.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,D.jsx)(C,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,D.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,D.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:k.filter(e=>'left'===e.side).map(n)}),(0,D.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[k.filter(e=>'right'===e.side).map(n),(0,D.jsx)(C,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')}),(0,D.jsx)(f.VoiceSlot,{size:44,layer:1})]})]})}function w(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[17]);return t(e,document.body)}},1400,[34,395,236,402,102,36,794,1041,1279,865,840,1116,1401,1153,1394,1100,25,277]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1401,[815]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, take a picture of the taking sheet and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1402,[796,1376,34,836,102,794,865,840,1100,899,924,1403,985,994,1047,1374,1404,1405,1407,1012,1408,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1403,[]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffDisplayControls=function({m:e}){const s=(0,p.usePinStatus)(t=>t[e.id]),[c,m]=(0,l.useState)(''),[h,y]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),b='owner'===e.role||'manager'===e.role?6:4,j=async()=>{S(!0);const t=await(0,p.setStaffPin)(e.id,c,b);S(!1),m(''),y(t.ok?`PIN ${s?.hasPin?'reset':'set'}. Tell ${e.name} in person; it isn\u2019t shown again.`:t.error??'Could not set the PIN.'),t.ok&&(0,p.refreshPinStatus)()};return(0,f.jsxs)(n.default,{testID:`display-controls-${e.id}`,style:{gap:6,paddingTop:4},children:[(0,f.jsx)(o.Toggle,{testID:`display-clock-${e.id}`,label:"Can clock in at the Display",value:!!e.displayClock,onChange:t=>u.useOwner.getState().updateStaff(e.id,{displayClock:t})}),e.displayClock?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Muted,{size:12,children:s?.locked?'PIN locked (5 wrong tries)':s?.hasPin?e.temp?'Code set':'PIN set':'No PIN yet'}),(0,f.jsx)(t.TextInput,{testID:`pin-input-${e.id}`,accessibilityLabel:`New PIN for ${e.name}`,value:c,onChangeText:e=>m(e.replace(/\D/g,'').slice(0,8)),placeholder:`${b}\u20138 digits`,placeholderTextColor:r.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",maxLength:8,style:{width:110,minHeight:34,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:`set-pin-${e.id}`,label:s?.hasPin?'Reset PIN':'Set PIN',disabled:x||c.length{j()}})]}):null,h?(0,f.jsx)(o.Muted,{children:h}):null,e.temp?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Badge,{kind:"gold",label:"Temp"}),(0,f.jsxs)(o.Muted,{size:12,children:[e.tempUntil?`Until ${e.tempUntil}`:'No end date'," \xb7 Display only, no phone app"]}),(0,f.jsx)(o.Button,{small:!0,kind:"ghost",testID:`make-full-${e.id}`,label:"Make full staff",onPress:()=>u.useOwner.getState().updateStaff(e.id,{temp:!1,tempUntil:void 0,job:'Temp'===e.job?'':e.job})})]}):null]})},_e.AddTempStaffButton=function({initialOpen:e}){const[t,s]=(0,l.useState)(!!e),[n,r]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),[y,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{(0,p.refreshPinStatus)()},[]);const S=()=>{s(!1),x(null),h(null)},b=async e=>{r(!0);const t=await(0,p.addTempStaff)(e);r(!1),t.ok&&t.ref&&t.code?(u.useOwner.setState(l=>({staff:[...l.staff.filter(e=>e.id!==t.ref),{id:t.ref,name:t.name??e.name,role:'staff',job:'Temp',active:!0,level:'Staff',dept:e.dept??'',displayClock:!0,temp:!0,tempUntil:e.until??void 0}],hourly:null!=e.rate?{...l.hourly,[t.ref]:Math.round(100*e.rate)}:l.hourly})),x({name:t.name??e.name,code:t.code})):h(t.error??'Could not add them.')};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Button,{testID:"add-temp-btn",kind:"secondary",label:"Add temp staff",onPress:()=>s(!0)}),t?(0,f.jsx)(o.Sheet,{visible:!0,onClose:S,title:y?'Temp added':'Add temp staff',maxWidth:560,testID:"add-temp",children:y?(0,f.jsx)(c.TempCode,{name:y.name,code:y.code,onClose:S}):(0,f.jsx)(c.AddTempForm,{busy:n,error:m,onSubmit:e=>{b(e)}})}):null]})};var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),n=(e=s)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),u=_r(d[5]),p=_r(d[6]),c=_r(d[7]),f=_r(d[8])},1404,[796,34,102,794,840,865,1321,1332,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AutoClockToggle=function({m:e}){const o=(0,s.useAutoClock)(t=>!!t.on[e.id]),[r,h]=(0,t.useState)(null);(0,t.useEffect)(()=>{(0,s.refreshAutoClock)()},[]);const f=e.name.replace(' (example)','');return(0,c.jsxs)(l.default,{testID:`auto-clock-${e.id}`,style:{gap:2,paddingTop:4},children:[(0,c.jsx)(n.Toggle,{testID:`auto-clock-toggle-${e.id}`,label:"Auto clock from rota",a11y:`Auto clock ${f} in and out at their rota times`,value:o,onChange:t=>{h(null),(0,s.setAutoClock)(e.id,t).then(e=>{e.ok||h(e.error??'Couldn\u2019t save.')})}}),(0,c.jsx)(n.Muted,{size:12,children:o?`${f} is clocked in at the start and out at the end of each rota shift, so they show in On now. Marked \u201cAuto from rota\u201d in Hours: you can still change the times and sign them off.`:`For someone who can\u2019t use the app: clocks ${f} in and out at their rota times.`}),r?(0,c.jsx)(n.T,{size:12,colour:u.colours.amber,children:r}):null]})};var e,t=_r(d[0]),o=_r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},n=_r(d[2]),s=_r(d[3]),u=_r(d[4]),c=_r(d[5])},1405,[34,102,794,1406,840,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAutoClock",{enumerable:!0,get:function(){return r}}),_e.refreshAutoClock=async function(){if(o.PITCH)return;const e=c();if(!e)return;try{const{data:n,error:o}=await(0,t.getSupabase)().from('staff_auto_clock').select('staff_ref, enabled').eq('venue_id',e);if(o||!n)return;const c={};for(const e of n)c[e.staff_ref]=!!e.enabled;r.setState({on:c,loaded:!0})}catch{}},_e.setAutoClock=async function(e,n){const s=r.getState().on[e]??!1;if(r.setState(t=>({on:{...t.on,[e]:n}})),o.PITCH)return{ok:!0};const u=c();if(!u)return r.setState(t=>({on:{...t.on,[e]:s}})),{ok:!1,error:'Not connected to the venue, so this can\u2019t be changed right now.'};try{const{error:o}=await(0,t.getSupabase)().rpc('set_staff_auto_clock',{p_venue:u,p_staff_ref:e,p_on:n});if(o)throw o;return{ok:!0}}catch(t){r.setState(t=>({on:{...t.on,[e]:s}}));const n=String(t?.message??'');return{ok:!1,error:/managers and owners/i.test(n)?'Only managers and owners can change auto clock.':'Couldn\u2019t save. Check the signal and try again.'}}};var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),o=_r(d[3]);const r=(0,e.create)(()=>({on:o.PITCH?{'st-jack':!0}:{},loaded:o.PITCH})),c=()=>n.useSync.getState().venueId},1406,[815,931,985,2]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1407,[34,102,794,840,993,1037,985,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setCanChangeBookings=async function(o,s){const c=n.useSync.getState().venueId;if(!c||'staff'!==n.useSync.getState().kind)return{ok:!1,error:'Saved on this device. Connect to the shared team to store it for everyone.'};const h=(0,t.getSupabase)();try{const{error:t}=await h.rpc('set_can_change_bookings',{p_venue:c,p_staff_ref:o,p_on:s});return t?{ok:!1,error:/owner or manager/i.test(t.message)?'Only an owner or manager can change this.':'Saved on this device. The server did not take the change.'}:{ok:!0}}catch{return{ok:!1,error:'Saved on this device. The server did not take the change.'}}};var t=r(d[0]),n=r(d[1])},1408,[931,985]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PRICING_AVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_VOICE_LINE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_SUPPLIER_LINE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DONE_FOR_YOU",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"doneForYouLine",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return v}}),_e.PlanBilling=function(){const{now:e,role:n,rid:b}=(0,p.useCtx)(6e4),j=(0,c.trialStatus)((0,l.defaultSimStart)(),e),[x,w]=(0,s.useState)(!1);return u.CAN.billing(n)?x?(0,y.jsx)(M,{onBack:()=>w(!1)}):(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(o.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,y.jsx)(t.VoiceUsageCard,{rid:b,now:e}),(0,y.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,y.jsxs)(i.default,{testID:"plan-founding",children:[(0,y.jsx)(o.T,{size:12,weight:"semibold",colour:h.colours.goldMuted,children:"FOUNDING OFFER \xb7 FIRST 50 VENUES"}),(0,y.jsxs)(o.T,{size:30,weight:"bold",children:["\xa349",(0,y.jsx)(o.T,{size:14,colour:h.colours.muted,children:" a month + VAT if applicable, per venue"})]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(o.Badge,{kind:"gold",label:"Every Full Restaurant Pro feature"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"One month free"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"\xa349 net locked in"})]}),(0,y.jsx)(o.Muted,{children:"Early adopter price for the first 50 venues: every Full Restaurant Pro App feature, including the owner's dashboard and admin and the voice Assistant. \xa349 net stays locked in while your subscription stays active."}),(0,y.jsxs)(o.T,{size:13,testID:"plan-early-done-for-you",children:["\u2713 ",T(P.early)]}),(0,y.jsx)(o.Muted,{children:"From venue 51, usual prices:"}),(0,y.jsxs)(i.default,{testID:"plan-usual-lite",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[k," \xb7 ",C," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:S}),O.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e)),(0,y.jsx)(o.T,{size:13,testID:"plan-lite-not-included",children:"Not included: the owner's dashboard and admin, or the voice Assistant."})]}),(0,y.jsxs)(i.default,{testID:"plan-usual-pro",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[_," \xb7 ",L," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:v}),R.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e))]}),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>w(!0),style:{marginTop:6}})]}),(0,y.jsx)(o.Card,{children:(0,y.jsxs)(i.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,y.jsx)(o.T,{weight:"bold",colour:h.colours.gold,children:"free"}),"."]}),(0,y.jsx)(o.Muted,{children:"Your own app would cost about \xa398 in store fees in the first year alone (Apple \xa378.99 a year in the UK, Google US$25 one-off), then \xa378.99 a year."})]})}),(0,y.jsx)(o.Muted,{children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, and subscribers get free lifetime 24/7 customer support. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{children:"Free trial"}),(0,y.jsxs)(o.T,{weight:"bold",colour:h.colours.gold,children:[j.daysLeft," day",1===j.daysLeft?'':'s'," left"]})]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(100*(1-j.daysLeft/j.total))}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),(0,y.jsxs)(o.Muted,{children:["Then \xa3",c.PLAN.monthlyPence/100," a month + VAT if applicable. The trial start date is not set up yet."]})]}),(0,y.jsx)(f.AssistantPlanCard,{}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{weight:"semibold",children:"Free lifetime customer support"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"Included"})]}),(0,y.jsx)(o.Muted,{children:"Free for as long as you subscribe, day or night. Setup is all done digitally. Support contact details: not set up yet."})]})]}):(0,y.jsx)(o.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),i=(e=n)&&e.__esModule?e:{default:e},o=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),p=r(d[8]),f=r(d[9]),y=r(d[10]);const b=!0,j='Founding offer, free trial, set-up guide',x='. The owner\'s dashboard and admin come with Full Restaurant Pro App (\xa399 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',w='Voice Assistant (hold to talk) for seating guests, marking tables as cleared, temperature logs and finding something in the app: fair usage 1,000 voice tasks a month per venue',A='Supplier links: open your suppliers\' ordering sites and keep order lists',P={lite:1,pro:3,early:3},T=e=>`${e} done-for-you ${1===e?'change':'changes'} a month`,k='Customer & Takeaway App',_='Full Restaurant Pro App',C='\xa349',L='\xa399',S='A lite version of CoverCharge: 3 core customer and takeaway functions tailored to you, set up digitally with the in-app guided setup and step-by-step guides, free lifetime 24/7 customer support while subscribed, and unlimited self-edits of your basic info. The owner\'s dashboard and admin, and the voice Assistant, are not included.',v='Every feature, every app, including the owner\'s dashboard and admin and the voice Assistant. Set up digitally with the in-app guided setup and step-by-step guides, the Assistant (fair use 300 tasks a month), free lifetime 24/7 customer support while subscribed, and unlimited self-edits.',O=['Customer app: menu, allergens, bookings and loyalty','Takeaway ordering','Set up digitally: in-app guided setup and step-by-step guides','Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits of your basic info',T(P.lite)],R=['Every feature, every app','The owner\'s dashboard and admin',A,'Set up digitally: in-app guided setup and step-by-step guides','The Assistant, fair use 300 tasks a month',w,'Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits',T(P.pro)],I=[['Choose your 3 core functions','Pick what matters most to you, for example menu & allergens, takeaway ordering or the stamp card.'],['Add your logo and colours','More \u203a Branding: upload your logo; the apps use it everywhere.'],['Check your opening hours','More \u203a Opening hours: set your normal week and any closed days.'],['Add your menu and allergens','Menu & allergens: add dishes, prices and the 14 allergens, then sign each dish off.'],['Invite your team','More \u203a Team: add staff so they can use CoverCharge for Staff.'],['Share the customer app','More \u203a Your apps: copy the link or show the QR code at the counter.'],['Try a test order','Place a test order in the customer app and watch it arrive.']];function M({onBack:e}){const[t,n]=(0,s.useState)([]);return(0,y.jsxs)(i.default,{style:{gap:10},testID:"setup-guide",children:[(0,y.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,y.jsx)(o.H2,{children:"Set-up guide"}),(0,y.jsxs)(o.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",t.length," of ",I.length," done."]}),(0,y.jsx)(i.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(i.default,{style:{height:8,width:`${Math.round(t.length/I.length*100)}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),I.map(([e,s],l)=>{const u=t.includes(l);return(0,y.jsx)(o.Card,{children:(0,y.jsxs)(o.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,y.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:u?h.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(o.T,{size:14,weight:"bold",colour:u?'#1a1610':h.colours.gold,children:u?'\u2713':String(l+1)})}),(0,y.jsxs)(i.default,{style:{flex:1,gap:4},children:[(0,y.jsx)(o.T,{weight:"semibold",children:e}),(0,y.jsx)(o.Muted,{children:s}),(0,y.jsx)(o.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>n(u?t.filter(e=>e!==l):[...t,l])})]})]})},e)}),(0,y.jsx)(o.Muted,{children:"Stuck? Free lifetime customer support is included while you subscribe. Ticks on this guide are not saved."})]})}},1409,[1410,34,102,794,819,865,1412,840,1100,1413,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceUsageCard=function({rid:e,now:o}){const h=(0,l.useVoiceUsage)(e,o);return(0,c.jsx)(s.Card,{children:(0,c.jsxs)(n.default,{testID:"voice-usage",style:{gap:6},children:[(0,c.jsx)(s.T,{weight:"semibold",children:h.line}),(0,c.jsx)(n.default,{style:{height:8,borderRadius:4,backgroundColor:t.colours.surface2,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${Math.min(100,Math.round(100*h.pct))}%`,height:8,backgroundColor:h.reached?t.colours.red:h.warn?t.colours.amber:t.colours.ok}})}),(0,c.jsxs)(s.Muted,{children:[l.VOICE_FAIR_USAGE,", shared by all of this venue\u2019s apps and devices. Food safety logging always works."]}),h.reached?(0,c.jsx)(s.Banner,{kind:"info",title:"Allowance reached for this month",children:l.REACHED_TEXT}):h.warn?(0,c.jsx)(s.Banner,{kind:"warn",title:"80% of this month\u2019s allowance used",children:"The voice helper keeps working until 1,000; it starts again on the 1st."}):null,(0,c.jsx)(s.Muted,{children:"For now the count is kept on each device; it will become one venue-wide count."})]})})},r(d[0]);var e,o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),l=r(d[4]),c=r(d[5])},1410,[34,102,794,840,1411,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1411,[808,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PLAN",{enumerable:!0,get:function(){return t}}),e.trialStatus=function(n,o){const l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),u=new Date(l.getFullYear(),l.getMonth()+t.trialMonths,l.getDate()),c=Math.max(0,Math.ceil((u.getTime()-o.getTime())/864e5));return{start:l,end:u,daysLeft:c,total:Math.round((u.getTime()-l.getTime())/864e5)}};const t={name:'CoverCharge',monthlyPence:4900,trialMonths:1,vatNote:'+ VAT if applicable'}},1412,[]); +__d(function(g,_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,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return S}}),_e.AssistantFab=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)(e=>e.enabled);return T(e)&&t?(0,k.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:y.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,k.jsx)(v,{size:22}),(0,k.jsx)(h.T,{weight:"bold",colour:A,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=S(e=>e.open),s=()=>S.getState().setOpen(!1),{rid:n,role:u,me:w}=(0,j.useCtx)(3e4),A=(0,x.useAssistant)(),B=R(),[P,O]=(0,o.useState)([]),[E,L]=(0,o.useState)(''),[z,W]=(0,o.useState)(!1),$=(0,o.useRef)(null),_=(0,o.useRef)(null);if((0,o.useEffect)(()=>{setTimeout(()=>$.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!T(u))return null;const N=(e,t,s)=>x.useAssistant.getState().record({at:(new Date).toISOString(),by:w,role:u,asked:e,action:t,outcome:s}),F=(e,t="result")=>O(s=>[...s,{id:I(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;L(''),O(e=>[...e,{id:I(),from:'you',text:t}]);try{s=await(0,m.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),O(e=>[...e,{id:I(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>O(s=>s.map(s=>s.id===e?{...s,state:t}:s)),V=async(e,t,s)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(s??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(C,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await b.repo.bookings.seatWalkIn(n,Number(o.party),s,'Added by Assistant'),s&&(0,p.resetTableLive)(n,s),F(`Done: Walk-in \xb7 ${o.party} seated${s?` at table ${s}`:' (table to assign)'}. It's in Bookings now.`),N(e.asked,t.title,'done');break}case'eightysix':await b.repo.menu.updateItem(String(o.itemId),{soldOut:Boolean(o.soldOut)}),F(o.soldOut?`Done: ${o.name} is marked sold out. Staff see it on the Display.`:`Done: ${o.name} is back on.`),N(e.asked,t.title,'done');break;case'price':await b.repo.menu.updateItem(String(o.itemId),{price:Number(o.pence)}),F(`Done: ${o.name} is now \xa3${(Number(o.pence)/100).toFixed(2)}.`),N(e.asked,t.title,'done');break;case'offer':f.useOwner.getState().addOffer({title:String(o.title),body:String(o.body),kind:'offer',live:!1}),F(`Done: draft offer \u201c${o.title}\u201d saved in Offers & specials (not live).`),N(e.asked,t.title,'done');break;case'rota':case'bookings':F(String(o.result)),N(e.asked,t.title,'looked up')}},G=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===A.tier,Y=(0,x.tasksUsed)(A);return(0,k.jsx)(a.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:s,children:(0,k.jsx)(c.default,{style:[h.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(c.default,{testID:"assistant-sheet",style:{backgroundColor:y.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:y.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:8,style:{flex:1},children:[(0,k.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:18})}),(0,k.jsx)(h.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,k.jsx)(r.default,{accessibilityLabel:"Close",onPress:s,hitSlop:10,children:(0,k.jsx)(h.T,{size:22,colour:y.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(c.default,{testID:"assistant-demo-badge",children:(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,k.jsxs)(c.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"info",title:"The Assistant is switched off in this preview",children:"Ask for things in plain English \u2014 add a walk-in, mark a dish sold out, check the rota, draft posts and replies \u2014 and confirm each one before anything happens. To use it, turn off the preview switch in More \u203a Account \u203a Assistant settings."}),(0,k.jsx)(h.Button,{kind:"secondary",label:"Close",onPress:s})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(l.default,{ref:$,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,k.jsxs)(c.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,k.jsxs)(h.T,{children:["Hi ",w.split(' ')[0]," \u2014 what can I do? I\u2019ll always show you what I\u2019m about to do and wait for you to confirm."]}),(0,k.jsx)(h.Muted,{children:"Try:"}),m.SUGGESTED_PROMPTS.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:y.colours.surface2},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,k.jsx)(c.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(h.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,k.jsx)(D,{m:e,onConfirm:(t,s)=>V(e,t,s),onCancel:()=>G(e)},e.id):'choose'===e.proposal.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,k.jsxs)(c.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:8},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]},e.id):(0,k.jsx)(c.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?y.colours.amberBg:y.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:y.colours.amber},children:(0,k.jsx)(h.T,{children:e.text})},e.id))]}),(0,k.jsxs)(h.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:E,onChangeText:L,onSubmitEditing:()=>H(E),returnKeyType:"send",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),A.voice?(0,k.jsx)(r.default,{testID:"assistant-mic",accessibilityRole:"button",accessibilityLabel:z?'Stop listening':'Speak',onPress:()=>{const e=M();if(e)if(z)_.current?.stop?.();else try{const t=new e;_.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&L(t)},t.onend=()=>W(!1),t.onerror=()=>{W(!1),F("Sorry, I didn't catch that. You can type instead.",'note')},W(!0),t.start()}catch{W(!1),F("Voice input isn't available here. Please type instead.",'note')}else F("Voice input isn't available in this browser (for example Huawei Browser). Please type your request instead.",'note')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:y.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:z?y.colours.gold:'transparent'},children:(0,k.jsx)(h.T,{size:20,children:"\ud83c\udfa4"})}):null,(0,k.jsx)(h.Button,{label:"Send",accessibilityLabel:"Send",disabled:!E.trim(),onPress:()=>H(E)})]}),(0,k.jsxs)(h.Muted,{center:!0,children:["Demo on this device \xb7 ",Y," of ",x.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,j.useCtx)(6e4),s=(0,x.useAssistant)();return T(t)?(0,k.jsxs)(c.default,{style:{gap:12},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(c.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(v,{size:22})}),(0,k.jsxs)(c.default,{style:{flex:1},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,k.jsx)(h.Muted,{children:"Add walk-ins, mark dishes sold out, change prices, check the rota or bookings, draft offers, posts and replies. You confirm every action."})]})]}),(0,k.jsx)(h.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>S.getState().setOpen(!0)}),(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,k.jsxs)(c.default,{testID:"assistant-log",style:{gap:6},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>x.useAssistant.getState().clearLog()}):null]}),(0,k.jsx)(h.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,k.jsx)(h.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,k.jsxs)(c.default,{style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.T,{size:12,colour:y.colours.muted,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,")"]}),(0,k.jsx)(h.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,k.jsxs)(h.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,k.jsxs)(h.T,{size:13,colour:y.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,k.jsx)(h.Muted,{children:"The activity log is visible to the owner."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)();return T(e)?(0,k.jsxs)(c.default,{style:{gap:12},testID:"assistant-settings",children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,k.jsx)(h.Muted,{children:"Shows the gold Assistant button on every Managers screen."}),(0,k.jsx)(h.Toggle,{label:"Voice input (microphone)",value:t.voice,onChange:e=>t.set({voice:e})}),(0,k.jsx)(h.Muted,{children:"What you say is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. If this device can\u2019t record, just type."})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,k.jsxs)(c.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:y.colours.border,paddingTop:8},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:e.name}),(0,k.jsx)(h.Badge,{kind:"neutral",label:"Not connected"})]}),(0,k.jsxs)(h.Muted,{children:["Needed for ",e.does,". Until it\u2019s connected, the Assistant only shows you a preview \u2014 nothing is sent or changed."]})]},e.id)),(0,k.jsx)(h.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,k.jsx)(h.Muted,{children:"The Assistant comes with Full Restaurant Pro App and the early adopter offer. It isn\u2019t part of Customer & Takeaway App. This switch only shows how the app looks with it switched off."})]}):null,(0,k.jsx)(h.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to the voice assistant to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,x.useAssistant)(),t=(0,x.tasksUsed)(e),s=Math.min(1,t/x.FAIR_USE);return(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,k.jsx)(h.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,k.jsx)(c.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${x.FAIR_USE} tasks used`,style:{height:8,backgroundColor:y.colours.border,borderRadius:4},children:(0,k.jsx)(c.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:y.colours.gold,borderRadius:4}})}),(0,k.jsxs)(h.Muted,{children:[t," of ",x.FAIR_USE," tasks used this month (mock). A task is one confirmed action or look-up."]})]})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),o=_r(d[3]),a=e(_r(d[4]));_r(d[5]);var r=e(_r(d[6])),l=e(_r(d[7])),c=e(_r(d[8])),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),m=_r(d[14]),x=_r(d[15]),y=_r(d[16]),j=_r(d[17]),k=_r(d[18]);const w=!0,C='Nothing was sent or changed: this connection is not set up yet.',A='#1A1408',S=(0,u.create)(e=>({open:!1,setOpen:t=>e({open:t})})),T=e=>'owner'===e||'manager'===e,I=()=>Math.random().toString(36).slice(2,9);function v({size:e=24,colour:t=A}){return(0,k.jsx)(h.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function R(){const{rid:e,r:t,now:n,today:a}=(0,j.useCtx)(3e4),r=(0,b.useAllMenu)(e),l=(0,p.useTableNames)(e),c=(0,b.useBookings)(e),u=(0,f.useOwner)(e=>e.staff),h=(0,f.useOwner)(e=>e.shifts),m=(0,f.useOwner)(e=>e.offers),x=(0,f.useOwner)(e=>e.suppliers);return(0,o.useMemo)(()=>({venue:t.name,now:n.toISOString(),menu:r.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:l,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:h.filter(e=>e.published&&e.date>=(0,f.addDays)(a,-(0,f.weekdayOf)(a))&&e.date<=(0,f.addDays)(a,6-(0,f.weekdayOf)(a))),bookingsToday:c.filter(e=>e.date===a).sort((e,t)=>e.time.localeCompare(t.time)).map(e=>({name:e.walkIn?'Walk-in':e.name,party:e.partySize,time:e.time,table:e.table,status:e.status})),specials:m.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,s.examplesAllowed)()?{from:`${x[0]?.contact??'Alex Sample'}, ${x[0]?.name??'Example Fish Co.'}`,subject:'Price update for next week (example)',body:'Langoustine is up about 8% next week because of the weather. Haddock and hake unchanged. Same delivery days.'}:null}),[t,n.getMinutes(),r,l,c,u,h,m,x])}function D({m:e,onConfirm:s,onCancel:n}){const a=e.proposal,[r,l]=(0,o.useState)(!1),[u,p]=(0,o.useState)('external'===a.kind?a.text:''),b='open'===e.state;return'inapp'!==a.kind&&'external'!==a.kind?null:(0,k.jsxs)(c.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?y.colours.gold:y.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:y.colours.surface2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:a.title}),'external'===a.kind?(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,k.jsx)(h.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===a.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[a.detail?(0,k.jsx)(h.Muted,{children:a.detail}):null,(0,k.jsx)(h.T,{size:14,colour:y.colours.muted,children:a.label}),r&&b?(0,k.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:u,onChangeText:p,style:[h.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,k.jsx)(c.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:y.colours.gold,paddingLeft:10},children:(0,k.jsxs)(h.T,{children:["\u201c",u,"\u201d"]})}),(0,k.jsxs)(h.Muted,{children:["Sends to: ",a.service.map(e=>m.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,k.jsxs)(c.default,{style:{gap:4},children:[(0,k.jsx)(h.Muted,{children:a.detail}),a.warning?(0,k.jsxs)(h.T,{size:13,colour:y.colours.amber,children:["\u26a0 ",a.warning]}):null]}),b?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,k.jsx)(h.Button,{small:!0,label:'inapp'===a.kind?a.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(a,u)}),'external'===a.kind?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:r?'Done editing':'Edit',testID:"edit-action",onPress:()=>l(!r)}):null,(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,k.jsx)(h.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,k.jsxs)(h.Muted,{children:["Nothing happens until you tap ",'inapp'===a.kind?a.confirmLabel:'Confirm',"."]}):null]})}function M(){return'undefined'==typeof window?null:(0,n.speechRecognizer)()}const B=[{id:'facebook',name:'Facebook (Page & Messenger)',does:'posts and the Messenger auto-reply'},{id:'instagram',name:'Instagram',does:'posts'},{id:'gmail',name:'Gmail',does:'drafting and replying to email'},{id:'wix',name:'Website bookings',does:'website changes such as opening hours'}]},1413,[796,858,929,34,395,236,402,295,102,815,794,1096,848,865,1414,1418,840,1100,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"interpretDemo",{enumerable:!0,get:function(){return t.interpretDemo}}),e.getProvider=function(o="demo"){return'xai'===o?n.xaiProvider:t.demoProvider};var t=r(d[0]),n=r(d[1]),o=r(d[2]);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]}})})},1414,[1415,1417,1416]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.interpretDemo=u,Object.defineProperty(_e,"demoProvider",{enumerable:!0,get:function(){return m}});var e=r(_d[0]),t=r(_d[1]);const a=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],n=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,o=e=>e.toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').trim(),s=e=>o(e).replace(/\([^)]*\)/g,' ').split(/[^a-z0-9]+/).filter(e=>e.length>2&&!['the','and','with','our'].includes(e)),l={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},d=e=>e?l[e]??Number(e):NaN,c=e=>(e.match(/["\u201c\u201d']([^"\u201c\u201d]{3,})["\u201c\u201d']?\s*$/)||e.match(/\bto[:\s]+(.{3,})$/i)||[])[1]?.replace(/["\u201c\u201d]+$/,'').trim();function p(e,t){const a=s(t),n=e.menu.map(e=>{const n=s(e.name);return{m:e,hits:a.filter(e=>n.includes(e)).length,exact:o(e.name).includes(o(t))}}),l=n.filter(e=>e.exact);if(1===l.length)return[l[0].m];const d=Math.max(0,...n.map(e=>e.hits));if(!d)return[];const c=n.filter(e=>e.hits===d).map(e=>e.m);return d===a.length&&1===c.length?c:c.slice(0,4)}function u(s,l){const u=o(s),m=new Date(l.now);if(/messenger|auto-?reply|away message/.test(u)){return{kind:'external',intent:'messenger-autoreply',service:['messenger'],title:'Facebook Messenger auto-reply',label:'Change Messenger auto-reply to:',text:c(s)||`Thanks for getting in touch with ${l.venue}! We'll reply as soon as we can. To book a table, use our app.`}}if(/\b(post|share|publish)\b/.test(u)&&/facebook|instagram|\bfb\b|\binsta|\big\b|social/.test(u)){const e=/facebook|\bfb\b|social/.test(u),t=/instagram|\binsta|\big\b|social/.test(u),a=/special/.test(u)&&l.specials.length?`Tonight at ${l.venue}: ${l.specials.map(e=>e.title.replace(/\s*\(example\)/i,'')).join(' \xb7 ')}. Book in the app or just walk in!`:c(s)||`Tonight at ${l.venue} \u2014 come and see us!`,n=[...e?['facebook']:[],...t?['instagram']:[]];return{kind:'external',intent:'social-post',service:n,title:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}`,label:`Post to ${n.map(e=>'facebook'===e?'Facebook':'Instagram').join(' & ')}:`,text:a}}if(/(reply|respond|answer|draft).*(e-?mail|gmail|supplier)|(e-?mail|gmail).*(reply|draft)/.test(u)){const e=l.latestSupplierEmail;if(!e)return{kind:'unknown',message:"I can't read your email yet: CoverCharge isn't linked to Gmail. Paste the supplier's message here and I'll draft a reply for you to check and send yourself.",suggestions:[]};const t=`Hi ${e.from.split(' ')[0]},\n\nThanks for letting us know. That's fine for this week \u2014 please keep our usual standing order and let me know if anything changes.\n\nBest wishes,\n${l.venue}`;return{kind:'external',intent:'gmail-reply',service:['gmail'],title:`Gmail reply to ${e.from}`,label:`Reply to "${e.subject}" (${e.from}):`,text:t,detail:`Latest supplier email (example): "${e.body}"`}}if(/\bwix\b|website|web site/.test(u)&&/hour|open|clos/.test(u)){return{kind:'external',intent:'wix-hours',service:['wix'],title:'Website bookings opening hours',label:'Update website bookings opening hours to:',text:[1,2,3,4,5,6,0].map(e=>{const t=l.kitchenHours[e];return`${a[(e+6)%7]}: ${t?`${t[0]}\u2013${t[1]}`:'Closed'}`}).join('\n'),detail:'From the kitchen hours saved in CoverCharge.'}}const h=u.match(/walk-?in\b.*?\b(?:for|of)\s+(\d+|[a-z]+)(?:.*?\btable\s+([a-z]?\d+[a-z]?(?:\+\d+)?))?/)||u.match(/\b(\d+|[a-z]+)\s+walk-?ins?\b(?:.*?\btable\s+([a-z]?\d+))?/);if(h&&!Number.isNaN(d(h[1]))){const t=d(h[1]),a=h[2]?h[2].toUpperCase():'';if(a&&!l.tables.map(e=>e.toUpperCase()).includes(a))return{kind:'unknown',message:`There's no table ${a} on the table plan. Try one of: ${l.tables.slice(0,12).join(', ')}.`,suggestions:[`Add a walk-in for ${t} at table ${l.tables[0]}`]};const n=a?l.bookingsToday.find(e=>e.table?.toUpperCase().split('+').includes(a)&&['seated','confirmed'].includes(e.status)):void 0;return{kind:'inapp',intent:'walkin',title:`Seat a walk-in for ${t}${a?` at table ${a}`:''}`,detail:`Adds \u201cWalk-in \xb7 ${t}\u201d to today's bookings${a?` at table ${a}`:' (table to assign)'} and counts ${t} covers.`,confirmLabel:'Seat walk-in',params:{party:t,table:a},warning:n?`${(0,e.tableNumbers)(a)} also has a ${n.status} booking at ${n.time} (party of ${n.party}).`:void 0}}const b=u.match(/^(?:please )?(?:mark |set |make )?(?:the )?(.+?)\s+(?:as |to )?(?:86'?d?|86ed|sold out)(?=\W|$)/)||u.match(/^86 (?:the )?(.+)$/),f=u.match(/^(?:put |mark |set )?(?:the )?(.+?)\s+(?:back on|as available|available again|un-?86'?d?)/);if((b||f)&&!/walk|book|rota|price/.test(u)){const e=(b||f)[1].replace(/^mark |^set /,''),t=p(l,e),a=!!f&&!b;return 1===t.length?{kind:'inapp',intent:'eightysix',title:a?`Put ${t[0].name} back on`:`Mark ${t[0].name} sold out`,detail:a?'Takes it off the Sold out list and the Display.':'A reminder for staff: it shows on the Display and in the Sold out list until you put it back on. It doesn\'t change your till.',confirmLabel:a?'Back on':'Mark sold out',params:{itemId:t[0].id,name:t[0].name,soldOut:!a}}:t.length>1?{kind:'choose',message:`I couldn't find "${e}" exactly on the menu. Did you mean:`,options:t.map(e=>({label:e.name,prompt:`Mark ${e.name} sold out`}))}:{kind:'unknown',message:`I couldn't find "${e}" on the menu.`,suggestions:['Mark the Fish Supper sold out']}}const k=u.match(/(?:change|set|update|make)\s+(?:the\s+)?(?:price\s+of\s+(?:the\s+)?)?(.+?)\s+(?:price\s+)?to\s+\xa3?\s?(\d+(?:\.\d{1,2})?)/);if(k&&/\xa3|price|\d/.test(u)){const e=p(l,k[1].replace(/\s*price$/,'')),t=Math.round(100*Number(k[2]));if(1===e.length)return{kind:'inapp',intent:'price',title:`Change ${e[0].name} to \xa3${(t/100).toFixed(2)}`,detail:`Now ${null==e[0].price?'board price':`\xa3${(e[0].price/100).toFixed(2)}`}. Updates the menu in the customer app.`,confirmLabel:'Change price',params:{itemId:e[0].id,name:e[0].name,pence:t}};if(e.length>1)return{kind:'choose',message:'Which dish?',options:e.map(e=>({label:e.name,prompt:`Change the price of ${e.name} to \xa3${(t/100).toFixed(2)}`}))}}if(/rota|who'?s on|who is on|working|on shift/.test(u)){let e=(m.getDay()+6)%7,t='today';/tomorrow/.test(u)&&(e=(e+1)%7,t='tomorrow');const o=a.findIndex(e=>u.includes(e.toLowerCase()));o>=0&&(e=o,t=a[o]);const s=l.shifts.filter(t=>t.day===e).sort((e,t)=>e.start-t.start).map(e=>{const t=l.staff.find(t=>t.id===e.staffId);return`${t?.name??'Someone'} (${t?.job??''}) ${n(e.start)}\u2013${n(e.end)}`});return{kind:'inapp',intent:'rota',title:`Show the rota for ${t} (${a[e]})`,detail:'Read-only: looks up the rota saved in CoverCharge. Nothing is changed.',confirmLabel:'Show rota',params:{day:e,label:t,result:s.length?s.join('\n'):'Nobody is on the rota.'}}}if(/booking|covers|reservations?/.test(u)&&!/^(add|make|create)/.test(u)){const t=l.bookingsToday.filter(e=>!['cancelled','noshow'].includes(e.status)),a=t.map(t=>`${t.time} \xb7 ${t.name} \xb7 ${t.party}${t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:''} \xb7 ${t.status}`);return{kind:'inapp',intent:'bookings',title:"Show today's bookings",detail:'Read-only: looks up bookings saved in CoverCharge. Nothing is changed.',confirmLabel:'Show bookings',params:{result:`${t.length} bookings, ${t.reduce((e,t)=>e+t.party,0)} covers\n${a.join('\n')}`}}}if(/(draft|create|write|make|add).*(offer|deal|promo|special)/.test(u)){const e=(s.match(/(?:offer|deal|promo|special)\s+(?:for|on)\s+(.+)$/i)||[])[1]?.trim(),t=e?`${e[0].toUpperCase()}${e.slice(1)}`:'Midweek offer (draft)';return{kind:'inapp',intent:'offer',title:`Draft an offer: ${t}`,detail:'Saved as a draft in Offers & specials (not live, nothing sent). Edit it there before you publish.',confirmLabel:'Save draft',params:{title:t,body:e?`${t} at ${l.venue}. Ask your server for details.`:`A midweek treat at ${l.venue}. Add the details before you publish.`}}}return{kind:'unknown',message:"Sorry \u2014 I can't do that yet. Here are some things I can help with:",suggestions:t.SUGGESTED_PROMPTS.slice(1,6)}}const m={id:'demo',label:'On-device assistant',interpret:async(e,t)=>u(e,t)}},1415,[829,1416]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUGGESTED_PROMPTS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SERVICE_LABEL",{enumerable:!0,get:function(){return t}});const o=['Change our Facebook Messenger auto-reply to "Thanks for your message \u2014 we reply within the hour. To book, use the app."','Draft a reply to the latest supplier email','Add a walk-in for 4 at table 7',"Post tonight's specials to Facebook & Instagram",'Mark the fish pie sold out',"Who's on the rota tomorrow?",'Update website bookings opening hours'],t={facebook:'Facebook',messenger:'Facebook Messenger',instagram:'Instagram',gmail:'Gmail',wix:'Website bookings'}},1416,[]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_TOOLS",{enumerable:!0,get:function(){return o}}),e.callToText=a,e.interpretWithServer=s,Object.defineProperty(e,"xaiProvider",{enumerable:!0,get:function(){return u}});var t=_r(d[0]),n=_r(d[1]);const r=(t,n,r,o=[])=>({type:'function',function:{name:t,description:n,parameters:{type:'object',properties:r,required:o}}}),o=[r('walk_in','Seat a walk-in party now',{party:{type:'integer',description:'Number of covers'},table:{type:'string',description:'Table name, optional'}},['party']),r('sold_out','Mark a dish sold out, or put it back on',{dish:{type:'string',description:'Dish name'},back_on:{type:'boolean',description:'True to put it back on'}},['dish']),r('set_price','Change the menu price of a dish',{dish:{type:'string',description:'Dish name'},pounds:{type:'number',description:'New price in pounds'}},['dish','pounds']),r('show_rota','Show who is on the rota',{day:{type:'string',description:'today, tomorrow or a weekday'}}),r('show_bookings',"Show today's bookings and covers",{}),r('draft_offer','Draft an offer (saved as a draft, not live)',{what:{type:'string',description:'What the offer is for'}})];function a(t,n){const r=t=>String(n[t]??'').trim();switch(t){case'walk_in':return Number(n.party)>0?`walk-in for ${Number(n.party)}${r('table')?` table ${r('table')}`:''}`:null;case'sold_out':return r('dish')?n.back_on?`put ${r('dish')} back on`:`mark ${r('dish')} sold out`:null;case'set_price':return r('dish')&&Number(n.pounds)>0?`change the price of ${r('dish')} to \xa3${Number(n.pounds)}`:null;case'show_rota':return`who's on the rota ${r('day')||'today'}`;case'show_bookings':return"today's bookings";case'draft_offer':return"draft an offer"+(r('what')?` for ${r('what')}`:'');default:return null}}async function s(r,s,u=n.askServer){const c=(0,t.interpretDemo)(r,s);if('unknown'!==c.kind)return c;const p=await u('owner',r,o);if('call'===p.kind){const n=a(p.name,p.args);if(n){const r=(0,t.interpretDemo)(n,s);if('unknown'!==r.kind)return r}return c}return'text'===p.kind?{kind:'unknown',message:p.text,suggestions:[]}:c}const u={id:'xai',label:'Voice assistant (server, with on-device fallback)',interpret:s}},1417,[1415,930]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FAIR_USE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useAssistant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tasksUsed",{enumerable:!0,get:function(){return b}});var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]);const c=300,u=(0,s.create)()((0,l.persist)(e=>({enabled:!0,voice:!0,tier:'pro',baseUsed:41,log:[],set:t=>e(t),record:t=>e(e=>({log:[{...t,id:`as-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`},...e.log].slice(0,200)})),clearLog:()=>e({log:[]})}),{name:'covercharge-assistant-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:(e,t)=>t<2?{...e,enabled:!0,voice:!0}:e})),b=e=>((0,t.examplesAllowed)()?e.baseUsed:0)+e.log.filter(e=>['done','demo (nothing sent)','looked up'].includes(e.outcome)).length},1418,[858,808,815,818]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.InfoHours=function(){const{r:e}=(0,w.useCtx)(6e4),[t,s]=(0,d.useState)(e.tagline),[n,i]=(0,d.useState)(e.phone??''),[a,r]=(0,d.useState)(e.about??''),[o,h]=(0,d.useState)(e.kitchenHours),[g,x]=(0,d.useState)(!1);return(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"info",title:"Edit basic info yourself anytime",children:"Prices, sold-out, hours and specials are free to change on any plan, as often as you like."}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.location}),(0,T.jsx)(p.Field,{label:"Tagline",value:t,onChangeText:s}),(0,T.jsx)(p.Field,{label:"Phone",value:n,onChangeText:i,keyboardType:"phone-pad"}),(0,T.jsx)(p.Field,{label:"About",value:a,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Kitchen hours"}),k.map((e,t)=>{const s=P[t],n=o[s];return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{style:{width:44},children:e}),n?(0,T.jsxs)(p.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>h({...o,[s]:[e,n[1]]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,T.jsx)(p.T,{children:"\u2013"}),(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>h({...o,[s]:[n[0],e]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,T.jsx)(p.Muted,{style:{flex:1},children:"Closed"}),(0,T.jsx)(c.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>h({...o,[s]:e?['12:00','20:00']:null}),trackColor:{true:b.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:b.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,T.jsx)(p.Muted,{children:e.hoursNote}):null]}),(0,T.jsx)(p.Button,{label:"Save changes",onPress:()=>{R().updateRestaurant(e.id,{tagline:t,phone:n,about:a,kitchenHours:o}),x(!0)}}),g?(0,T.jsx)(p.Banner,{kind:"success",title:"Saved",children:"Shared with your other devices and the customer app. Guests see it next time they open the app."}):null]})},_e.Photos=function(){const e=(0,x.useOwner)(e=>e.photos),[t,s]=(0,d.useState)('');return i.LIVE_VENUE_BUILD?(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,T.jsx)(p.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Placeholder photos",children:"Adding photos from the camera or gallery isn\u2019t set up yet. Tiles stand in for uploaded photos."}),(0,T.jsx)(p.Row,{wrap:!0,gap:8,children:e.map(e=>(0,T.jsxs)(u.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,T.jsx)(p.T,{size:13,children:e.caption}),(0,T.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>x.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,T.jsx)(p.T,{size:13,colour:b.colours.gold,children:"Remove"})})]},e.id))}),(0,T.jsx)(p.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,T.jsx)(p.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{x.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:n,role:l}=(0,w.useCtx)(6e4),a=(0,g.useAllMenu)(t),[r,c]=(0,d.useState)(null),[h,x]=(0,d.useState)(!1),[f,m]=(0,d.useState)(5),[C,v]=(0,d.useState)([]),[k,P]=(0,d.useState)('all'),B=(0,g.useStore)(e=>e.menu),O=e=>!!B.find(t=>t.id===e)?.hidden,$=a.filter(e=>!e.signOff&&!O(e.id)).length;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Button,{small:!0,label:"Add dish",onPress:()=>c('new')}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{x(!h),v([])}}),!e||'owner'!==l&&'manager'!==l?null:(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),$?(0,T.jsx)(o.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,T.jsx)(p.Banner,{kind:"warn",title:`${$} dish${1===$?'':'es'} awaiting the head chef's sign-off`,children:"Allergens, section and price come from each dish\u2019s recipe card. The head chef signs cards off in the Head Chef app. Tap to open Recipe cards."})}):null,h?(0,T.jsx)(p.Banner,{kind:"warn",title:"Price changes reset sign-off",children:"Each dish\u2019s price is on its recipe card, so a price change sets that card back to \u201cAwaiting sign-off\u201d until the head chef signs it off."}):null,i.LIVE_VENUE_BUILD?(0,T.jsx)(p.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Scheduled menus"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:"All day",selected:'all'===k,onPress:()=>P('all')}),(0,T.jsx)(p.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>P('lunch')}),(0,T.jsx)(p.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>P('dinner')})]}),(0,T.jsx)(p.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,T.jsxs)(p.Card,{highlight:b.colours.gold,children:[(0,T.jsxs)(p.T,{weight:"semibold",children:["Bulk price edit \xb7 ",C.length," selected"]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Change by %"}),(0,T.jsx)(p.Stepper,{value:f,onChange:m,min:-30,max:30,label:"percent"})]}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>v(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,T.jsx)(p.Button,{small:!0,label:`Apply ${f>0?'+':''}${f}%`,disabled:!C.length||0===f,onPress:()=>{C.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&R().updateMenuItem(e,{price:5*Math.round(t.price*(100+f)/100/5)})}),v([])}})]}),(0,T.jsx)(p.Muted,{children:"Prices round to the nearest 5p."})]}):null,s.sections.map(e=>{const t=a.filter(t=>t.section===e&&('all'===k||'lunch'!==k||!/supper|steak|lobster/i.test(t.name)));return t.length?(0,T.jsxs)(u.default,{style:{gap:6},children:[(0,T.jsx)(y.SectionHead,{title:e}),t.map(e=>(0,T.jsxs)(u.default,{style:[p.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,T.jsx)(p.Toggle,{label:`select ${e.name}`,value:C.includes(e.id),onChange:t=>v(t?[...C,e.id]:C.filter(t=>t!==e.id))}):null,(0,T.jsxs)(o.default,{style:{flex:1},onPress:()=>c(e),accessibilityRole:"button",children:[(0,T.jsx)(p.T,{weight:"medium",children:e.name}),(0,T.jsxs)(p.Muted,{children:[null!=e.price?(0,j.gbp)(e.price):e.priceNote??'Board price'," \xb7 ",Object.keys(e.allergens).length," allergens \xb7 ",e.signOff?`signed off by ${e.signOff.by}, ${e.signOff.at}`:'awaiting sign-off']})]})]}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>(R().updateMenuItem(e.id,{soldOut:!e.soldOut}),(0,S.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,T.jsx)(p.Chip,{label:O(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:O(e.id),onPress:()=>R().updateMenuItem(e.id,{hidden:!O(e.id)})})]})]},e.id))]},e):null}),r?(0,T.jsx)(M,{item:'new'===r?null:r,onClose:()=>c(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:s}=(0,w.useCtx)(6e4),n=(0,g.useEvents)(t).filter(e=>e.restaurantId===t),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[h,x]=(0,d.useState)(null),f=(()=>{const e=a.trim(),t=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(e);if(t){const e=Number(t[1]),s=Number(t[2]);return e>=1&&e<=31&&s>=1&&s<=12?`${t[3]}-${String(s).padStart(2,'0')}-${String(e).padStart(2,'0')}`:''}return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:''})(),j=l.trim().length>2&&!!f&&!Number.isNaN((0,m.parseYmd)(f).getTime());return(0,T.jsxs)(u.default,{style:{gap:10},children:[n.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:t.date=s?(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{g.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),x(null)}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>x(null)})]}):(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>x(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Add an event"}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i,placeholder:"e.g. Seafood night"}),(0,T.jsx)(p.Field,{label:"Date (DD/MM/YYYY)",value:a,onChangeText:r,placeholder:"20/11/2026"}),(0,T.jsx)(p.Field,{label:"Description",value:o,onChangeText:c,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add event",disabled:!j,onPress:()=>{R().addEvent({restaurantId:t,date:f,title:l.trim(),kind:'event',description:o.trim(),example:!1}),i(''),r(''),c('')}}),(0,T.jsx)(p.Muted,{children:"Events show in the customer app\u2019s What\u2019s on and on its booking dates, and feed the forecast."})]})]})},_e.GiftCardsPage=function(){const{rid:e}=(0,w.useCtx)(6e4),n=(0,g.useStore)((0,h.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[l,i]=(0,d.useState)(25),[a,r]=(0,d.useState)(''),o=n.reduce((e,t)=>e+t.initial,0),c=n.reduce((e,t)=>e+t.balance,0);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Sold (all time)"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(o)})]}),(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Outstanding balance"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(c)})]})]}),n.map(e=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,T.jsx)(p.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,T.jsxs)(p.Muted,{children:[e.code," \xb7 ",(0,j.gbp)(e.balance)," of ",(0,j.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,T.jsx)(p.Chip,{label:`\xa3${e}`,selected:l===e,onPress:()=>i(e)},e))}),(0,T.jsx)(p.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,T.jsx)(s.GreensideCashOnly,{}):(0,T.jsx)(p.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,T.jsx)(p.Button,{label:`Issue \xa3${l} card`,disabled:a.trim().length<2,onPress:()=>{R().buyGiftCard(e,100*l,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,w.useCtx)(6e4),t=(0,g.useRatings)(e),[s,n]=(0,d.useState)('all'),l=t.filter(e=>'all'===s||e.stars<=3).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),i=t.length?t.reduce((e,t)=>e+t.stars,0)/t.length:0;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,T.jsxs)(p.Row,{gap:4,children:[(0,T.jsx)(p.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,T.jsx)(p.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,T.jsx)(p.Banner,{kind:"danger",title:"Low-rating alert",children:`${t.filter(e=>e.stars<=2).length} rating(s) at 2\u2605 or below. Reply within 24 hours.`}):null,l.map(e=>(0,T.jsxs)(p.Card,{highlight:e.stars<=2?b.colours.red:void 0,children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.customerName}),(0,T.jsxs)(p.T,{colour:b.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,T.jsx)(p.T,{size:14,children:e.comment||'(no comment)'}),(0,T.jsx)(p.Muted,{children:e.context??''})]},e.id)),(0,T.jsx)(p.Banner,{kind:"info",title:"No review gating",children:"After private feedback, every customer (whatever their rating) is shown the link to leave a public Google review. Low ratings alert you here so you can put it right."}),(0,T.jsx)(p.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return y.DemoTag}}),_e.StampSettings=function(){return i.LIVE_VENUE_BUILD||(0,a.staffServer)()?(0,T.jsx)(r.LoyaltySettingsPanel,{}):(0,T.jsx)(O,{})},_e.Offers=function({go:e}){return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,a.staffServer)()?(0,T.jsx)(p.Banner,{kind:"info",title:"Stamp card offers are in Settings \u203a Advanced \u203a Loyalty",children:"Offers there are saved on the server and shown on every guest\u2019s stamp card. Specials below stay as they were."}):null,(0,T.jsx)(B,{go:e})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),o=e(_r(_d[8])),c=e(_r(_d[9])),u=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),m=_r(_d[17]),b=_r(_d[18]),y=_r(_d[19]),w=_r(_d[20]),S=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]);const k=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],P=[1,2,3,4,5,6,0],R=()=>g.useStore.getState();function M({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,w.useCtx)(6e4),[i,a]=(0,d.useState)(e?.name??''),[r,o]=(0,d.useState)(e?.description??''),[c,u]=(0,d.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,g]=(0,d.useState)(e?.section??l.sections[0]??'Mains'),[x,j]=(0,d.useState)(e?.prepMins??0),m=''===c.trim()?null:Math.round(100*Number(c)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},S=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,T.jsx)(p.Field,{label:"Name",value:i,onChangeText:a}),(0,T.jsx)(p.Field,{label:"Description",value:r,onChangeText:o,multiline:!0}),(0,T.jsx)(p.Field,{label:"Price \xa3 (blank = board price)",value:c,onChangeText:u,keyboardType:"decimal-pad"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,T.jsx)(p.Chip,{label:e,selected:h===e,onPress:()=>g(e)},e))}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Prep time (min)"}),(0,T.jsx)(p.Stepper,{value:x,onChange:j,min:1,max:60,label:"prep minutes"})]}),(0,T.jsx)(p.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[f.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,T.jsx)(p.Badge,{label:'may'===y[e.id]?`May contain ${e.short.toLowerCase()}`:e.short,kind:'may'===y[e.id]?'amber':'red'},e.id)),e&&!Object.keys(y).length?(0,T.jsx)(p.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,T.jsx)(p.Muted,{children:e?e.signOff?`Signed off by ${e.signOff.by} on ${e.signOff.at}.`:'Awaiting sign-off by the head chef.':'Saving adds the dish and its recipe card. Add the ingredients and allergens on the card; the dish stays off the menu until the head chef signs it off.'}),s?(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,S&&e?.signOff?(0,T.jsx)(p.Banner,{kind:"warn",title:"Sign-off resets",children:"Name, price and section live on the recipe card. Changing them sets the card back to \u201cAwaiting sign-off\u201d until the head chef signs it off again."}):null,(0,T.jsx)(p.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?R().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:x}):R().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:x,soldOut:!1,signOff:null}),t()}})]})}function B({go:e}){const{now:t}=(0,w.useCtx)(6e4),s=(0,x.useOwner)(e=>e.offers),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)('special'),[h,g]=(0,d.useState)(null);return(0,T.jsxs)(u.default,{style:{gap:10},children:[s.map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,T.jsxs)(p.Muted,{children:[t.body,t.until?` \xb7 until ${(0,m.niceDate)((0,m.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,T.jsx)(p.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Toggle,{label:"Live in app",value:t.live,onChange:e=>x.useOwner.getState().updateOffer(t.id,{live:e})}),(0,T.jsx)(p.Muted,{children:t.live?'Live in app':'Hidden'}),(0,T.jsx)(u.default,{style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>g(t.id)})]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"New special or offer"}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Chip,{label:"Special",selected:'special'===o,onPress:()=>c('special')}),(0,T.jsx)(p.Chip,{label:"Offer",selected:'offer'===o,onPress:()=>c('offer')})]}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i}),(0,T.jsx)(p.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add",disabled:l.trim().length<3,onPress:()=>{x.useOwner.getState().addOffer({title:l.trim(),body:a.trim(),kind:o,live:!0}),i(''),r('')}})]}),h?(()=>{const e=s.find(e=>e.id===h);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:()=>g(null),title:"Push notification composer",children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,T.jsxs)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,T.jsx)(p.Muted,{children:"CoverCharge \xb7 now"}),(0,T.jsx)(p.T,{weight:"semibold",children:e.title}),(0,T.jsx)(p.T,{size:14,children:e.body})]}),(0,T.jsxs)(p.Muted,{children:["Audience: customers who opted in to ",(0,v.venueInfo)().name," offers. No audience count is available."]}),(0,T.jsx)(p.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{x.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,m.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),g(null)}})]})})():null]})}function O(){const{r:e}=(0,w.useCtx)(6e4),t=e.settings,[s,n]=(0,d.useState)(t.stampReward);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Stamp card"}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Stamps for a reward"}),(0,T.jsx)(p.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>R().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Minimum spend"}),(0,T.jsx)(p.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>R().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,T.jsxs)(p.Muted,{children:[(0,j.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,T.jsx)(p.Field,{label:"Reward",value:s,onChangeText:n}),(0,T.jsx)(p.Button,{small:!0,label:"Save reward",onPress:()=>R().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,T.jsx)(u.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:b.colours.gold,backgroundColor:t<3?b.colours.gold:'transparent'}},t))}),(0,T.jsxs)(p.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1419,[5,1342,798,796,806,1206,1364,34,402,410,102,853,794,848,865,830,836,827,840,1147,1100,1135,1367,1167,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1420,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandingSettings=function(){const{rid:e,r:t}=(0,h.useCtx)(6e4),p=(0,l.useBrand)(e),x=(0,c.useOwner)(e=>e.setBranding),[j,f]=(0,r.useState)(''),y=(0,c.useOwner)(o=>o.branding[e]?.recent)??[],[w,C]=(0,r.useState)(p.accent);(0,r.useEffect)(()=>{C(p.accent)},[p.accent]);const v=(0,r.useMemo)(()=>(0,a.checkAccent)(w,u.colours.bg,u.colours.onGold,u.colours.text),[w]);return(0,b.jsxs)(n.default,{style:{gap:10},children:[(0,b.jsx)(d.Muted,{children:"Your logo, name and accent colour lead every CoverCharge app: Managers, Staff, Display, Head Chef and the customer app. A small \u201cpowered by CoverCharge\u201d stays at the top left."}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Customer header preview"}),(0,b.jsxs)(n.default,{testID:"branding-preview",style:{backgroundColor:u.colours.bg,borderRadius:12,borderWidth:1,borderColor:u.colours.border,padding:12,gap:4},children:[(0,b.jsx)(l.PoweredBy,{}),(0,b.jsxs)(d.Row,{gap:10,children:[(0,b.jsx)(l.RestaurantLogo,{rid:e,size:52}),(0,b.jsxs)(n.default,{style:{flex:1},children:[(0,b.jsx)(d.T,{weight:"semibold",size:18,children:t.name}),(0,b.jsx)(d.T,{size:12,colour:v.accentText,children:t.location})]})]}),(0,b.jsx)(n.default,{testID:"branding-preview-button",style:{marginTop:8,backgroundColor:w,borderRadius:10,paddingVertical:10,alignItems:'center'},children:(0,b.jsx)(d.T,{weight:"semibold",colour:v.onAccent,children:"Book a table"})})]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Logo"}),(0,b.jsxs)(d.Muted,{children:[p.custom?'Your uploaded logo.':'anchorage'===e?'Built in: The Anchorage logo in black and gold.':l.BUILTIN_LOGOS[e]?`Built in: ${t.name} logo.`:'Built in: placeholder initials for this demo venue.'," Square images work best."]}),(0,b.jsxs)(d.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(d.Button,{label:"Upload a logo",onPress:async()=>{const r=await o.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(r.canceled||!r.assets?.[0])return;const t=r.assets[0],n=t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri;x(e,{logoUri:n}),f('Logo updated in all apps on this device.')},testID:"branding-upload"}),p.custom?(0,b.jsx)(d.Button,{kind:"secondary",label:"Use the built-in logo",onPress:()=>{x(e,{logoUri:void 0}),f('Back to the built-in logo.')}}):null]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Accent colour"}),(0,b.jsx)(d.Muted,{children:"Any colour you like for your own brand. The preview above changes as you drag."}),(0,b.jsx)(s.ColourPicker,{value:w,onChange:C,onCommit:o=>{o===p.accent&&y[0]===o||(x(e,{accent:o,recent:(0,a.pushRecent)(y,o)}),f(`Accent set to ${o}.`))},quick:l.ACCENTS,recent:y}),v.tips.length?(0,b.jsx)(n.default,{testID:"accent-tip",style:{borderWidth:1,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg,borderRadius:10,padding:10,gap:4},children:v.tips.map(e=>(0,b.jsx)(d.T,{size:13,colour:u.colours.amber,children:e},e))}):null,(0,b.jsx)(d.Muted,{children:"Used for the restaurant line in headers, the logo ring and main buttons. Text on it is picked to stay readable."})]}),j?(0,b.jsx)(d.Banner,{kind:"success",title:"Saved",children:j}):null,(0,b.jsx)(d.Button,{kind:"ghost",label:"Restore default branding",onPress:()=>{x(e,null),f('Default branding restored.')}}),(0,b.jsx)(d.Muted,{children:"Saved the same way as your logo: on this device, shared by all the apps on it. Nothing is uploaded."})]})};var e,o=(function(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(r){if('default'!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),o.default=e,o})(_r(_d[0])),r=_r(_d[1]),t=_r(_d[2]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),b=_r(_d[10])},1421,[1061,34,102,1422,799,847,794,865,840,1100,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ColourPicker=function({value:e,onChange:p,onCommit:v,quick:y,recent:w}){const[R,C]=(0,t.useState)(()=>(0,c.hexToHsv)(e)),[H,T]=(0,t.useState)(e),[S,M]=(0,t.useState)(!1),F=(0,t.useRef)(e);(0,t.useEffect)(()=>{(0,c.normaliseHex)(e)!==(0,c.normaliseHex)(F.current)&&(F.current=e,C((0,c.hexToHsv)(e)),T(e))},[e]);const k=e=>{C(e);const o=(0,c.hsvToHex)(e);F.current=o,T(o),M(!1),p(o)},D=(0,t.useMemo)(()=>(0,c.hsvToHex)({h:R.h,s:R.s,v:1}),[R.h,R.s]),E=(0,t.useMemo)(()=>f.map(e=>(0,c.hsvToHex)({h:e,s:1,v:1})),[]),I=e=>{const o=(0,c.normaliseHex)(e);o&&(F.current=o,C((0,c.hexToHsv)(o)),T(o),M(!1),p(o),v(o))},z=(o,t,n)=>(0,x.jsx)(s.default,{testID:`accent-${n}-${t}`,accessibilityRole:"button",accessibilityLabel:`Accent ${o}`,onPress:()=>I(o),hitSlop:4,style:{width:40,height:40,borderRadius:20,backgroundColor:o,borderWidth:3,borderColor:(0,c.normaliseHex)(e)===(0,c.normaliseHex)(o)?u.colours.text:u.colours.border}},n+o+t);return(0,x.jsxs)(n.default,{testID:"colour-picker",style:{gap:10},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Drag across for the colour, up and down for how strong it is"}),(0,x.jsxs)(b,{testID:"picker-area",label:"Colour and strength",height:170,onMove:(e,o)=>k({h:360*e,s:1-o,v:R.v}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:[(0,x.jsxs)(l.Defs,{children:[(0,x.jsx)(l.LinearGradient,{id:"cpHue",x1:"0",y1:"0",x2:"1",y2:"0",children:E.map((e,o)=>(0,x.jsx)(l.Stop,{offset:o/(E.length-1),stopColor:e},o))}),(0,x.jsxs)(l.LinearGradient,{id:"cpSat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#FFFFFF",stopOpacity:0}),(0,x.jsx)(l.Stop,{offset:1,stopColor:"#FFFFFF",stopOpacity:1})]})]}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpHue)"}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpSat)"})]}),(0,x.jsx)(j,{x:R.h/360*100+"%",y:100*(1-R.s)+"%",colour:D})]}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Brightness"}),(0,x.jsxs)(b,{testID:"picker-brightness",label:"Brightness",height:36,onMove:e=>k({...R,v:Math.max(.04,e)}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 10",children:[(0,x.jsx)(l.Defs,{children:(0,x.jsxs)(l.LinearGradient,{id:"cpVal",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#000000"}),(0,x.jsx)(l.Stop,{offset:1,stopColor:D})]})}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"10",fill:"url(#cpVal)"})]}),(0,x.jsx)(j,{x:100*R.v+"%",y:"0%",colour:(0,c.hsvToHex)(R),round:!1})]}),(0,x.jsxs)(h.Row,{gap:10,style:{alignItems:'center'},children:[(0,x.jsx)(n.default,{testID:"picker-swatch",style:{width:46,height:46,borderRadius:10,backgroundColor:(0,c.normaliseHex)(H)??e,borderWidth:1,borderColor:u.colours.border}}),(0,x.jsxs)(n.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Hex code"}),(0,x.jsx)(o.TextInput,{testID:"picker-hex",value:H,autoCapitalize:"characters",autoCorrect:!1,maxLength:7,placeholder:"#CFA45F",placeholderTextColor:u.colours.muted,accessibilityLabel:"Hex code",onChangeText:e=>{T(e);const o=(0,c.normaliseHex)(e);M(!o&&e.replace('#','').length>=6),o&&6===e.replace('#','').length&&(F.current=o,C((0,c.hexToHsv)(o)),p(o))},onBlur:()=>{const e=(0,c.normaliseHex)(H);e?I(e):(T(F.current),M(!1))},onSubmitEditing:()=>{const e=(0,c.normaliseHex)(H);e?I(e):M(!0)},style:{minHeight:46,borderRadius:10,borderWidth:1,borderColor:S?u.colours.amber:u.colours.accentBorder,backgroundColor:u.colours.surface2,color:u.colours.text,paddingHorizontal:12,fontSize:16}})]})]}),S?(0,x.jsx)(h.T,{size:13,colour:u.colours.amber,children:"Use six letters or numbers after #, like #CFA45F."}):null,(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Quick picks"}),(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:y.map((e,o)=>z(e,o,'quick'))}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Recent colours"}),w.length?(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:w.map((e,o)=>z(e,o,'recent'))}):(0,x.jsx)(h.Muted,{children:"Colours you choose show here."})]})};var o=r(d[0]),t=r(d[1]);r(d[2]);var s=e(r(d[3])),n=e(r(d[4])),l=r(d[5]),i=e(l),c=r(d[6]),u=r(d[7]),h=r(d[8]),x=r(d[9]);const p={touchAction:'none',cursor:'crosshair',userSelect:'none'},f=[0,30,60,90,120,150,180,210,240,270,300,330,360];function b({height:e,onMove:o,onEnd:s,children:l,testID:i,label:c}){const h=(0,t.useRef)({w:1,h:e}),f=e=>{const{locationX:t,locationY:s}=e.nativeEvent;o(Math.min(1,Math.max(0,t/h.current.w)),Math.min(1,Math.max(0,s/h.current.h)))};return(0,x.jsx)(n.default,{testID:i,accessibilityLabel:c,onLayout:e=>{h.current={w:Math.max(1,e.nativeEvent.layout.width),h:Math.max(1,e.nativeEvent.layout.height)}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:f,onResponderMove:f,onResponderRelease:s,onResponderTerminate:s,style:[{height:e,borderRadius:10,overflow:'hidden',borderWidth:1,borderColor:u.colours.border},p],children:(0,x.jsx)(n.default,{pointerEvents:"none",style:{flex:1},children:l})})}const j=({x:e,y:o,colour:t,round:s=!0})=>(0,x.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:e,top:o,width:26,height:s?26:'100%',marginLeft:-13,marginTop:s?-13:0,borderRadius:s?13:6,borderWidth:3,borderColor:u.colours.text,backgroundColor:t,shadowColor:'#000',shadowOpacity:.6,shadowRadius:3}})},1422,[796,34,236,402,102,900,799,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.RecipeCardsPage=function(){const{rid:c,role:u,me:f}=(0,o.useCtx)(),_=(0,o.useSignedIn)(),l='owner'===u?'owner':'manager'===u?'manager':'staff';return(0,s.jsx)(t.RecipeCards,{rid:c,actor:(0,n.cardActorFor)(f,l,_),mode:'staff'===l?'read':'edit'})},r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4])},1423,[34,1132,832,1100,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:c,role:s,me:u,meId:l,today:p}=(0,t.useCtx)(6e4),_='owner'===s||'manager'===s;return(0,o.jsx)(n.CashUpScreen,{rid:c,today:p,canEdit:_,who:{id:l??'me',name:u.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),t=r(d[2]),o=r(d[3])},1424,[34,1048,1100,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1425,[34,1317,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=y,_e.SpendPerHeadPage=function(){const{rid:e,today:s}=(0,c.useCtx)(6e4),a=(0,r.useBookings)(e),n=(0,o.useCashUp)(e=>e.cashUps),[b,j]=(0,t.useState)('day'),k=(0,d.hasAnyTakings)(n,e),w=(0,d.dayRows)(n,a,e,s,14),f=(0,d.weekRows)(n,a,e,s,8),v=(0,d.averageSph)(w),$=(e,t,s,a,n)=>(0,u.jsxs)(l.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:h.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${t}: ${'No takings entered'===a?'no takings entered':`spend per head ${a}`}, ${s}${n?`, ${n}`:''}`,children:[(0,u.jsx)(i.T,{center:!0,children:t}),(0,u.jsx)(i.T,{center:!0,colour:h.colours.muted,children:s}),(0,u.jsx)(i.T,{center:!0,weight:"semibold",colour:'No takings entered'===a?h.colours.muted:h.colours.goldLight,size:'No takings entered'===a?13:16,children:a}),n?(0,u.jsx)(i.Muted,{center:!0,children:n}):null]},e);return(0,u.jsxs)(l.default,{style:{gap:12},testID:"sph-screen",children:[(0,u.jsx)(i.Muted,{children:"Tip: spend per head is Gross takings \xf7 Covers. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,u.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,u.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==v?(0,u.jsx)(i.T,{size:22,weight:"semibold",colour:h.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,u.jsxs)(i.T,{size:34,weight:"bold",colour:h.colours.goldLight,testID:"sph-avg",children:[p(v)," ",(0,u.jsx)(i.T,{size:16,colour:h.colours.muted,children:"per head"})]}),(0,u.jsx)(i.Muted,{children:k?'Only days with gross takings entered are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has Gross takings.'})]}),(0,u.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(i.Chip,{testID:"sph-day",label:"By day",selected:'day'===b,onPress:()=>j('day')}),(0,u.jsx)(i.Chip,{testID:"sph-week",label:"By week",selected:'week'===b,onPress:()=>j('week')})]}),'day'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by day"}),(0,u.jsx)(y,{testID:"sph-trend-day",label:"Spend per head trend by day",points:w.map(e=>({label:x(e.date),value:e.sph}))}),[...w].reverse().map(e=>$(e.date,x(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':p(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${p(e.foodPh)}, drink ${p(e.drinkPh)} per head`:void 0))]}):null,'week'===b?(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,u.jsx)(y,{testID:"sph-trend-week",label:"Spend per head trend by week",points:f.map(e=>({label:`w/c ${x(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...f].reverse().map(e=>$(e.weekStart,`w/c ${x(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':p(e.sph)))]}):null,(0,u.jsx)(i.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var t=_r(_d[0]),s=e(t),l=e(_r(_d[1])),a=_r(_d[2]),n=e(a),i=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,x=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function y({points:e,testID:r,label:o}){const[d,c]=(0,t.useState)(320),[x,y]=(0,t.useState)(e.length);(0,t.useEffect)(()=>y(e.length),[e.length,r]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,x)),k=Math.max(0,j-b),w=e.slice(k,j),f=Math.max(140,d-68),v=e.map(e=>e.value).filter(e=>null!=e),$=Math.max(5,5*Math.ceil(Math.max(0,...v)/5)),T=e=>38+e*(f-76)/Math.max(1,w.length-1),S=e=>140-e/$*106,L=[];let D=[];w.forEach((e,t)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:t,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${p(e.value)}`).join(', ');return(0,u.jsxs)(l.default,{testID:r,onLayout:e=>c(e.nativeEvent.layout.width),style:{gap:8},children:[(0,u.jsxs)(l.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,u.jsx)(n.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,u.jsx)(a.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:h.colours.muted,children:p($*e/4)},e))}),(0,u.jsxs)(n.default,{width:f,height:170,children:[[0,1,2,3,4].map(e=>(0,u.jsx)(a.Line,{x1:0,x2:f,y1:S($*e/4),y2:S($*e/4),stroke:h.colours.border,strokeWidth:1},e)),L.map((e,t)=>(0,u.jsx)(a.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:h.colours.gold,strokeWidth:2.5},t)),w.map((e,t)=>(0,u.jsx)(s.default.Fragment,{children:null==e.value?(0,u.jsx)(a.Circle,{cx:T(t),cy:140,r:2,fill:"#444"}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.Circle,{cx:T(t),cy:S(e.value),r:4,fill:h.colours.goldLight}),(0,u.jsx)(a.Text,{x:T(t),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:h.colours.goldLight,children:p(e.value)})]})},k+t))]})]}),(0,u.jsx)(l.default,{style:{flexDirection:'row',gap:12},children:w.map((e,t)=>(0,u.jsxs)(l.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':p(e.value)}`,children:[(0,u.jsx)(i.T,{center:!0,size:12,colour:h.colours.muted,children:e.label}),(0,u.jsx)(i.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?h.colours.muted:h.colours.goldLight,children:null==e.value?'No takings entered':p(e.value)})]},k+t))}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===k,onPress:()=>y(Math.max(b,j-b))}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Later",accessibilityLabel:"Later spend per head chart points",disabled:j>=e.length,onPress:()=>y(Math.min(e.length,j+b))})]})]})}},1426,[34,102,900,794,848,1024,1427,840,1100,25]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COUNTED",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"serviceOfBooking",{enumerable:!0,get:function(){return o}}),e.coversOn=d,e.dayRows=i,e.weekRows=function(n,t,s,o,d){const u=(0,r.weekStartOf)(o);return Array.from({length:d},(l,f)=>{const h=(0,r.addDaysYmd)(u,7*(f-d+1)),m=i(n,t,s,(0,r.addDaysYmd)(h,6),7).filter(r=>r.date<=o&&null!=r.gross),p=m.length?Math.round(100*m.reduce((r,n)=>r+n.gross,0))/100:null,v=m.reduce((r,n)=>r+n.covers,0);return{weekStart:h,gross:p,covers:v,days:m.length,sph:c(p,v)}})},e.serviceRows=function(n,t,s,o,i,l=1020){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r])),h=[];for(let n=0;nnull!=r.gross&&r.covers>0);return n.length?c(n.reduce((r,n)=>r+n.gross,0),n.reduce((r,n)=>r+n.covers,0)):null},Object.defineProperty(e,"hasAnyTakings",{enumerable:!0,get:function(){return l}});var r=_r(_d[0]);const n=['seated','finished'],t=r=>n.includes(r.status),s=r=>{const[n,t]=r.split(':').map(Number);return 60*n+(t||0)},o=(r,n)=>s(r.time)r.restaurantId===n&&r.date===s&&t(r)&&(!d||o(r,u)===d)).reduce((r,n)=>r+(n.partySize||0),0)}const u=r=>'number'==typeof r&&Number.isFinite(r)?r:null,c=(r,n)=>null==r||n<=0?null:Math.round(r/n*100)/100;function i(n,t,s,o,i){const l=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,f)=>{const h=(0,r.addDaysYmd)(o,f-i+1),m=l.get(h)?.vals??{},p=(0,r.grossOf)(m),v=d(t,s,h),y=u(m.food),b=u(m.drink);return{date:h,gross:p,covers:v,sph:c(p,v),food:y,drink:b,foodPh:c(y,v),drinkPh:c(b,v)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.grossOf)(n.vals))},1427,[13]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1428,[34,793,1100,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(W,{})},_e.Merch=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(Q,{}):(0,V.jsx)(X,{})},_e.TablesQr=function({go:e}={}){const{rid:s,r:t,now:r,me:a}=(0,A.useCtx)(1e4);return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(l.StaffTableOrders,{rid:s,me:a}),(0,V.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(t)?(0,V.jsx)(q,{rid:s,now:r,me:a}):(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:s,r:t,now:r}=(0,A.useCtx)(3e4),n=(0,T.useOrders)(s),a=t.settings,l=(0,P.takeawaySlots)(t,n,r).slice(0,10),i=e=>_().updateSettings(s,e),o=n.filter(e=>'takeaway'===e.type&&(0,B.LIVE)(e));return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:a.takeawayPaused?I.colours.red:I.colours.ok,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:a.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,V.jsx)(v.Toggle,{label:"Takeaway on",value:!a.takeawayPaused,onChange:e=>i({takeawayPaused:!e})})]}),(0,V.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Slot length (min)"}),(0,V.jsx)(v.Stepper,{value:a.slotMinutes,min:5,max:30,onChange:e=>i({slotMinutes:e}),label:"slot minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Orders per slot"}),(0,V.jsx)(v.Stepper,{value:a.slotCap,min:1,max:20,onChange:e=>i({slotCap:e}),label:"orders per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,V.jsx)(v.Stepper,{value:a.leadMins,min:5,max:60,onChange:e=>i({leadMins:e}),label:"lead minutes"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,V.jsx)(v.Stepper,{value:a.bufferMins,min:0,max:20,onChange:e=>i({bufferMins:e}),label:"buffer minutes"})]}),(0,V.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Next slots"}),l.map(e=>(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{size:14,children:e.label}),(0,V.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:I.colours.border,borderRadius:4},children:(0,V.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?I.colours.red:I.colours.gold,borderRadius:4}})}),(0,V.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,V.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,V.jsxs)(v.Muted,{children:[e.slotTime?(0,O.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,B.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:r,r:n}=(0,A.useCtx)(6e4),a=n.settings,l=(0,S.useOwner)(e=>e.reminders),i=e=>_().updateSettings(r,e),o=e=>S.useOwner.getState().setOwner({reminders:{...l,...e}});return(0,V.jsxs)(w.default,{style:{gap:10},children:[s.IS_GREENSIDE?(0,V.jsx)(t.GreensideCashOnly,{}):(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,V.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(a);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,V.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,V.jsx)(v.Toggle,{label:"24h reminder",value:l.h24,onChange:e=>o({h24:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,V.jsx)(v.Toggle,{label:"2h reminder",value:l.h2,onChange:e=>o({h2:e})})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,V.jsx)(v.Toggle,{label:"confirm",value:l.confirmText,onChange:e=>o({confirmText:e})})]}),(0,V.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,V.jsx)(v.Stepper,{value:a.bookingCoversPerSlot,min:2,max:60,onChange:e=>i({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Typical table turn (min)"}),(0,V.jsx)(v.Stepper,{value:a.turnMins,min:30,max:180,onChange:e=>i({turnMins:e}),label:"turn minutes"})]}),(0,V.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,V.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:s,today:t,role:r,me:n}=(0,A.useCtx)(1e4),[a,l]=(0,x.useState)(null),i=(0,T.useOrders)(s),o=(0,T.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===s&&e.date===t))),d=(0,T.useAudit)(s).filter(e=>'allergy'===e.kind),c=(0,z.useUnsignedDishes)(s),h=(0,T.useStore)(e=>e.bookings),u=i.filter(e=>(0,B.LIVE)(e)&&(0,D.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i.filter(B.LIVE))).length,g=(0,A.useSignedIn)(),p=(0,F.cardActorFor)(n,'owner'===r?'owner':'manager'===r?'manager':'staff',g);if('unsigned'===a)return(0,V.jsx)(z.UnsignedDishList,{rid:s,actor:p,onClose:()=>l(null),onOpenCards:()=>e('more','recipecards')});if('pending'===a)return(0,V.jsx)(K,{go:e,onClose:()=>l(null)});const b={flex:1,minHeight:48};return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>l('pending'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?I.colours.red:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,V.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>l('unsigned'),style:({pressed:e})=>[b,{opacity:e?.85:1}],children:(0,V.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?I.colours.amber:void 0,children:[(0,V.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,V.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,V.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,V.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,V.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,V.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,V.jsxs)(v.Muted,{children:[(0,O.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,V.jsx)(v.Muted,{children:"No allergy events yet."}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,V.jsx)(w.default,{style:{gap:10},children:(0,V.jsxs)(v.Card,{highlight:I.colours.gold,style:{alignItems:'center'},children:[(0,V.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:I.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,V.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,V.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,V.jsx)(v.T,{size:20,weight:"bold",colour:I.colours.gold,children:"CoverCharge for Display"}),(0,V.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:s,r:t}=(0,A.useCtx)(6e4),r=(0,d.useLiveVenue)(),n=s=>s.startsWith('tab:')?e(s.slice(4)):e('more',s),a=e=>e.startsWith('tab:')?'tab:forecast'!==e||S.CAN.forecasts(s):(()=>{const t=L.PAGES.find(s=>s.id===e);return!!t&&(!t.can||t.can(s))})();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Card,{highlight:I.colours.gold,children:[(0,V.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(t)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,s,t])=>(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"medium",children:e}),(0,V.jsx)(v.Muted,{children:s})]}),(0,V.jsx)(v.Badge,{kind:'This app'===t?'ok':'gold',label:t})]},e)),'owner'===s?(0,V.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{S.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,V.jsx)(v.Muted,{children:r?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,V.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...Y].filter(e=>4!==e.n||(0,M.orderAtTableOn)(t)).sort((e,s)=>e.n-s.n).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,V.jsxs)(v.T,{weight:"bold",colour:I.colours.gold,style:{width:26},children:[e.n,"."]}),(0,V.jsxs)(w.default,{style:{flex:1},children:[(0,V.jsx)(v.T,{weight:"semibold",children:e.title}),(0,V.jsx)(v.Muted,{children:e.note})]})]}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>a(e)).map(([e,s])=>(0,V.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>n(s)},s))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"card"}):(0,V.jsx)(G,{})},_e.Referrals=function(){return n.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,V.jsx)(ee,{kind:"referrals"}):(0,V.jsx)(H,{})};var s=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),b=_r(_d[14]),x=_r(_d[15]),m=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),I=_r(_d[30]),B=_r(_d[31]),A=_r(_d[32]),N=_r(_d[33]),$=_r(_d[34]),L=_r(_d[35]),D=_r(_d[36]),E=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),V=_r(_d[41]);const _=()=>T.useStore.getState();function G(){const{rid:e,r:t,me:n}=(0,A.useCtx)(3e4),a=t.settings,l=(0,T.useStore)((0,k.useShallow)(s=>s.stampCards.filter(s=>s.restaurantId===e))),i=(0,T.useStore)(e=>e.customer.name),o=(0,T.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,x.useMemo)(()=>(0,N.crmCustomers)(),[]),[c,h]=(0,x.useState)(a.stampReward),[u,g]=(0,x.useState)('');(0,x.useEffect)(()=>{(0,$.examplesAllowed)()&&e===s.VENUE_RID&&!l.some(e=>e.customerId.startsWith('cr-'))&&T.useStore.setState(s=>({stampCards:[...s.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((s,t)=>({restaurantId:e,customerId:s.id,stamps:s.stamps%a.stampTarget,rewardsAvailable:t%5==0?1:0,history:[{at:'2026-10-20',source:t%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(s=>s.id===e)?.name??(e===T.useStore.getState().customer.id?i||'Guest':e),b=l.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,s)=>s.stamps-e.stamps),m=(0,$.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(m?31:0);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Active cards"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.length})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Rewards ready"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l.reduce((e,s)=>e+s.rewardsAvailable,0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Redeemed"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,V.jsx)(v.Muted,{children:m?'all time (example)':'all time'})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Stamps for a reward"}),(0,V.jsx)(v.Stepper,{value:a.stampTarget,min:3,max:15,onChange:s=>_().updateSettings(e,{stampTarget:s}),label:"stamps"})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{children:"Min spend \xa3"}),(0,V.jsx)(v.Stepper,{value:a.stampMinSpend/100,min:0,max:50,onChange:s=>_().updateSettings(e,{stampMinSpend:100*s}),label:"minimum spend"})]}),(0,V.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,V.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>_().updateSettings(e,{stampReward:c.trim()||a.stampReward})}),(0,V.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,V.jsx)(B.SectionHead,{title:"Members"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),b.map(s=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(s.customerId)}),s.rewardsAvailable?(0,V.jsx)(v.Badge,{kind:"ok",label:`${s.rewardsAvailable} reward ready`}):null]}),(0,V.jsx)(v.Row,{gap:4,children:Array.from({length:a.stampTarget},(e,t)=>(0,V.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:te.source))).join(', ')||'\u2013']}),(0,V.jsxs)(v.Row,{gap:6,children:[(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>_().addStamp(e,s.customerId,`Manual (${n})`)}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!s.rewardsAvailable,onPress:()=>_().redeemReward(e,s.customerId)})]})]},s.customerId))]})}function H(){const e=(0,S.useOwner)(e=>e.referral),s=(0,S.useOwner)(e=>e.referrals),[t,r]=(0,x.useState)(e.giverReward),[n,a]=(0,x.useState)(e.friendReward),l=e=>s.filter(s=>s.status===e).length,i=(0,$.examplesAllowed)();return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[i?(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Invites sent"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,V.jsx)(v.Muted,{children:"example"})]}):null,(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sign-ups"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:s.length+(i?23:0)})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Ordered"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:l('first order')+l('rewarded')+(i?9:0)})]})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,V.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:s=>S.useOwner.getState().setOwner({referral:{...e,active:s}})})]}),(0,V.jsx)(v.Field,{label:"Reward for the customer who invites",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Reward for the friend (first order)",value:n,onChangeText:a}),(0,V.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>S.useOwner.getState().setOwner({referral:{...e,giverReward:t.trim(),friendReward:n.trim()}})}),(0,V.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,V.jsx)(B.SectionHead,{title:"Referrals"}),s.map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,V.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,V.jsx)(v.Muted,{children:e.at})]},e.id))]})}function Q(){const{me:e}=(0,A.useCtx)(6e4),s=(0,A.useSignedIn)();return(0,V.jsx)(p.GiftCardsPage,{me:(s?.name??e).replace(' (example)','')})}function W(){const{rid:e,me:s}=(0,A.useCtx)(6e4),t=(0,T.useStore)((0,k.useShallow)(s=>s.giftCards.filter(s=>s.restaurantId===e))),[n,a]=(0,x.useState)(25),[l,i]=(0,x.useState)(''),[o,d]=(0,x.useState)(''),[c,h]=(0,x.useState)(''),[u,g]=(0,x.useState)(''),[p,b]=(0,x.useState)(''),[m,f]=(0,x.useState)(null),j=t.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=t.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsxs)(v.Row,{gap:8,children:[(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Sold"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.initial,0))})]}),(0,V.jsxs)(v.Card,{style:{flex:1},children:[(0,V.jsx)(v.Muted,{children:"Outstanding"}),(0,V.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.balance,0))})]})]}),m?(0,V.jsx)(v.Banner,{kind:"success",title:m}):null,(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,V.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"No card with that code."}):null,(0,V.jsx)(v.Field,{label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{_().redeemGiftCard(o,Math.round(100*Number(c)),s)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,V.jsx)(r.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,V.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,V.jsx)(v.Field,{label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const t=_().honourLegacyCard(e,u,Math.round(100*Number(p)),s);f(`Website bookings card ${t.code} honoured`),d(t.code),g(''),b('')}})]}):null]}),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,V.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,V.jsx)(v.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>a(e)},e))}),(0,V.jsx)(v.Field,{label:"Recipient",value:l,onChangeText:i}),(0,V.jsx)(v.Button,{label:`Record a \xa3${n} card paid at the till`,disabled:l.trim().length<2,onPress:()=>{const s=_().buyGiftCard(e,100*n,l.trim(),'Sold at the till');f(`Created ${s.code}`),i('')}}),(0,V.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,V.jsx)(B.SectionHead,{title:"All cards"}),t.map(e=>(0,V.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,V.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,V.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function q({rid:e,now:s,me:t}){const r=(0,T.useOrders)(e).filter(e=>'table'===e.type),[n,l]=(0,x.useState)(null),i=(0,m.useTableUse)(e,s),o=(0,m.useTableNames)(e);return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,V.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const s=r.filter(s=>s.tableNo===e&&(0,B.LIVE)(s)),t=s.reduce((e,s)=>e+s.total-s.paid,0);return(0,V.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,a.tableNumbers)(e)}`,onPress:()=>l(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:s.length?I.colours.gold:I.colours.border,backgroundColor:I.colours.surface,gap:2},children:[(0,V.jsx)(v.T,{weight:"bold",children:(0,a.tableNumbers)(e)}),(0,V.jsx)(v.T,{size:12,colour:i[e]?.busy?'#FFD9D4':'#E2C489',children:i[e]?.busy?i[e].label:'Free'}),(0,V.jsx)(v.Muted,{children:s.length?`${s.length} order${s.length>1?'s':''}`:'No orders'}),t?(0,V.jsxs)(v.T,{size:12,colour:I.colours.amber,children:[(0,R.gbp)(t)," to pay"]}):(0,V.jsx)(v.T,{size:12,colour:I.colours.muted,children:"View QR"})]},e)})}),(0,V.jsx)(B.SectionHead,{title:"Live table orders"}),r.filter(B.LIVE).map(e=>(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",children:[(0,a.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,V.jsx)(v.Badge,{kind:(0,B.statusKind)(e.status),label:(0,B.statusLabel)(e)})]}),(0,V.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,O.minsBetween)(new Date(e.createdAt),s)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),r.filter(B.LIVE).length?null:(0,V.jsx)(v.Muted,{children:"No live table orders."}),n?(0,V.jsxs)(v.Sheet,{visible:!0,onClose:()=>l(null),title:`${(0,a.tableNumbers)(n)} QR code`,children:[(0,V.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,V.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${n}`,size:200})}),(0,V.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",n]}),(0,V.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,V.jsx)(v.Button,{label:`Preview customer table ordering (${(0,a.tableNumbers)(n)})`,onPress:()=>{const e=n;l(null),j.router.push(`/table/${e}`)}}),(0,V.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>l(n)})]}):null]})}function K({go:e,onClose:s}){const{rid:t,today:r,role:n}=(0,A.useCtx)(1e4),a=(0,T.useOrders)(t),l=(0,T.useStore)(e=>e.bookings);(0,E.useBackLayer)(!0,s);const i=a.filter(B.LIVE),o=[...i.filter(e=>(0,D.chainNeedsAction)(e,l)).map(e=>{const s=(0,D.nextStep)(e,(0,D.linkedBooking)(e,l)),t=D.CHAIN_STEPS.find(e=>e.id===s);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,O.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:t?`Next: ${t.n}. ${t.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...l.filter(e=>e.restaurantId===t&&e.date===r&&'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,i)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,U.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,s)=>e.at.localeCompare(s.at));return(0,V.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,V.jsx)(E.BackButton,{onPress:s,testID:"pending-back"}),(0,V.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:I.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,V.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(s=>(0,V.jsxs)(v.Card,{highlight:I.colours.red,style:{alignItems:'center',gap:8},children:[(0,V.jsxs)(w.default,{testID:`pending-row-${s.id}`,accessible:!0,accessibilityLabel:`${s.title}, ${s.when}, allergies: ${s.allergies}. ${s.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,V.jsx)(v.T,{center:!0,weight:"bold",size:18,children:s.title}),(0,V.jsx)(v.T,{center:!0,children:s.when}),(0,V.jsxs)(v.Muted,{center:!0,children:["Allergies: ",s.allergies]}),(0,V.jsx)(v.T,{center:!0,colour:I.colours.gold,children:s.next})]}),(0,V.jsx)(v.Button,{small:!0,label:s.open,onPress:()=>e(s.tab),style:{alignSelf:'stretch'}})]},s.id)),'owner'===n||'manager'===n?(0,V.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function X(){const e=(0,S.useOwner)(e=>e.merch),s=(0,S.useOwner)(e=>e.merchOrders),[t,r]=(0,x.useState)(''),[n,a]=(0,x.useState)(''),l=(s,t)=>S.useOwner.getState().setOwner({merch:e.map(e=>e.id===s?{...e,...t}:e)});return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,V.jsx)(B.SectionHead,{title:"Products & stock"}),e.map(e=>(0,V.jsxs)(w.default,{style:v.styles.card,children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,V.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,V.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:s=>l(e.id,{live:s})})}),(0,V.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:s=>l(e.id,{stock:s}),label:`${e.name} stock`})]}),0===e.stock?(0,V.jsx)(v.T,{size:13,colour:I.colours.red,children:"Out of stock"}):e.stock<8?(0,V.jsx)(v.T,{size:13,colour:I.colours.amber,children:"Low stock"}):null]},e.id)),(0,V.jsxs)(v.Card,{children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,V.jsx)(v.Field,{label:"Name",value:t,onChangeText:r}),(0,V.jsx)(v.Field,{label:"Price \xa3",value:n,onChangeText:a,keyboardType:"decimal-pad"}),(0,V.jsx)(v.Button,{small:!0,label:"Add product",disabled:t.trim().length<2||!(Number(n)>0),onPress:()=>{S.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:t.trim(),price:Math.round(100*Number(n)),stock:10,live:!0}]}),r(''),a('')}})]}),(0,V.jsx)(B.SectionHead,{title:"Shop orders"}),s.map(t=>{const r=e.find(e=>e.id===t.productId);return(0,V.jsxs)(v.Card,{children:[(0,V.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[t.qty,"\xd7 ",r?.name," \xb7 ",t.customer]}),(0,V.jsx)(v.Badge,{kind:'new'===t.status?'amber':'ready'===t.status?'blue':'ok',label:t.status})]}),(0,V.jsxs)(v.Muted,{children:[t.at," \xb7 ",(0,R.gbp)((r?.price??0)*t.qty)]}),'collected'!==t.status?(0,V.jsx)(v.Button,{small:!0,label:'new'===t.status?'Mark ready':'Mark collected',onPress:()=>S.useOwner.getState().setOwner({merchOrders:s.map(e=>e.id===t.id?{...e,status:'new'===t.status?'ready':'collected'}:e)})}):null]},t.id)})]})}const Y=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const J=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},Z=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function ee({kind:e}){const{r:s}=(0,A.useCtx)(6e4),t=(0,S.useOwner)(e=>e.offers);(0,x.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:t},J,Z).catch(()=>{})},[]);const r=(0,u.can)('venue.settings');return(0,V.jsxs)(w.default,{style:{gap:10},children:[(0,V.jsx)(b.LoyaltySummaryCard,{kind:e}),(0,V.jsx)(g.StaffLoyalty,{venue:s.name,canRemove:r,onOpenSettings:r?()=>{i.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),r?(0,V.jsx)(v.Card,{children:(0,V.jsxs)(w.default,{style:{gap:8},children:[(0,V.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,V.jsx)(b.LoyaltySettingsPanel,{})]})}):null]})}},1429,[5,1342,796,806,829,1430,1363,1401,1173,14,1206,985,1431,1433,1364,34,1096,1409,30,402,102,853,1226,794,848,865,836,855,1104,827,840,1147,1100,1119,858,1379,838,1041,1132,832,830,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1430,[829,34,102,794,830,836,1131,848,838,840,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1431,[985,34,281,236,102,1226,794,1203,1206,840,1432,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1432,[34,236,102,794,1203,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1433,[5,1342,34,102,794,836,1203,1204,1205,985,1206,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SafetyPages",{enumerable:!0,get:function(){return l}}),r(d[0]);var n=r(d[1]),t=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]);const l={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s,initial:"items"})},Haccp:()=>{const{me:n,meId:t,now:o}=(0,c.useCtx)(3e4);return(0,u.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:l}=(0,c.useCtx)(3e4);return(0,u.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===l||'manager'===l})}}},1434,[34,1162,1133,1163,1170,1100,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CAR_LINK",{enumerable:!0,get:function(){return h}}),_e.CarScreen=function(){const e=(0,o.useSync)(e=>'staff'===e.kind&&!!e.venueId),[n,c]=(0,t.useState)(''),[b,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[f,w]=(0,t.useState)(null),[v,k]=(0,t.useState)(null),S=async()=>{try{w(await(0,o.carList)())}catch{w([])}};(0,t.useEffect)(()=>{e&&S()},[e]);const C=n.replace(/\D/g,''),D=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(C);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is signed in as you. It opens the owner screen in a few seconds.'}),S()):y({ok:!1,text:e.message})};return(0,u.jsxs)(s.default,{testID:"car-screen-page",style:{gap:12},children:[(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Sign the car in"}),(0,u.jsx)(r.T,{center:!0,children:`In the car, while parked, open the browser and type ${h}`}),(0,u.jsx)(r.T,{center:!0,children:"The car shows 6 numbers on its screen."}),(0,u.jsx)(r.Field,{testID:"car-code-field",label:"Code shown on the car (6 numbers)",accessibilityLabel:"Code shown on the car, 6 numbers",value:n,onChangeText:e=>c(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,u.jsx)(r.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Signs the car in as you",disabled:!e||x||6!==C.length,onPress:()=>{D()},style:{minHeight:56}}),e?null:(0,u.jsx)(r.Muted,{center:!0,children:"Your phone needs to be connected to approve a car."}),(0,u.jsx)(s.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,u.jsx)(r.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,u.jsx)(r.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars signed in"}),null===f?(0,u.jsx)(r.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):f.length?f.map(e=>(0,u.jsxs)(s.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 signed in as ${e.staffName}`}),(0,u.jsx)(r.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,u.jsx)(r.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Sign this car out",accessibilityLabel:`Sign ${e.label} out`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,u.jsx)(r.Muted,{center:!0,children:"No cars are signed in."})]}),v?(0,u.jsxs)(r.Sheet,{visible:!0,onClose:()=>k(null),title:"Sign this car out?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,u.jsx)(r.T,{center:!0,children:`${v.label} stops working straight away. To use it again, make a new code in the car and approve it here.`}),(0,u.jsx)(r.Button,{testID:"car-revoke-yes",label:"Yes, sign it out",onPress:async()=>{const e=v;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is signed out.`}:{ok:!1,text:t.message}),S()},style:{minHeight:56}}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),u=_r(d[6]);const h='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1435,[34,102,794,985,827,840,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=k,_e.SmsBubble=v,_e.AlertSettings=function({go:e}){const{rid:s}=(0,w.useCtx)(6e4),t=(0,b.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,b.systemSupport)()),[r,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=!0;return'undefined'!=typeof navigator&&/Android/i.test(navigator.userAgent)?p('unsupported'):(0,f.pushState)().then(s=>{e&&p(s)}).catch(()=>{e&&m('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const y='granted'===l?'Allowed on this device':'denied'===l?'Blocked. Turn it back on in your browser or phone settings for this site.':'default'===l?'Not asked yet':'This browser can\u2019t show notifications. On iPhone, add the Managers app to your Home Screen first.';return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Alert sound"}),(0,T.jsx)(u.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,T.jsx)(u.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>b.useAlerts.getState().setPrefs({muted:!e})}),(0,T.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,j.chime)('bright')}),(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,j.lowChime)(.6)})]}),(0,T.jsx)(u.Muted,{children:"The Display is silent and shows alerts on screen. The Head Chef app flashes and plays a soft chime until a takeaway is confirmed and its allergies are ticked."})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Which alerts to show"}),(0,T.jsx)(u.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),b.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindChip,{kind:e,size:30}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(u.Toggle,{label:b.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>b.useAlerts.getState().setType(e,s)})})]},e))]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Send a test alert"}),(0,T.jsx)(u.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,T.jsx)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,T.jsx)(u.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${b.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,b.sendTestAlert)(s,e)},e))})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,T.jsx)(u.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,T.jsx)(u.Muted,{children:y}),(0,T.jsx)(u.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>b.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,T.jsx)(u.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,b.requestSystemPermission)()),b.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,b.showSystemNotification)({id:`test-sys:${Date.now()}`,kind:'test',rid:s,at:Date.now(),name:'Test guest',when:'Today 19:30',covers:4,source:'Phone',test:!0},!0)}):null,(0,T.jsx)(u.Muted,{children:(0,b.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,T.jsxs)(u.Banner,{kind:"info",title:"What works today",children:["Alerts show while the app is open. ",'unsupported'===x?'Locked-phone alerts for this phone are coming soon.':'on'===x?'Locked-phone alerts are on for this phone.':'To get alerts when your phone is locked, tap Turn on alerts.']}),'unsupported'!==x?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:'on'===x?'Check alerts':'Turn on alerts',onPress:async()=>{try{if('on'===x){const e=await(0,f.pushState)();p(e),m('on'===e?'Locked-phone alerts are on for this phone.':'Tap Turn on alerts to connect this phone.')}else{const e=await(0,f.turnOnPush)();m(e.message),e.ok&&(p('on'),o((0,b.systemSupport)()))}}catch{m('Could not turn on alerts. Please try again.')}}}):null,r?(0,T.jsx)(u.Muted,{children:r}):null]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{gap:10,children:[(0,T.jsx)(h.KindIcon,{kind:"email"}),(0,T.jsx)(u.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,T.jsx)(u.Badge,{kind:"neutral",label:b.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,T.jsx)(u.Muted,{children:b.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${b.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,T.jsx)(u.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,w.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),h=(0,n.useMemo)(()=>(0,p.templatesFor)(r),[r]),b=(0,x.useAssistant)(e=>e.enabled),[j,f]=(0,n.useState)('booking'),[P,M]=(0,n.useState)('sms'),A=h[j],B=s=>m.useStore.getState().setTemplate(e,j,s),L=Object.fromEntries(p.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),R=l.LIVE_VENUE_BUILD?{sms:L,email:L}:'order'===j?(0,p.orderVars)({...S,slotTime:`${o}T18:45:00`},s):(0,p.bookingVars)({...C,date:o},s),I=(0,p.toGsm)((0,p.fill)(A.sms,R.sms)),N=(0,p.fill)(A.subject,R.email),_=(0,p.emailHtml)((0,p.fillEmailText)(A.body,R.email),{venue:s.name,preheader:N}),O=!!r?.[j],D=s.settings;return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsx)(u.Banner,{kind:"demo",title:"Preview mode",children:p.PREVIEW_BANNER}),(0,T.jsxs)(u.Muted,{children:["Every booking and takeaway order gets a text (a phone number is needed to book) and an email if they gave one. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest."]}),(0,T.jsx)(u.Row,{wrap:!0,gap:6,children:Object.keys(p.DEFAULT_TEMPLATES).map(e=>(0,T.jsx)(u.Chip,{label:p.TEMPLATE_LABEL[e].title,selected:j===e,onPress:()=>f(e)},e))}),(0,T.jsx)(u.Muted,{children:p.TEMPLATE_LABEL[j].when}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Text message"}),(0,T.jsxs)(u.Muted,{children:[(0,p.smsParts)(I).chars," characters"]})]}),(0,T.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:A.sms,onChangeText:e=>B({sms:e}),style:[u.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,p.smsParts)(I).chars>300?(0,T.jsx)(u.T,{size:13,colour:y.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,T.jsx)(u.T,{weight:"semibold",children:"Email subject"}),(0,T.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:A.subject,onChangeText:e=>B({subject:e}),style:u.styles.input}),(0,T.jsx)(u.T,{weight:"semibold",children:"Email message"}),(0,T.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:A.body,onChangeText:e=>B({body:e}),style:[u.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,T.jsxs)(u.Row,{gap:6,style:{flexWrap:'wrap'},children:[b?(0,T.jsx)(u.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>B(E(A))}):null,O?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,j,null)}):null]}),b?(0,T.jsx)(u.Muted,{children:"\u201cMake it warmer\u201d is an on-device wording tool: it rewrites on this device and keeps every detail. Check it reads right before you leave it."}):null,(0,T.jsxs)(u.Muted,{children:["Placeholders: ",p.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Live preview"}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:"Text",selected:'sms'===P,onPress:()=>M('sms')}),(0,T.jsx)(u.Chip,{label:"Email",selected:'email'===P,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,T.jsx)(u.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,T.jsxs)(u.Muted,{children:["Sample guest: Alex, ",'order'===j?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===P?(0,T.jsx)(v,{text:I,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),N]}),(0,T.jsx)(k,{html:_})]})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,T.jsx)(u.Muted,{children:"Online bookings above this size wait for you to confirm. The guest gets a \u201cwe\u2019ve got your request\u201d message first, then the confirmation once you accept."}),(0,T.jsx)(u.Stepper,{label:"Auto-accept online bookings up to",value:D.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,T.jsx)(u.Toggle,{label:"Also check online bookings with a special request",value:!!D.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,T.jsxs)(u.Card,{children:[(0,T.jsx)(u.T,{weight:"semibold",children:"Going live"}),(0,T.jsxs)(u.Muted,{children:["Nothing is sent yet. To send real texts and emails: a text service account (for example Twilio) and an email service (for example Postmark), a small CoverCharge server to keep the keys safe, and your sender name (",s.name,") registered. Your venue name, address and phone come from Info & hours."]})]})]})},_e.Outbox=function(){const{rid:e}=(0,w.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[h,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:y.colours.gold,borderRadius:12,padding:12},children:[(0,T.jsx)(u.T,{weight:"semibold",colour:y.colours.gold,children:(0,p.isLive)()?'Live: messages are sent through your text and email service.':p.PREVIEW_BANNER}),(0,p.isLive)()?null:(0,T.jsx)(u.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,T.jsx)(u.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,T.jsx)(u.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,T.jsx)(u.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,T.jsxs)(u.Card,{children:[(0,T.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(h===e.id?null:e.id),style:{gap:4},children:[(0,T.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(u.Row,{gap:6,children:[(0,T.jsx)(u.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,T.jsxs)(u.T,{weight:"semibold",children:[P[e.kind]," \xb7 ",e.ref]})]}),(0,T.jsx)(u.Muted,{children:e.at.slice(11,16)})]}),(0,T.jsxs)(u.Muted,{children:["To ",e.toName,", ",e.to]}),(0,T.jsx)(u.T,{size:13,colour:'sent'===e.status?y.colours.ok:'failed'===e.status?y.colours.red:y.colours.amber,children:(0,p.statusLabel)(e)})]}),'sms'===e.channel?(0,T.jsx)(v,{text:e.body}):h===e.id?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(u.T,{size:14,children:[(0,T.jsx)(u.T,{size:14,colour:y.colours.muted,children:"Subject: "}),e.subject]}),(0,T.jsx)(k,{html:e.html??'',height:560})]}):(0,T.jsxs)(u.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,T.jsx)(u.Button,{small:!0,kind:"ghost",label:"Clear the Outbox",onPress:()=>m.useStore.getState().clearOutbox(e)}):null]})};var s=_r(d[0]),t=_r(d[1]),l=_r(d[2]),n=_r(d[3]),o=e(n);_r(d[4]);var r=e(_r(d[5])),c=e(_r(d[6])),u=_r(d[7]),h=_r(d[8]),m=_r(d[9]),x=_r(d[10]),p=_r(d[11]),b=_r(d[12]),j=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]);function k({html:e,height:s=520}){return o.default.createElement('iframe',{srcDoc:e,title:'Email preview',sandbox:'',style:{width:'100%',height:s,border:'1px solid #2a2a2a',borderRadius:12,background:'#f4efe6'}})}function v({text:e,to:t}){const l=(0,p.smsParts)(e);return(0,T.jsxs)(c.default,{style:{gap:4},children:[t?(0,T.jsxs)(u.Muted,{children:["To ",t]}):null,(0,T.jsx)(c.default,{style:{alignSelf:'flex-start',maxWidth:420,backgroundColor:(0,s.soutersSurface)('#1f1f22'),borderRadius:18,borderBottomLeftRadius:4,padding:12,borderWidth:1,borderColor:'#2c2c30'},children:(0,T.jsx)(u.T,{size:15,children:e})}),(0,T.jsxs)(u.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const C={name:'Alex Morgan',partySize:4,date:'',time:'19:30',ref:'B-1042',allergies:[{allergen:'peanuts',severity:'allergy'}],notes:'It\u2019s my mum\u2019s birthday',table:void 0},S={customerName:'Alex Morgan',ref:'T-2093',total:3150,slotTime:void 0,readyBy:void 0,allergies:[{allergen:'milk',severity:'intolerance'}],lines:[{qty:2,name:'Fish and chips',choices:[]},{qty:1,name:'Sticky toffee pudding',choices:[]}]};function E(e){const s=e.sms.replace(/^Hi \{first\},/,'Hi {first}, lovely news!').replace(/See you soon,/,'We can\u2019t wait to see you,');let t=e.body;return/can\u2019t wait/.test(t)||(t=t.replace(/(Hi \{first\},\n\n)/,'$1We\u2019re so glad you chose us. ')),t=t.replace(/Warm wishes,/,'With very warm wishes from all of us,'),{sms:s,subject:e.subject,body:t}}const P={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1436,[798,796,806,34,236,402,102,794,1175,848,1418,833,1177,1033,840,1045,1100,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,i.useOwner)(e=>e.site),u=(0,o.useSheets)(e),[c,m]=(0,l.useState)(null);return c?(0,p.jsxs)(s.Card,{children:[(0,p.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===c.id)?`Edit ${c.name}`:'New supplier'}),(0,p.jsx)(x,{rid:e,s:c,onDone:()=>m(null)})]}):(0,p.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,p.jsx)(s.Banner,{kind:"info",title:"Used by the Head Chef app",children:"Each supplier gets an order sheet in Head Chef \u203a Ordering. Text, WhatsApp and phone orders open the phone\u2019s own app with the order written out, and the chef presses Send. Nothing is sent automatically."}),u.map(e=>(0,p.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,p.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,p.jsx)(s.Muted,{children:[e.goods,e.deliveryDays.length?`delivers ${(0,h.dayRange)(e.deliveryDays)}`:'',e.orderDays.length?`order ${(0,h.dayRange)(e.orderDays)}`:'',e.frequency,e.priceCapPerKg?`cap ${(0,d.gbp)(e.priceCapPerKg)}/kg`:''].filter(Boolean).join(' \xb7 ')}),'text'!==e.method&&'whatsapp'!==e.method&&'phone'!==e.method||e.number?null:(0,p.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,p.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,p.jsx)(s.Row,{wrap:!0,gap:8,children:(0,p.jsx)(s.Button,{label:"Add supplier",testID:"sheet-add",onPress:()=>m({id:(0,h.sid)(),name:'',goods:'',method:'text',number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:''})})})]})};var l=r(_d[0]),t=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),i=r(_d[4]),o=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]);const c=['online','phone','text','whatsapp','tbc'];function m({label:e,value:l,onChange:t}){return(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,p.jsx)(s.Chip,{label:e,selected:l.includes(n),onPress:()=>t(l.includes(n)?l.filter(e=>e!==n):[...l,n].sort())},e))})]})}function x({rid:e,s:t,onDone:i}){const d=(0,o.useOrderSheets)(e=>e.upsert),x=(0,o.useOrderSheets)(e=>e.remove),[b,f]=(0,l.useState)(t),[j,y]=(0,l.useState)(t.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[C,v]=(0,l.useState)(t.priceCapPerKg?(t.priceCapPerKg/100).toFixed(2):''),[w,T]=(0,l.useState)(!1),D=e=>f(l=>({...l,...e}));return(0,p.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,p.jsx)(s.Field,{label:"Supplier name",value:b.name,onChangeText:e=>D({name:e})}),(0,p.jsx)(s.Field,{label:"What they supply",value:b.goods,onChangeText:e=>D({goods:e})}),(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:c.map(e=>(0,p.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:b.method===e,onPress:()=>D({method:e})},e))})]}),'text'===b.method||'whatsapp'===b.method||'phone'===b.method?(0,p.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:b.number,keyboardType:"phone-pad",onChangeText:e=>D({number:e})}):null,'online'===b.method?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:b.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>D({url:e.trim()})}),(0,p.jsx)(s.Field,{label:"Button label",value:b.urlLabel??'',placeholder:"Open website",onChangeText:e=>D({urlLabel:e})})]}):null,(0,p.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:b.contact??'',onChangeText:e=>D({contact:e})}),(0,p.jsx)(m,{label:"Delivery days",value:b.deliveryDays,onChange:e=>D({deliveryDays:e})}),(0,p.jsx)(m,{label:"Order days (a reminder shows in the Head Chef app)",value:b.orderDays,onChange:e=>D({orderDays:e})}),(0,p.jsxs)(s.Row,{gap:10,children:[(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:b.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>D({cutoff:e})})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Price cap \xa3/kg (optional)",value:C,keyboardType:"decimal-pad",onChangeText:v})})]}),(0,p.jsx)(s.Field,{label:"Reminder text (optional)",value:b.reminder,onChangeText:e=>D({reminder:e})}),(0,p.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:b.frequency,onChangeText:e=>D({frequency:e})}),b.priceCapPerKg||C?(0,p.jsx)(s.Field,{label:"Seller",value:b.seller,onChangeText:e=>D({seller:e})}):null,(0,p.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:y}),(0,p.jsx)(s.Field,{label:"Notes for the chef",value:b.notes,multiline:!0,onChangeText:e=>D({notes:e})}),(0,p.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,p.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const l=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,l)=>{const[n,s]=e.split('|').map(e=>e.trim()),i=t.items.find(e=>e.name===n);return{id:i?.id??`${b.id}-i${l}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*parseFloat(C.replace(/[\xa3,]/g,'')));d(e,{...b,items:l,priceCapPerKg:n>0?n:0,placeholder:b.placeholder&&'tbc'===b.method}),i()},disabled:!b.name.trim()}),(0,p.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:i}),w?(0,p.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{x(e,t.id),i()}}):(0,p.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>T(!0)})]})]})}},1437,[34,402,102,794,865,1016,836,1017,840,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaySaverSettings=function(){const{rid:e,me:s}=(0,v.useCtx)(6e4),u=s.replace(' (example)','');(0,f.useSync)(e=>e.venueId);const x=(0,b.saverConnected)(),R=!x||(0,f.can)('venue.settings'),D=(0,b.useSaverSync)(),[k,M]=(0,t.useState)(D??p.SAVER_DEFAULT),[C,T]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[L,E]=(0,t.useState)(null);(0,t.useEffect)(()=>{C||M(D??p.SAVER_DEFAULT)},[D]);const O=e=>{R&&(M(t=>({...t,...e})),T(!0),E(null))},_=async()=>{P(!0);try{await(0,b.saveSaver)(k,u),T(!1),E({kind:'success',t:x?'Saved. The Display changes within a few seconds; no need to pair it again.':'Saved on this device (demo).'})}catch(e){E({kind:'danger',t:`Couldn't save: ${e.message}`})}finally{P(!1)}},{width:$}=(0,l.default)(),U=Math.min($-48,520),A=Math.round(10*U/16);return(0,j.jsxs)(n.default,{style:{gap:14,width:'100%',maxWidth:640,alignSelf:'center'},testID:"saver-settings",children:[(0,j.jsx)(i.T,{center:!0,size:22,weight:"semibold",colour:c.colours.gold,accessibilityRole:"header",children:"Display screensaver"}),(0,j.jsx)(i.Muted,{center:!0,children:"What the Display shows when nobody has touched it for a while. Tap anywhere on the Display to wake it; that tap doesn\u2019t press anything."}),R?null:(0,j.jsx)(i.Banner,{kind:"info",title:"Managers and owners only",children:"You can see the screensaver settings, but only a manager or owner can change them."}),!D&&x?(0,j.jsx)(i.Muted,{center:!0,children:"Not set yet: the Display shows your logo after the idle time set on that Display."}):null,(0,j.jsx)(i.Card,{children:(0,j.jsx)(i.Toggle,{label:"Screensaver on",value:k.on,onChange:e=>O({on:e}),testID:"saver-on",a11y:"Screensaver on or off"})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Start after"}),(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:p.IDLE_OPTIONS.map(e=>(0,j.jsx)(i.Chip,{label:e.label,selected:k.idleMins===e.mins,disabled:!k.on,onPress:()=>O({idleMins:e.mins}),testID:`saver-idle-${e.mins}`,accessibilityLabel:e.mins?`Start after ${e.mins} minutes with no touches`:'Never start the screensaver'},e.mins))}),(0,j.jsx)(i.Muted,{center:!0,children:k.on?k.idleMins?`Starts after ${k.idleMins} minutes with no touches.`:'Never: the Display stays on the board.':'Off: the Display never goes to the screensaver.'})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Style"}),(0,j.jsx)(n.default,{accessibilityRole:"radiogroup",style:{gap:8},children:p.SAVER_STYLES.map(e=>{const t=k.style===e.id;return(0,j.jsxs)(o.default,{testID:`saver-style-${e.id}`,onPress:()=>O({style:e.id}),disabled:!R,accessibilityRole:"radio",accessibilityState:{checked:t,disabled:!R},accessibilityLabel:`${e.label}. ${e.sub}`,style:{minHeight:64,borderRadius:14,borderWidth:2,borderColor:t?c.colours.gold:c.colours.border,backgroundColor:t?'rgba(201,162,74,0.12)':'transparent',paddingVertical:10,paddingHorizontal:14,alignItems:'center',justifyContent:'center'},children:[(0,j.jsxs)(i.T,{center:!0,weight:"semibold",colour:t?c.colours.gold:c.colours.text,children:[t?'\u25cf ':'\u25cb ',e.label]}),(0,j.jsx)(i.Muted,{center:!0,children:e.sub})]},e.id)})})]}),(0,j.jsx)(S,{rid:e,c:k,set:O,editor:R,connected:x,onMsg:E}),'photos'===k.style?(0,j.jsx)(w,{c:k,set:O,editor:R,connected:x,onMsg:E}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.Toggle,{label:"Dim at night",value:k.dimOn,onChange:e=>O({dimOn:e}),testID:"saver-dim",a11y:"Dim the screensaver at night"}),k.dimOn?(0,j.jsxs)(n.default,{style:{gap:8,alignItems:'center'},children:[(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"From"}),(0,j.jsx)(i.Stepper,{label:"Dim from",value:(0,y.toMins)(k.dimFrom),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimFrom:(0,y.fromMins)(e)}),testID:"saver-dim-from"})]}),(0,j.jsxs)(i.Row,{gap:10,style:{justifyContent:'center'},children:[(0,j.jsx)(i.T,{children:"Until"}),(0,j.jsx)(i.Stepper,{label:"Dim until",value:(0,y.toMins)(k.dimTo),min:0,max:1410,step:30,format:y.fromMins,onChange:e=>O({dimTo:(0,y.fromMins)(e)}),testID:"saver-dim-to"})]})]}):null,(0,j.jsxs)(i.Muted,{center:!0,children:[(0,p.dimWords)(k),". The screensaver is shown much darker between these times."]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Preview"}),(0,j.jsx)(n.default,{style:{alignItems:'center'},testID:"saver-preview",accessibilityLabel:"Preview of the screensaver",children:(0,j.jsx)(n.default,{style:{width:U,height:A,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:c.colours.border},children:k.on?(0,j.jsx)(h.Saver,{rid:e,cfg:k,box:{width:U,height:A}},`${k.style}-${k.photos.length}-${k.logo??''}`):(0,j.jsx)(n.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.Muted,{center:!0,children:"Screensaver off"})})})})]}),L?(0,j.jsx)(i.Banner,{kind:L.kind,children:L.t}):null,R?(0,j.jsx)(i.Button,{label:I?'Saving\u2026':C?'Save screensaver':'Saved',disabled:I||!C,onPress:()=>{_()},testID:"saver-save"}):null]})};var t=r(d[0]),s=e(t);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),l=e(r(d[4])),i=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),v=r(d[13]),j=r(d[14]);const x='undefined'!=typeof document;function w({c:e,set:o,editor:l,connected:h,onMsg:u}){const y=(0,t.useRef)(null),[f,v]=(0,t.useState)(!1),[w,S]=(0,t.useState)({});(0,t.useEffect)(()=>{let t=!0;return Promise.all(e.photos.map(async e=>[e,await(0,b.saverPhotoUrl)(e)])).then(e=>{t&&S(Object.fromEntries(e.filter(e=>e[1])))}),()=>{t=!1}},[e.photos.join('|')]);const R=async t=>{if(t?.length){v(!0);try{const s=[];for(const o of Array.from(t).slice(0,p.MAX_SAVER_PHOTOS-e.photos.length))s.push(h?await(0,b.uploadSaverPhoto)(o,e.photos.length+s.length):URL.createObjectURL(o));o({photos:[...e.photos,...s]}),u({kind:'success',t:`${s.length} photo${1===s.length?'':'s'} added. Tap Save screensaver to show ${1===s.length?'it':'them'} on the Display.`})}catch(e){u({kind:'danger',t:e.message})}finally{v(!1),y.current&&(y.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Slideshow photos"}),(0,j.jsxs)(i.Muted,{center:!0,children:["Your own photos of the venue, food and team, one every 8 seconds. Up to ",p.MAX_SAVER_PHOTOS,". With no photos the Display shows your logo."]}),e.photos.length?(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:e.photos.map((t,h)=>(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:4},children:[w[t]&&x?s.default.createElement('img',{src:w[t],alt:`Slideshow photo ${h+1}`,style:{width:96,height:64,objectFit:'cover',borderRadius:8}}):(0,j.jsx)(n.default,{style:{width:96,height:64,borderRadius:8,backgroundColor:c.colours.border}}),l?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove photo ${h+1} from the slideshow`,onPress:()=>o({photos:e.photos.filter(e=>e!==t)})}):null]},t))}):(0,j.jsx)(i.Muted,{center:!0,children:"No photos yet."}),l?(0,j.jsx)(i.Button,{kind:"secondary",label:f?'Uploading\u2026':'Upload photos',disabled:f||e.photos.length>=p.MAX_SAVER_PHOTOS,onPress:()=>{x&&y.current?.click()},testID:"saver-upload",accessibilityLabel:"Upload photos for the slideshow"}):null,x?s.default.createElement('input',{ref:y,type:'file',accept:'image/jpeg,image/png,image/webp',multiple:!0,style:{display:'none'},'aria-hidden':!0,onChange:e=>{R(e.target.files)}}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Removing a photo takes it off the slideshow; the file itself is kept."})]})}function S({rid:e,c:o,set:l,editor:y,connected:f,onMsg:v}){const w=(0,t.useRef)(null),[S,R]=(0,t.useState)(!1),[D,k]=(0,t.useState)(!1),M=(0,u.useBrand)(e).name,C=!!o.logo,T=async e=>{const t=e?.[0];if(t){R(!0);try{let e;if(f)e=await(0,b.uploadSaverLogo)(t);else{const s=(0,p.logoFileProblem)(t.type,t.size);if(s)throw new Error(s);if('image/svg+xml'===t.type&&!(0,p.svgSafe)(await t.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');e=URL.createObjectURL(t)}l({logo:e}),v({kind:'success',t:(C?'New logo ready':'Logo uploaded')+". Tap Save screensaver to show it on the Display."})}catch(e){v({kind:'danger',t:e.message})}finally{R(!1),w.current&&(w.current.value='')}}};return(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(n.default,{style:{alignItems:'center',gap:10},testID:"saver-logo-card",children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Screensaver logo"}),(0,j.jsx)(i.Muted,{center:!0,children:'logo'===o.style?'Shown drifting slowly round the Display.':'Shown with the Logo style, and small on the clock and covers screens.'}),(0,j.jsx)(n.default,{style:{minWidth:132,maxWidth:240,height:132,paddingHorizontal:12,borderRadius:14,backgroundColor:'#000000',borderWidth:1,borderColor:c.colours.border,alignItems:'center',justifyContent:'center'},accessible:!0,accessibilityLabel:C?'Your uploaded logo':`Your standard logo, ${M}`,children:(0,j.jsx)(h.SaverLogoPreview,{rid:e,path:o.logo,size:108})}),(0,j.jsx)(i.Muted,{center:!0,children:C?'Your uploaded logo':'Your standard logo'}),y?(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:C?'secondary':'primary',label:S?'Uploading\u2026':C?'Replace logo':'Upload logo',disabled:S,onPress:()=>{x&&w.current?.click()},testID:"saver-logo-upload",accessibilityLabel:C?'Replace the screensaver logo':'Upload a logo for the screensaver'}),C?(0,j.jsx)(i.Button,{kind:"ghost",label:"Remove",disabled:S,onPress:()=>k(!0),testID:"saver-logo-remove",accessibilityLabel:"Remove the uploaded logo and go back to the standard one"}):null]}):null,(0,j.jsx)(i.Muted,{center:!0,children:"PNG, JPG or SVG, up to 2 MB (an SVG is saved as a picture). A square logo on a transparent or black background looks best."})]}),x?s.default.createElement('input',{ref:w,type:'file',accept:Object.keys(p.LOGO_TYPES).join(','),style:{display:'none'},'aria-hidden':!0,onChange:e=>{T(e.target.files)}}):null,D?(0,j.jsx)(i.Sheet,{visible:!0,onClose:()=>k(!1),title:"Remove the uploaded logo?",maxWidth:520,testID:"saver-logo-remove-confirm",children:(0,j.jsxs)(n.default,{style:{gap:12,alignItems:'center'},children:[(0,j.jsx)(i.Muted,{center:!0,children:"The screensaver goes back to your standard logo once you save. The uploaded file is kept, and the standard logo isn\u2019t changed."}),(0,j.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep it",onPress:()=>k(!1),testID:"saver-logo-remove-no"}),(0,j.jsx)(i.Button,{kind:"danger",label:"Remove logo",onPress:()=>{l({logo:null}),k(!1),v({kind:'success',t:'Logo removed. Tap Save screensaver to go back to the standard logo on the Display.'})},testID:"saver-logo-remove-yes"})]})]})}):null]})}},1438,[34,236,402,102,426,794,840,1301,847,1303,827,985,1304,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1439,[804,982,1377,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableQrPage=function(){const{rid:e,me:t}=(0,h.useCtx)(6e4),b=t.replace(' (example)','');return(0,u.jsxs)(s.default,{style:{gap:14,width:'100%',maxWidth:760,alignSelf:'center'},testID:"table-qr-page",children:[(0,u.jsx)(l.T,{center:!0,size:22,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Table QR codes"}),(0,u.jsx)(l.Muted,{center:!0,children:"Guests scan the code on their table, see the menu and send their order to the kitchen. They pay at the bar or with their server."}),(0,u.jsx)(c.TableOrderSettings,{rid:e,me:b}),(0,u.jsx)(l.T,{center:!0,size:20,weight:"semibold",colour:o.colours.gold,accessibilityRole:"header",children:"Orders from the tables"}),(0,u.jsx)(n.StaffTableOrders,{rid:e,me:b})]})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),n=r(d[5]),h=r(d[6]),u=r(d[7])},1440,[34,102,794,840,1359,1430,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=m,_e.HelpPage=function({go:e}){const[i,o]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[m,y]=(0,s.useState)(null),w=(0,s.useMemo)(()=>i.trim()?(0,c.searchHelp)(r.HELP,i,10).map(e=>e.a):r.HELP.filter(e=>!h||e.topic===h),[i,h]);return(0,x.jsxs)(n.default,{style:{gap:10},testID:"help-page",children:[(0,x.jsxs)(n.default,{style:[a.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\ud83d\udd0d"}),(0,x.jsx)(t.TextInput,{testID:"help-search",value:i,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:u.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),i?(0,x.jsx)(l.default,{onPress:()=>o(''),accessibilityLabel:"Clear search",children:(0,x.jsx)(a.T,{colour:u.colours.muted,children:"\u2715"})}):null]}),(0,x.jsx)(j,{go:e}),i?(0,x.jsx)(a.Muted,{children:w.length?`${w.length} result${1===w.length?'':'s'} for \u201c${i.trim()}\u201d`:`Nothing for \u201c${i.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:[null,...r.HELP_TOPICS].map(e=>(0,x.jsx)(a.Chip,{label:e??'All',selected:h===e,onPress:()=>p(e)},e??'all'))}),w.map((t,s)=>(0,x.jsx)(f,{a:t,go:e,open:m===t.id||!!i&&0===s&&null===m,onToggle:()=>y(m===t.id?'':t.id)},t.id)),(0,x.jsxs)(a.Card,{style:{alignItems:'center'},children:[(0,x.jsx)(a.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:"Chat with CoverCharge support"}),(0,x.jsx)(a.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,x.jsx)(a.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=j;var t=_r(d[0]),s=_r(d[1]),l=e(_r(d[2])),n=e(_r(d[3])),a=_r(d[4]),i=_r(d[5]),o=_r(d[6]),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),p=_r(d[11]),x=_r(d[12]);function m(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>o.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function f({a:e,go:t,open:s,onToggle:i}){return(0,x.jsx)(n.default,{testID:`help-${e.id}`,children:(0,x.jsxs)(a.Card,{children:[(0,x.jsx)(l.default,{accessibilityRole:"button",onPress:i,children:(0,x.jsxs)(a.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,x.jsxs)(n.default,{style:{flex:1},children:[(0,x.jsx)(a.T,{weight:"semibold",children:e.title}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,x.jsx)(a.Muted,{size:12,children:e.topic})]})]}),(0,x.jsx)(a.T,{colour:u.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,x.jsxs)(a.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,x.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,x.jsx)(a.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>m(e,t)})}):null]})})}function j({go:e}){const{rid:t,today:l}=(0,p.useCtx)(6e4),i={rid:t,today:l,go:(t,s)=>e(t,s??null)},[o,c]=(0,s.useState)(''),[f,j]=(0,s.useState)(null),[b,C]=(0,s.useState)(null),k=async()=>{const e=o.trim();if(!e)return;C(null),j(null);const t=(0,h.matchIntent)(e,l);if('action'!==t.kind)'help'!==t.kind?C({text:'Sorry, I didn\u2019t follow that. Try \u201cadd a walk-in for 4 at table 7\u201d, \u201cput Ellie on Friday 5 till 11\u201d, or ask \u201chow do I export hours?\u201d.',kind:'note'}):C({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,h.needsConfirm)(t.action.risk)){const e=await(0,h.runAction)(t.action.id,t.params,i);return void C({text:'done'===e.status?e.message:e.message??'',kind:'done'})}j({action:t.action,params:{...y(t.action,l),...t.params},asked:e})}};return(0,x.jsx)(n.default,{testID:"ask-assistant",children:(0,x.jsxs)(a.Card,{highlight:u.colours.gold,children:[(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(n.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(a.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,x.jsxs)(n.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,x.jsx)(a.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:c,placeholder:"Ask in plain words",onSubmitEditing:k,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,x.jsx)(a.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:k,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:['Add a walk-in for 4 at table 7','Put a shift on Friday 5 till 11','How do I export hours for payroll?','Pay out the tips'].map(e=>(0,x.jsx)(a.Chip,{label:e,onPress:()=>c(e)},e))}),f?(0,x.jsx)(w,{p:f,today:l,onChange:e=>j({...f,params:e}),onConfirm:async()=>{if(!f)return;const e=await(0,h.runAction)(f.action.id,f.params,i,!0);j(null),c(''),C('done'===e.status?{text:e.message,kind:'done'}:'demo_only'===e.status?{text:e.message,kind:'demo'}:{text:e.message??'Couldn\u2019t do that.',kind:'error'})},onCancel:()=>{j(null),C({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,b?(0,x.jsxs)(n.default,{style:{gap:6},testID:"assistant-reply",children:[(0,x.jsx)(a.Banner,{kind:'done'===b.kind?'success':'error'===b.kind?'warn':'demo'===b.kind?'demo':'info',title:b.text}),b.help?.map(t=>{const s=(0,r.helpById)(t);return(0,x.jsxs)(a.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,x.jsx)(a.T,{style:{flex:1},children:s.title}),s.showMe?(0,x.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>m(s,e)}):null]},t)})]}):null,(0,x.jsx)(a.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})}function y(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function w({p:e,today:t,onChange:s,onConfirm:l,onCancel:o}){const r=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,h.demoOnly)(e.action.risk),p=(t,l)=>s({...e.params,[t]:l}),m=e.action,f=e.params,j=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,x.jsxs)(n.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?u.colours.red:u.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':u.colours.okBg},children:[(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(a.Badge,{kind:c?'red':'ok',label:h.RISK_LABEL[m.risk]}),(0,x.jsx)(a.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>p('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>p('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,x.jsxs)(n.default,{style:{gap:6},children:[(0,x.jsx)(a.Muted,{size:12,children:"Who"}),(0,x.jsx)(a.Row,{wrap:!0,gap:6,children:r.slice(0,14).map(e=>(0,x.jsx)(a.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>p('staffId',e.id)},e.id))}),(0,x.jsxs)(a.Row,{gap:6,children:[(0,x.jsx)(n.default,{style:{flex:1.3},children:(0,x.jsx)(a.Field,{label:"Date (YYYY-MM-DD)",value:String(f.date??t),onChangeText:e=>p('date',e)})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>p('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,x.jsx)(n.default,{style:{flex:1},children:(0,x.jsx)(a.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>p('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,x.jsx)(a.T,{children:j?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,x.jsx)(a.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,x.jsx)(a.Muted,{children:"Nothing happens until you tap Confirm."}),(0,x.jsxs)(a.Row,{gap:8,children:[(0,x.jsx)(a.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!j,onPress:l,style:{flex:1}}),(0,x.jsx)(a.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1441,[796,34,402,102,794,865,1391,1442,1443,1444,840,1100,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1442,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1443,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${$[t.risk]}${O(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if(O(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(u.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const u=(0,l.searchHelp)(p.HELP,e,3);return u.length?{kind:'help',ids:u.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,$={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},O=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);if(!(e.staffId&&e.date&&a>t))return'That shift isn\u2019t complete.';const s=(0,n.leaveOn)(n.useOwner.getState().leave,String(e.staffId),String(e.date));return s?`${_(e.staffId)} has time off then (${N(s.from)} to ${N(s.to)}). Add the shift on the Rota yourself if they\u2019ve agreed to work.`:(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`)}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...c.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1444,[1445,1098,829,1446,1447,865,848,1014,1391,1442,1443,1449,1448,1451,1452,1012,1013]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1445,[1399,1398,1038]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1446,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1447,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1448,1446]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1448,[804,1098,829,1120,1206,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1449,1450]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1449,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1450,[808,815,818]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1451,[800,865,989,836,1448,1032]); +__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1452,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceSettingsPage=function(){const{rid:e,r:s,now:t}=(0,f.useCtx)(6e4),o=(0,p.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"Staff hold the gold button, say what they need and let go. It sits at the top right in Managers, Head Chef, the Staff app (the full voice assistant, without team financial or HR information) and on the Display (no money, tips or HR either), never in the customer app. Tap it to type or open the Assistant. Replies and change confirmations are shown in text, never spoken. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts for you."}),(0,x.jsx)(c.VoiceUsageCard,{rid:e,now:t}),(0,x.jsxs)(i.Card,{children:[(0,x.jsxs)(i.T,{weight:"semibold",children:["Who gets the voice button at ",s.name]}),(0,x.jsx)(n.default,{style:{gap:6,marginTop:8},children:p.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:p.VOICE_ROLE_LABEL[s],value:(0,p.voiceOn)(o.enabled,e,s),onChange:t=>o.setEnabled(e,s,t)},s))}),(0,x.jsx)(i.Muted,{children:"Saved on this device for now; set it on each device."})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{testID:"voice-text-only",weight:"semibold",children:"The helper replies in text only. It never speaks."}),(0,x.jsx)(i.Row,{gap:8,wrap:!0,style:{marginTop:8},children:(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Show the microphone explanation again",onPress:()=>o.setMicExplained(!1)})})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{weight:"semibold",children:"Privacy"}),(0,x.jsxs)(i.Muted,{children:["What is said while the button is held (up to 30 seconds) is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. Each device asks once to use the microphone. ",(0,u.canListen)()?'This device can listen.':'This device can\u2019t listen, so the button offers \u201ctype instead\u201d.']})]})]})},_e.DraftsPage=function(){const{rid:e,me:o,role:h}=(0,f.useCtx)(6e4),p=(0,r.useDrafts)(e=>e.drafts),u=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[j,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=p.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),C='owner'===h||'manager'===h,D=e=>e.supplier?d.SUPPLIER_PORTALS.find(s=>s.id===e.supplier):void 0,P=e=>(0,x.jsx)(i.Card,{children:(0,x.jsxs)(n.default,{testID:`draft-${e.id}`,style:{gap:6},children:[(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Badge,{label:r.DRAFT_LABEL[e.kind],kind:"gold"}),'draft'!==e.status?(0,x.jsx)(i.Badge,{label:'approved'===e.status?'Approved':'Dismissed',kind:'approved'===e.status?'ok':'neutral'}):null]}),(0,x.jsx)(i.T,{weight:"semibold",children:e.title}),e.lines.map((s,t)=>(0,x.jsxs)(i.T,{size:15,children:['shopping'===e.kind?'\u2022 ':'',s]},t)),(0,x.jsxs)(i.Muted,{children:["From ",e.by," (",e.app,"), ",b(e.at),e.decidedBy?` \xb7 ${e.status} by ${e.decidedBy}, ${b(e.decidedAt)}`:'']}),'draft'===e.status&&C?(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Button,{small:!0,kind:"success",label:"Approve",testID:`draft-approve-${e.id}`,onPress:()=>y({d:e,status:'approved'})}),(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Dismiss",testID:`draft-dismiss-${e.id}`,onPress:()=>y({d:e,status:'dismissed'})}),D(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${D(e).name} ordering`,onPress:()=>{t.default.openURL(D(e).links.order)}}):null]}):null]})},e.id);return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Nothing here has been sent, ordered or paid",children:"The voice helper and the Assistant save bookings, supplier shopping lists, offers, events, specials, messages and payments here for you to check. Approving marks it approved and takes you to the right screen; you still do the booking, the order or the post yourself."}),C?null:(0,x.jsx)(i.Banner,{kind:"warn",title:"Owners and managers approve drafts",children:"You can see the drafts but not approve them."}),B.length?B.map(P):(0,x.jsx)(i.Muted,{children:"No drafts waiting. Try holding the voice button and saying \u201cadd blue roll to the Booker list\u201d."}),S.length?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:k?'Hide approved and dismissed':`Show approved and dismissed (${S.length})`,onPress:()=>w(!k)}):null,k?S.map(P):null,(0,x.jsx)(i.Sheet,{visible:!!j,onClose:()=>y(null),title:'approved'===j?.status?'Approve this draft?':'Dismiss this draft?',children:j?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:j.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===j.status?`This marks it approved${v[j.d.kind]?` and opens ${v[j.d.kind].label}`:''}. Nothing is sent, ordered or paid automatically.`:'It moves to the dismissed list. Nothing is sent.'}),(0,x.jsx)(i.Button,{kind:'approved'===j.status?'success':'danger',label:'approved'===j.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{u(j.d.id,j.status,o.replace(' (example)',''));const e=v[j.d.kind];y(null),'approved'===j.status&&e&&c&&c(e.tab,e.sub)}}),(0,x.jsx)(i.Button,{kind:"secondary",label:"Back",onPress:()=>y(null)})]}):null})]})},_e.ShiftNotesPage=function(){const{rid:e}=(0,f.useCtx)(6e4),s=(0,h.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,h.useShiftNotes)(e=>e.setDone);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.Muted,{children:"Notes left for the next shift, by voice (\u201ctell the next shift the glass washer is leaking\u201d) or the Assistant. Kept on this device for now."}),s.length?s.slice(0,60).map(e=>(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{style:{textDecorationLine:e.done?'line-through':'none'},colour:e.done?o.colours.muted:o.colours.text,children:e.text}),(0,x.jsxs)(i.Row,{style:{justifyContent:'space-between',marginTop:6},children:[(0,x.jsxs)(i.Muted,{children:[e.by," (",e.app,"), ",b(e.at)]}),(0,x.jsx)(i.Button,{small:!0,kind:e.done?'ghost':'success',label:e.done?'Reopen':'Done',onPress:()=>t(e.id,!e.done)})]})]},e.id)):(0,x.jsx)(i.Muted,{children:"No shift notes yet."})]})};var s=_r(_d[0]),t=e(_r(_d[1])),n=e(_r(_d[2])),i=_r(_d[3]),o=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),l=_r(_d[7]),h=_r(_d[8]),p=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),f=_r(_d[12]),x=_r(_d[13]);const b=e=>new Date(e).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});const v={booking:{tab:'bookings',sub:null,label:'Bookings'},offer:{tab:'more',sub:'offers',label:'Specials & offers'},event:{tab:'more',sub:'events',label:'Events'},special:{tab:'more',sub:'specialsboard',label:'Specials board'},shopping:{tab:'more',sub:'suppliers',label:'Suppliers'}}},1453,[34,379,102,794,840,1387,1449,1401,1450,1117,929,1410,1100,25]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1454,[34,102,794,830,1203,1455,1456,840,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1455,[830]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1456,[985,1455,1206]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:s,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,d.useCashUp)(e=>e.cashUps),k=(0,d.useCashSettings)(e),w=(0,o.useNightlyPrefs)(l=>l.email[e]??!1),T=(0,o.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(l=>l.rid===e&&l.on).map(e=>e.name),[N,P]=(0,l.useState)((0,u.addDaysYmd)(v,-1)),U=(0,u.cashFieldsForRecord)(k.cashFields,s.settings.cashUpRecord),_=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:U,soldOut:C}),D='anchorage'!==e&&w,E=[0,1,2].map(e=>(0,u.addDaysYmd)(v,-e));return(0,j.jsxs)(t.default,{testID:"nightly-report",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,j.jsx)(n.Muted,{center:!0,children:"Spend per head, Covers and the cash-up for one night. Blank means it was not entered."}),(0,j.jsx)(t.default,{style:{width:'100%',gap:8},children:E.map(e=>(0,j.jsx)(n.Button,{kind:e===N?'primary':'secondary',label:e===v?'Today':e===(0,u.addDaysYmd)(v,-1)?'Yesterday':e,accessibilityLabel:`Nightly report for ${e}`,onPress:()=>P(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:_.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(_.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(_.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(_.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:_.takings}),(0,j.jsx)(x,{label:"Tips",value:_.tips}),(0,j.jsx)(x,{label:"Takings last week",value:_.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:_.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:_.soldOut.length?_.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),_.cashUp.length?_.cashUp.map(e=>(0,j.jsx)(x,{label:e.label,value:e.value},e.label)):(0,j.jsx)(n.Muted,{center:!0,children:"No cash-up fields for this venue."})]}),p.RELEASE.nightlyEmail&&'anchorage'!==e?(0,j.jsx)(n.Toggle,{testID:"nightly-email",label:"Also email the nightly report",value:D,onChange:l=>T(e,l)}):null]})};var e,l=_r(_d[0]),s=_r(_d[1]),t=(e=s)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),d=_r(_d[4]),o=_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=({label:e,value:l})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${l}`,style:{width:'100%',alignItems:'center',gap:2,paddingVertical:8},children:[(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,children:e}),(0,j.jsx)(n.T,{center:!0,children:l})]})},1457,[34,102,794,848,1024,1458,977,13,1459,1035,840,1100,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useNightlyPrefs",{enumerable:!0,get:function(){return s}});var e,t=r(d[0]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);const s=(0,n.create)()((0,o.persist)(e=>({email:{},setEmail:(t,l)=>e(e=>({email:{...e.email,[t]:'anchorage'!==t&&l}}))}),{name:'covercharge-nightly-email-v1',storage:(0,o.createJSONStorage)(()=>l.default),version:1}))},1458,[808,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(o){const{rid:u,date:c,bookings:f,cashUps:p,fields:v,soldOut:h}=o,b=f.filter(t=>t.restaurantId===u&&t.date===c),k=p.find(t=>t.rid===u&&t.date===c&&t.confirmedAt),y=p.find(n=>n.rid===u&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),N=k?(0,t.grossOf)(k.vals)??(0,t.takings)(k.vals):null,O=(0,n.coversOn)(f,u,c),S=null==N||O<=0?null:Math.round(N/O*100)/100,_=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&_.set(n,(_.get(n)??0)+(t.partySize||0))}let w=null;for(const[t,n]of _)(!w||n>w.n)&&(w={hour:t,n:n});return{date:c,spendPerHead:s(S),covers:O,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(N),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(y?(0,t.grossOf)(y.vals)??(0,t.takings)(y.vals):null),busiestHour:w?`${String(w.hour).padStart(2,'0')}:00 \xb7 ${w.n} Covers`:'Not entered',soldOut:h.filter(Boolean),cashUp:v.map(t=>({label:t.label,value:k?l(k.vals[t.key],t.kind):'Not entered'}))}};var t=r(d[0]),n=r(d[1]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t)},1459,[13,1427]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{rid:e,me:o,meId:S}=(0,m.useCtx)(6e4),j=(0,u.useSupportChat)(e=>e.messages).filter(t=>t.rid===e),C=(0,u.useSupportChat)(e=>e.send),y=(0,u.useSupportChat)(e=>e.markSent),[f,I]=(0,s.useState)(''),[M,w]=(0,s.useState)(''),T=S===b,v=async e=>{const t=await(0,p.writeSupportMessage)(e);if(t.ok)return y(e.id),void w('');w(t.message||c.SUPPORT_NOT_SENT)};return(0,x.jsxs)(n.default,{testID:"support-chat",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.Muted,{center:!0,children:"A message to the CoverCharge team. Nobody replies automatically."}),M?(0,x.jsx)(l.Muted,{center:!0,testID:"support-note",children:M}):null,j.length?j.map(e=>(0,x.jsxs)(l.Card,{style:{alignItems:'center',width:'100%'},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:e.from}),(0,x.jsx)(l.T,{center:!0,children:e.text}),(0,x.jsxs)(l.Muted,{center:!0,children:[e.sent?'Sent':'Not sent'," \xb7 ",new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]}),e.sent?null:(0,x.jsx)(l.Button,{kind:"ghost",label:"Send again",accessibilityLabel:`Send again: ${e.text}`,onPress:()=>{v(e)}})]},e.id)):(0,x.jsx)(l.Muted,{center:!0,children:"No messages yet."}),(0,x.jsx)(t.TextInput,{testID:"support-draft",accessibilityLabel:"Message to CoverCharge support",value:f,onChangeText:I,placeholder:"Write a message",placeholderTextColor:h.colours.muted,multiline:!0,style:{width:'100%',minHeight:88,borderWidth:1,borderColor:h.colours.border,borderRadius:12,padding:12,color:h.colours.text,textAlign:'center'}}),(0,x.jsx)(l.Button,{testID:"support-send",label:"Send",accessibilityLabel:"Send message to CoverCharge support",disabled:!f.trim(),onPress:()=>{const t=C(e,o||'Manager',S||'',f);t&&(I(''),v(t))}}),T?(0,x.jsxs)(n.default,{testID:"support-inbox",style:{width:'100%',alignItems:'center',gap:8},children:[(0,x.jsx)(l.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Support inbox"}),(0,x.jsx)(l.Muted,{center:!0,children:j.length?`${j.length} message${1===j.length?'':'s'} from this venue.`:'No messages in the inbox.'})]}):null]})};var e,t=r(d[0]),s=r(d[1]),o=r(d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),p=r(d[7]),m=r(d[8]),x=r(d[9]);const b='st-gordon'},1460,[796,34,102,794,1461,1036,840,1462,1100,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSupportChat",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=r(d[2]);let c=0;const u=(0,n.create)()((0,o.persist)(e=>({messages:[],send:(t,s,n,o)=>{const u=o.trim().slice(0,1e3);if(!u)return null;const l={id:`sm-${Date.now().toString(36)}${(c++).toString(36)}`,rid:t,at:(new Date).toISOString(),from:s.slice(0,80),staffRef:n,text:u,sent:!1};return e(e=>({messages:[...e.messages,l].slice(-200)})),l},markSent:t=>e(e=>({messages:e.messages.map(e=>e.id===t?{...e,sent:!0}:e)}))}),{name:'covercharge-support-chat-v1',storage:(0,o.createJSONStorage)(()=>s.default),version:1}))},1461,[808,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.writeSupportMessage=async function(S){if(!s.RELEASE.supportSync)return{ok:!1,message:t.SUPPORT_NOT_SENT};if(!(0,n.isSupabaseConfigured)())return{ok:!1,message:t.SUPPORT_NOT_SENT};const _=u.useSync.getState().venueId;if(!_)return{ok:!1,message:`${t.SUPPORT_NOT_SENT} Sign in and try again.`};try{const s=(0,o.getSupabase)(),{error:n}=await s.from('support_messages').insert({venue_id:_,body:S.text,from_name:S.from,staff_ref:S.staffRef||null});return n?{ok:!1,message:t.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:t.SUPPORT_NOT_SENT}}};var s=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4])},1462,[1035,1036,974,931,985]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1463,[236]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopShell=function(){const{rid:e,r:c,role:g,today:_,now:$,meId:V,me:Q}=(0,z.useCtx)(3e4);(0,m.useTipsPosted)(e,_);const Y=(0,z.useSignedIn)();(0,x.useSoldOutLink)(!0,(Y?.name??Q).replace(' (example)',''));const[ee,te]=(0,a.useState)({kind:'tab',tab:'home'}),[se,ae]=(0,a.useState)(''),oe=(0,a.useRef)(null);(0,a.useEffect)(()=>{(0,z.ensureAttendance)(_,$),(0,M.ensureChat)($)},[_]),globalThis.__ccNow=$.getTime();const ne=(0,a.useCallback)((e,t=null)=>{if('more'===e&&t){const e=q[t];return void te(e?{kind:'edit',id:e}:{kind:'page',id:t})}te('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,a.useEffect)(()=>(S.useVoiceNav.setState({go:ne}),()=>S.useVoiceNav.setState({go:null})),[ne]),(0,a.useEffect)(()=>{D.PITCH&&(globalThis.__pitchGo=ne,globalThis.__deskGo=e=>te(e))},[ne]),(0,E.useAlertWatcher)(e,{nag:'staff'!==g}),(0,w.useScheduledNotices)({rid:e,staffId:Y?.id??'',name:Q,onOpen:()=>ne('more','orderlists')}),(0,y.useOffRotaAlerts)({enabled:'staff'!==g&&!!Y}),(0,a.useEffect)(()=>((0,T.warmDesktopStt)(),(0,C.installVoiceKeys)()),[]);const re=(0,a.useMemo)(()=>[...G,...U].map(e=>e.s),[]);(0,a.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void oe.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=re[Number(e.key)-1];return void(t&&(e.preventDefault(),te(t)))}if('z'===t&&!Z(e.target)){const t=(0,W.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!Z(e.target)){const t=(0,W.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[re]);const ie=O.PAGES.filter(e=>(!e.can||e.can(g))&&!q[e.id]),le=(0,a.useMemo)(()=>{const e=se.trim().toLowerCase(),t={};return ie.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[ie,se]),de=G.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(g)),ue=p.CAN.forecasts(g)?U:U.filter(e=>'rota'===e.s.id),ce='page'===ee.kind?(0,O.pageFor)(ee.id):void 0,be='tab'===ee.kind?G.find(e=>X(e.s,ee))?.label:'edit'===ee.kind?U.find(e=>X(e.s,ee))?.label:ce?.title,he='tab'===ee.kind?G.find(e=>X(e.s,ee))?.tip:'page'===ee.kind?`${ce?.sub??''}. Press ${(0,N.CMD)()}K to jump to any page, or hold Space and ask.`:'',fe=({label:e,s:t,n:s})=>{const a=X(t,ee);return(0,K.jsxs)(o.default,{accessibilityRole:"button",accessibilityState:{selected:a},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>te(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:a?A.colours.goldTint:e?A.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:a?A.colours.gold:'transparent'}),children:[(0,K.jsx)(f.T,{size:14,weight:a?'semibold':'regular',colour:a?A.colours.gold:A.colours.text,style:{flex:1},numberOfLines:1,children:e}),s?(0,K.jsxs)(f.T,{size:11,colour:A.colours.muted,children:[(0,N.CMD)(),s]}):null]})},ge=({t:e})=>(0,K.jsx)(f.T,{size:11,weight:"semibold",colour:A.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),pe='owner'===g?'OWNER':'manager'===g?'MANAGER':'STAFF';return(0,K.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:A.colours.bg},testID:"desktop-shell",children:[(0,K.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,K.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(f.Row,{gap:10,children:[(0,K.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsx)(u.VenueName,{name:c.name}),(0,K.jsx)(f.Row,{gap:6,children:(0,K.jsx)(l.AppBadge,{label:pe})})]})]}),(0,K.jsx)(u.PoweredBy,{}),(0,K.jsx)(s.TextInput,{ref:oe,testID:"side-filter",value:se,onChangeText:ae,placeholder:`Find a page (${(0,N.CMD)()}K)`,placeholderTextColor:A.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,K.jsxs)(n.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[se?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{t:"Run the day"}),de.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:t+1},e.label)),(0,K.jsx)(ge,{t:"Drag-and-drop editors"}),ue.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:de.length+t+1},e.label))]}),Object.entries(le).map(([e,t])=>(0,K.jsxs)(r.default,{children:[(0,K.jsx)(ge,{t:e}),t.map(e=>(0,K.jsx)(fe,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{flex:1},children:[(0,K.jsx)(r.default,{testID:"desk-title",children:(0,K.jsx)(f.T,{size:24,weight:"bold",children:be??''})}),(0,K.jsxs)(f.Muted,{size:12,children:[Y?`Signed in as ${Y.name} \xb7 ${p.ROLE_LABEL[g]}`:`Preview \xb7 ${p.ROLE_LABEL[g]}`," \xb7 ",c.name]})]}),(0,K.jsxs)(r.default,{style:{alignItems:'flex-end'},children:[(0,K.jsx)(f.T,{size:15,weight:"bold",colour:A.colours.gold,children:"Talk to CoverCharge"}),(0,K.jsxs)(f.Muted,{size:12,children:["Hold Space, or ",(0,N.CMD)(),"\u21e7G"]})]}),(0,K.jsx)(v.VoiceSlot,{size:76})]}),(0,K.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[he?(0,K.jsx)(F.Tip,{children:he}):null,'edit'===ee.kind?(0,K.jsx)(J,{id:ee.id,rid:e,me:Q,role:'owner'===g?'owner':'manager',today:_,venue:c.name}):(0,K.jsxs)(n.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===ee.kind&&'home'===ee.tab?(0,K.jsx)(H.Dashboard,{go:ne}):null,'tab'===ee.kind&&'orders'===ee.tab?(0,K.jsx)(I.Orders,{}):null,'tab'===ee.kind&&'bookings'===ee.tab?(0,K.jsx)(R.Bookings,{}):null,'tab'===ee.kind&&'forecast'===ee.tab?(0,K.jsx)(P.Forecasts,{go:ne}):null,'tab'===ee.kind&&'chat'===ee.tab?(0,K.jsx)(M.Chat,{go:ne}):null,ce?(0,K.jsx)(ce.C,{go:ne}):'page'===ee.kind?(0,K.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,K.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==g?(0,K.jsx)(h.PrintHost,{rid:e}):null,'staff'!==g?(0,K.jsx)(b.AlertHost,{variant:"managers",rid:e,me:Q,onOpen:e=>ne('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,K.jsx)(L.AssistantSheet,{}),(0,K.jsx)(B.OnboardingHost,{go:ne}),(0,K.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),s=_r(d[1]),a=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),i=_r(d[6]),l=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]),f=_r(d[12]),g=_r(d[13]),p=_r(d[14]),x=_r(d[15]),m=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),S=_r(d[22]),v=_r(d[23]),T=_r(d[24]),E=_r(d[25]),D=_r(d[26]),A=_r(d[27]),L=_r(d[28]),R=_r(d[29]),M=_r(d[30]),z=_r(d[31]),H=_r(d[32]),P=_r(d[33]),B=_r(d[34]),I=_r(d[35]),O=_r(d[36]);_r(d[37]);var _=_r(d[38]),N=_r(d[39]),W=_r(d[40]),$=_r(d[41]),V=_r(d[42]),F=_r(d[43]),K=_r(d[44]);const G=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Hold Space and say \u201chow many Covers tonight?\u201d for a quick answer without leaving this screen.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first. Say \u201cshow new orders\u201d to jump back any time.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber. Hold Space and say \u201caccept the 7 o\u2019clock\u201d.'},{label:'Forecasts',s:{kind:'tab',tab:'forecast'},tip:'The forecast learns from your past weeks; the more you trade, the better it gets.'},{label:'Staff chat',s:{kind:'tab',tab:'chat'},tip:'Messages here go to staff in the Staff app only, never by text or WhatsApp.'}],U=[{label:'Table plan',s:{kind:'edit',id:'plan'},tip:''},{label:'Menu',s:{kind:'edit',id:'menu'},tip:''},{label:'Rota',s:{kind:'edit',id:'rota'},tip:''},{label:'Branding & Display',s:{kind:'edit',id:'brand'},tip:''}],q={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},X=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),Z=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function J({id:e,rid:t,me:s,role:o,today:n,venue:i}){const l=(0,g.usePlan)(t),[u,b]=(0,a.useState)(0),[h,p]=(0,a.useState)('');return'menu'===e?(0,K.jsx)($.MenuEditor,{rid:t,me:s,role:o}):'rota'===e?(0,K.jsx)(V.RotaEditor,{today:n}):'brand'===e?(0,K.jsx)(_.BrandEditor,{rid:t}):(0,K.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,K.jsxs)(F.Tip,{children:["Drag tables to move them; they snap to the grid and line up with their neighbours (gold lines). Hold Option (Alt) to move freely. \u201cTidy up\u201d lines up a whole area. ",(0,N.CMD)(),"Z undoes, then Save."]}),h?(0,K.jsx)(f.T,{size:13,colour:A.colours.goldLight,children:h}):null,(0,K.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:A.colours.border,borderRadius:12,overflow:'hidden'},children:(0,K.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{g.useFloor.getState().setPlan(t,e),p('Table plan saved. The Display uses it straight away.'),b(e=>e+1)},onCancel:()=>{p('Changes thrown away.'),b(e=>e+1)}},u)})]})}},1464,[798,796,34,402,295,102,36,1290,847,1293,1175,1311,794,1014,865,977,1048,1391,1087,1086,1085,1465,1401,1116,929,1177,2,840,1413,1341,1135,1100,1356,1393,1385,1395,1379,1396,1466,1463,1468,1470,1472,1469,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1465,[815]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandEditor=function({rid:e}){const w=(0,l.useBrand)(e),k=(0,u.useOwner)(t=>t.branding[e]?.recent)??[],[D,B]=(0,t.useState)(w.accent);(0,t.useEffect)(()=>B(w.accent),[w.accent]);const[S,v]=(0,t.useState)(!1),[O,C]=(0,t.useState)(''),P=(0,j.useHistory)(()=>{const t=u.useOwner.getState().branding[e];return t?{...t}:void 0},t=>{u.useOwner.getState().setBranding(e,null),t&&u.useOwner.getState().setBranding(e,t)},'branding'),R=(0,h.checkAccent)(D,x.colours.bg,x.colours.onGold,x.colours.text),T=async t=>{t.preventDefault(),v(!1);const o=(0,b.filesOf)(t)[0];if(o)try{const t=await(0,b.shrinkImage)(o,512,'image/png'===o.type?'image/png':'image/jpeg');P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:t}),C('Logo updated in all apps.')}catch{C('That picture couldn\u2019t be read.')}else C('Drop a picture file (PNG or JPEG).')};return(0,y.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:30},testID:"desk-brand",children:[(0,y.jsx)(f.Tip,{children:"Drop your logo from Finder onto the box, then pick an accent colour. \u2318Z undoes. Display layout settings are further down."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(n.default,{style:{flex:1}}),O?(0,y.jsx)(c.T,{size:13,colour:x.colours.goldLight,children:O}):null,(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"brand-undo"}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"brand-redo"})]}),(0,y.jsxs)(n.default,{style:{flexDirection:'row',gap:16,flexWrap:'wrap'},children:[(0,y.jsxs)(n.default,{style:{width:320,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Logo"}),(0,y.jsxs)("div",{"data-testid":"brand-logo-drop",onDragOver:e=>{(0,b.hasFiles)(e)&&(e.preventDefault(),v(!0))},onDragLeave:()=>v(!1),onDrop:e=>{T(e)},style:(0,f.box)({height:200,borderRadius:14,border:`2px dashed ${S?x.colours.gold:x.colours.accentBorder}`,background:S?x.colours.accentBg:x.colours.surface,display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',gap:10}),children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:96}),(0,y.jsx)("span",{style:(0,f.box)({fontSize:13,color:x.colours.muted}),children:"Drop a logo here (PNG with a clear background is best)"})]}),w.custom&&u.useOwner.getState().branding[e]?.logoUri?(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Use the standard logo",onPress:()=>{P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:void 0})}}):null,(0,y.jsx)(c.T,{weight:"semibold",children:"Preview"}),(0,y.jsxs)(n.default,{style:{backgroundColor:x.colours.bg,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12,gap:8},children:[(0,y.jsxs)(c.Row,{gap:10,children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:44}),(0,y.jsx)(c.T,{weight:"bold",children:w.name})]}),(0,y.jsx)(n.default,{style:{backgroundColor:D,borderRadius:10,padding:10,alignItems:'center'},children:(0,y.jsx)(c.T,{weight:"semibold",colour:R.onAccent,children:"Book a table"})})]})]}),(0,y.jsxs)(n.default,{style:{width:380,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Accent colour"}),(0,y.jsx)(s.ColourPicker,{value:D,onChange:B,onCommit:t=>{t!==w.accent&&(P.record('accent colour'),u.useOwner.getState().setBranding(e,{accent:t,recent:(0,h.pushRecent)(k,t)}),C(`Accent set to ${t}.`))},quick:l.ACCENTS,recent:k}),R.tips.length?(0,y.jsx)(c.Banner,{kind:"warn",children:R.tips.join(' ')}):(0,y.jsx)(c.Muted,{size:12,children:"Easy to read on the dark background."})]})]}),(0,y.jsxs)(n.default,{style:{maxWidth:760,gap:8},children:[(0,y.jsx)(c.T,{size:18,weight:"bold",children:"Display layout"}),(0,y.jsx)(p.DisplaySettingsPage,{})]})]})};var t=r(d[0]),o=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]),p=r(d[8]),x=r(d[9]),b=r(d[10]),j=r(d[11]),f=r(d[12]),y=r(d[13])},1466,[34,295,102,1422,847,794,865,799,1380,840,1467,1468,1469,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dragData",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"readDrag",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"filesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"hasFiles",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"readDataUrl",{enumerable:!0,get:function(){return i}}),_e.shrinkImage=async function(e,t=1024,r="image/jpeg"){const n=await i(e),o=await new Promise((e,t)=>{const r=new Image;r.onload=()=>e(r),r.onerror=t,r.src=n}),s=Math.min(1,t/Math.max(o.width,o.height)),c=document.createElement('canvas');return c.width=Math.round(o.width*s),c.height=Math.round(o.height*s),c.getContext('2d').drawImage(o,0,0,c.width,c.height),c.toDataURL(r,.82)};const e=(e,t,r)=>{try{e.dataTransfer.setData('text/plain',`${t}:${r}`),e.dataTransfer.effectAllowed='copyMove'}catch{}},t=e=>{const t=e.dataTransfer?.getData('text/plain')??'',r=t.indexOf(':');return r>0?{kind:t.slice(0,r),id:t.slice(r+1)}:null},r=e=>Array.from(e.dataTransfer?.files??[]).filter(e=>/^image\//.test(e.type)),n=e=>Array.from(e.dataTransfer?.types??[]).includes('Files'),i=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error),n.readAsDataURL(e)})},1467,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"activeUndo",{enumerable:!0,get:function(){return u}}),e.useHistory=function(u,c,s="change",l=60){const o=(0,t.useRef)([]),f=(0,t.useRef)([]),[,h]=(0,t.useState)(0),[v,b]=(0,t.useState)(''),w=(0,t.useRef)(u);w.current=u;const R=(0,t.useRef)(c);R.current=c;const p=(0,t.useCallback)((t=s)=>{o.current=[...o.current,{v:w.current(),what:t}].slice(-l),f.current=[],b(t),h(t=>t+1)},[s,l]),_=(0,t.useCallback)(()=>{const t=o.current.pop();t&&(f.current.unshift({v:w.current(),what:t.what}),R.current(t.v),b(`Undid: ${t.what}`),h(t=>t+1))},[]),k=(0,t.useCallback)(()=>{const t=f.current.shift();t&&(o.current.push({v:w.current(),what:t.what}),R.current(t.v),b(`Redid: ${t.what}`),h(t=>t+1))},[]),y={undo:_,redo:k,canUndo:o.current.length>0,canRedo:f.current.length>0,label:s,record:p,last:v};return(0,t.useEffect)(()=>(n=y,()=>{n===y&&(n=null)})),y};var t=r(d[0]);let n=null;const u=()=>n},1468,[34]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Tip=function({children:e}){return(0,c.jsxs)(t.default,{testID:"desk-tip",style:{flexDirection:'row',gap:8,alignItems:'flex-start',borderWidth:1,borderColor:n.colours.accentBorder,backgroundColor:n.colours.accentBg,borderRadius:10,paddingHorizontal:12,paddingVertical:8},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:n.colours.gold,children:"Tip"}),(0,c.jsx)(l.T,{size:13,colour:n.colours.text,style:{flex:1},children:e})]})},Object.defineProperty(_e,"box",{enumerable:!0,get:function(){return s}}),r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},l=r(d[2]),n=r(d[3]),c=r(d[4]);const s=(e={})=>({fontFamily:'Poppins_400Regular',color:n.colours.text,boxSizing:'border-box',...e})},1469,[34,102,794,840,25]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuEditor=function({rid:e,me:o,role:s}){const a=(0,d.useAllMenu)(e),c=(0,l.useStore)(o=>o.restaurants.find(o=>o.id===e)),[u,h]=(0,t.useState)('dishes'),[D,O]=(0,t.useState)(null),[k,w]=(0,t.useState)(null),[C,I]=(0,t.useState)(''),z=(0,t.useMemo)(()=>{const e=[...c?.sections??[]];return a.forEach(o=>{e.includes(o.section)||e.push(o.section)}),e},[c?.sections,a]),M=a.filter(e=>!e.hidden||e.recipeCardId),P=e=>(0,p.hasRecipeCards)()?(0,p.recipeCards)().byMenuItem(e):void 0,T={name:o,role:s},R=(0,b.useHistory)(()=>({sections:[...z],items:Object.fromEntries(l.useStore.getState().menu.filter(o=>o.restaurantId===e).map(e=>{const o=a.find(o=>o.id===e.id)??e;return[e.id,{section:o.section,sort:e.sort,price:o.price,allergens:{...o.allergens},soldOut:e.soldOut,photo:P(e.id)?.photo}]}))}),o=>{const t=l.useStore.getState();c&&o.sections.join('|')!==(c.sections??[]).join('|')&&t.updateRestaurant(e,{sections:o.sections});for(const[e,s]of Object.entries(o.items)){const o=a.find(o=>o.id===e),n=t.menu.find(o=>o.id===e);if(!o||!n)continue;const r={};o.section!==s.section&&(r.section=s.section),n.sort!==s.sort&&(r.sort=s.sort),o.price!==s.price&&(r.price=s.price),JSON.stringify(o.allergens)!==JSON.stringify(s.allergens)&&(r.allergens=s.allergens),n.soldOut!==s.soldOut&&(r.soldOut=s.soldOut),Object.keys(r).length&&t.updateMenuItem(e,r);const d=P(e);d&&d.photo!==s.photo&&(0,p.recipeCards)().update(d.id,{photo:s.photo},T)}},'menu change'),B=(e,o,t)=>{const s=a.find(o=>o.id===e);if(!s)return;R.record(`moved ${s.name}`);const n=l.useStore.getState(),r=a.map(t=>t.id===e?{...t,section:o}:t);s.section!==o&&n.updateMenuItem(e,{section:o}),(0,y.reorder)(r,e,o,t).forEach(e=>n.updateMenuItem(e.id,{sort:e.sort})),I(`${s.name} moved${s.section!==o?` to ${o}`:''}.`)},F=async(o,t)=>{const s=P(o),n=a.find(e=>e.id===o);if(s&&n)try{const o=await(0,f.shrinkImage)(t,1024);R.record(`photo for ${n.name}`);const r=await(0,p.recipeCards)().savePhoto(e,s.id,{dataUrl:o,width:0,height:0,bytes:Math.round(.75*o.length)});await(0,p.recipeCards)().update(s.id,{photo:r},T),I(`Photo added to ${n.name}. The dish needs the Head Chef\u2019s sign-off again.`)}catch{I('That picture couldn\u2019t be read. Try a JPEG or PNG.')}else I('This dish has no recipe card yet, so it can\u2019t hold a photo.')},_=a.find(e=>e.id===D),E=({m:e})=>{const o=P(e.id),t=o?.photo&&(0,p.hasRecipeCards)()?(0,p.recipeCards)().photoSource(o.photo):null,s=t?.uri,n=D===e.id,r=k===`d:${e.id}`;return(0,S.jsxs)("div",{"data-testid":`menu-dish-${e.id}`,draggable:!0,onDragStart:o=>(0,f.dragData)(o,'dish',e.id),onClick:()=>O(e.id),onDragOver:o=>{o.preventDefault(),w(`d:${e.id}`)},onDragLeave:()=>w(null),onDrop:o=>{o.preventDefault(),o.stopPropagation(),w(null);const t=(0,f.filesOf)(o)[0];if(t)return void F(e.id,t);const s=(0,f.readDrag)(o);'dish'===s?.kind&&s.id!==e.id&&B(s.id,e.section,e.id)},style:(0,j.box)({display:'flex',alignItems:'center',gap:10,padding:'8px 10px',borderRadius:10,cursor:'grab',userSelect:'none',marginBottom:6,background:n?x.colours.goldTint:x.colours.tile,border:`1px solid ${r?x.colours.gold:n?x.colours.accentBorder:x.colours.hairline}`,borderTop:r?`3px solid ${x.colours.gold}`:void 0}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted,fontSize:16}),children:"\u283f"}),(0,S.jsx)("div",{style:(0,j.box)({width:40,height:40,borderRadius:8,background:x.colours.surface2,backgroundImage:s?`url(${s})`:void 0,backgroundSize:'cover',backgroundPosition:'center',flexShrink:0,display:'flex',alignItems:'center',justifyContent:'center',fontSize:10,color:x.colours.muted}),children:s?'':'photo'}),(0,S.jsxs)("div",{style:(0,j.box)({flex:1,minWidth:0}),children:[(0,S.jsx)("div",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',fontSize:14,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',textDecoration:e.soldOut?'line-through':void 0}),children:e.name}),(0,S.jsxs)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[Object.keys(e.allergens).length?Object.keys(e.allergens).length+' allergens':'No allergens',e.hidden?' \xb7 hidden':'']})]}),e.soldOut?(0,S.jsx)("span",{style:(0,j.box)({fontSize:11,color:x.colours.amber,border:`1px solid ${x.colours.amber}`,borderRadius:6,padding:'1px 6px'}),children:"Sold out"}):null,(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',color:x.colours.gold,fontSize:14}),children:v(e.price)})]})};return(0,S.jsxs)(n.default,{style:{flex:1,gap:10},testID:"desk-menu",children:[(0,S.jsx)(j.Tip,{children:"Drag a dish (\u283f) to put it in order or onto another section. Drag a section name to move the whole section. Drop a photo from Finder onto a dish. \u2318Z undoes."}),(0,S.jsxs)(r.Row,{gap:8,children:[(0,S.jsx)(r.Chip,{label:"Dishes",selected:'dishes'===u,onPress:()=>h('dishes'),testID:"menu-tab-dishes"}),(0,S.jsx)(r.Chip,{label:"Sold out & counts",selected:'soldout'===u,onPress:()=>h('soldout'),testID:"menu-tab-soldout"}),(0,S.jsx)(n.default,{style:{flex:1}}),C?(0,S.jsx)(r.T,{size:13,colour:x.colours.goldLight,children:C}):null,(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!R.canUndo,onPress:R.undo,testID:"menu-undo"}),(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!R.canRedo,onPress:R.redo,testID:"menu-redo"})]}),'soldout'===u?(0,S.jsx)(n.default,{style:{maxWidth:760},children:(0,S.jsx)(m.SoldOutList,{rid:e,by:o})}):(0,S.jsxs)(n.default,{style:{flex:1,flexDirection:'row',gap:14,minHeight:0},children:[(0,S.jsx)("div",{style:(0,j.box)({flex:1,overflowY:'auto',paddingRight:6}),"data-testid":"menu-sections",children:z.map(o=>{const t=M.filter(e=>e.section===o),s=k===`s:${o}`;return(0,S.jsxs)("div",{style:(0,j.box)({marginBottom:14}),onDragOver:e=>{e.preventDefault(),w(`s:${o}`)},onDragLeave:()=>w(null),onDrop:t=>{t.preventDefault(),w(null);const s=(0,f.readDrag)(t);var n,r;'dish'===s?.kind&&B(s.id,o,null),'section'===s?.kind&&s.id!==o&&(n=s.id,r=o,c&&(R.record(`moved section ${n}`),l.useStore.getState().updateRestaurant(e,{sections:(0,y.moveSection)(z,n,r)}),I(`${n} moved.`)))},children:[(0,S.jsxs)("div",{draggable:!0,onDragStart:e=>(0,f.dragData)(e,'section',o),"data-testid":`menu-section-${o}`,style:(0,j.box)({display:'flex',alignItems:'center',gap:8,padding:'6px 4px',cursor:'grab',borderBottom:`${s?2:1}px solid ${s?x.colours.gold:x.colours.border}`,marginBottom:8}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted}),children:"\u283f"}),(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_700Bold',fontSize:16,color:x.colours.goldMuted,letterSpacing:.5,textTransform:'uppercase'}),children:o}),(0,S.jsxs)("span",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[t.length," dishes"]})]}),t.map(e=>(0,S.jsx)(E,{m:e},e.id)),t.length?null:(0,S.jsx)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted,padding:8,border:`1px dashed ${x.colours.border}`,borderRadius:8}),children:"Drop a dish here"})]},o)})}),(0,S.jsx)(n.default,{style:{width:340,gap:10},testID:"menu-inspector",children:_?(0,S.jsx)($,{rid:e,m:_,me:o,record:R.record,onPhoto:e=>{F(_.id,e)}},_.id):(0,S.jsx)(r.Muted,{children:"Click a dish to change its price, allergens and sold-out state."})})]})]})};var e,o=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),n=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),m=_r(_d[11]),x=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),S=_r(_d[17]);const v=e=>null==e?'Board':`\xa3${(e/100).toFixed(2)}`,D={none:'contains',contains:'may',may:void 0};function $({rid:e,m:s,me:d,record:p,onPhoto:m}){const[b,y]=(0,t.useState)(null==s.price?'':(s.price/100).toFixed(2)),v=(e,o)=>{p(o),l.useStore.getState().updateMenuItem(s.id,e)},$=(0,c.dishUsesFor)(e).find(e=>e.id===s.id),O=(0,c.itemsFor)(e),k=()=>{const e=b.trim(),o=''===e?null:Number(e.replace('\xa3',''));if(null!==o&&(!isFinite(o)||o<0))return void y(null==s.price?'':(s.price/100).toFixed(2));const t=null==o?null:Math.round(100*o);t!==s.price&&v({price:t},`price of ${s.name}`)},w=e=>{const o=s.allergens[e]??'none',t=D[o],n={...s.allergens};t?n[e]=t:delete n[e],v({allergens:n},`allergens on ${s.name}`)};return(0,S.jsxs)(n.default,{style:{gap:10,backgroundColor:x.colours.surface,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12},children:[(0,S.jsx)(r.T,{size:17,weight:"bold",children:s.name}),(0,S.jsxs)(r.Muted,{size:12,children:[s.section,s.signOff?` \xb7 signed off by ${s.signOff.by}`:' \xb7 awaiting Head Chef sign-off']}),(0,S.jsx)("div",{onDragOver:e=>{(0,f.hasFiles)(e)&&e.preventDefault()},onDrop:e=>{e.preventDefault();const o=(0,f.filesOf)(e)[0];o&&m(o)},"data-testid":"menu-photo-drop",style:(0,j.box)({border:`1px dashed ${x.colours.accentBorder}`,borderRadius:10,padding:12,textAlign:'center',fontSize:12,color:x.colours.muted}),children:"Drop a photo from Finder here"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Price (\xa3)"}),(0,S.jsx)(o.TextInput,{testID:"menu-price",value:b,onChangeText:y,onBlur:k,onSubmitEditing:k,placeholder:"Blank = on the specials board",placeholderTextColor:x.colours.muted,style:[r.styles.input,{width:160}]})]}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Allergens"}),(0,S.jsx)(r.Muted,{size:12,children:"Click to cycle: contains \u2192 may contain \u2192 none. Changes go to the recipe card and need the Head Chef\u2019s sign-off."}),(0,S.jsx)(r.Row,{gap:6,wrap:!0,children:h.ALLERGENS.map(e=>{const o=s.allergens[e.id];return(0,S.jsx)(r.Chip,{testID:`menu-al-${e.id}`,label:'may'===o?`${e.short} (may)`:e.short,selected:!!o,onPress:()=>w(e.id)},e.id)})})]}),(0,S.jsx)(r.Toggle,{label:"Sold out now",value:s.soldOut,onChange:e=>{p(`sold out ${s.name}`),(0,a.setSoldOut)(s.id,e,d)},testID:"menu-soldout"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Sold-out link"}),$&&$.uses.length?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r.Muted,{size:12,children:(0,u.usesText)($.uses,O)}),(0,S.jsx)(r.Badge,{kind:"gold",label:"Sells out on its own when the count runs out"})]}):(0,S.jsx)(r.Muted,{size:12,children:"Not linked to a count. Link it in \u201cSold out & counts\u201d."})]})]})}},1470,[796,34,102,794,850,800,977,979,980,830,856,1130,840,1467,1468,1469,1471,25]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1471,[865]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const y=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[$,j]=(0,t.useState)((0,i.mondayOfDate)(e)),[v,k]=(0,t.useState)(null),[w,D]=(0,t.useState)(''),B=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),O=b.map((e,t)=>(0,i.addDays)($,t)),P=(e,t,o)=>{e.preventDefault(),k(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=y.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=$&&e.date<=O[6]),I=T.filter(e=>!e.published||e.changed).length;return(0,p.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,p.jsx)(h.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,p.jsxs)(s.Row,{gap:8,children:[(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>j((0,i.addDays)($,-7))}),(0,p.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date($+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>j((0,i.addDays)($,7))}),(0,p.jsx)(d.default,{style:{flex:1}}),w?(0,p.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:w}):null,(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!B.canUndo,onPress:B.undo,testID:"rota-undo"}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!B.canRedo,onPress:B.redo,testID:"rota-redo"}),(0,p.jsx)(s.Button,{small:!0,label:I?`Publish (${I})`:'Published',disabled:!I,onPress:()=>{B.record('published the week');const e=i.useOwner.getState().publishWeek($);D(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,p.jsx)("div",{style:(0,h.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,p.jsxs)("div",{style:(0,h.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,p.jsx)("div",{style:(0,h.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),O.map((t,o)=>(0,p.jsxs)("div",{style:(0,h.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[b[o]," ",Number(t.slice(8))]},t)),y.map(e=>(0,p.jsxs)(o.default.Fragment,{children:[(0,p.jsxs)("div",{style:(0,h.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,p.jsx)("div",{style:(0,h.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,p.jsx)("div",{style:(0,h.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),O.map(t=>{const o=`${e.id}|${t}`,d=T.filter(o=>o.staffId===e.id&&o.date===t);return(0,p.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',k(o)},onDragLeave:()=>k(null),onDrop:o=>P(o,e.id,t),style:(0,h.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,p.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,h.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,p.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]),f=r(_d[9]),p=r(_d[10]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1472,[34,102,794,865,1103,840,1467,1468,1469,1471,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=R,_e.CarApp=function(){const{width:e,height:d}=(0,l.default)(),{role:h,today:b,now:y}=(0,f.useCtx)(3e4),[w,W]=(0,t.useState)(d),v=(0,D.railSizes)(e,w),$=Math.max(320,e-v.railW-1),[M,P]=(0,t.useState)(null),[A,_]=(0,t.useState)(null),[E,N]=(0,t.useState)(!1),[U,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,f.ensureAttendance)(b,y),(0,u.ensureChat)(y)},[b]),(0,t.useEffect)(()=>{R().then(_)},[]),(0,t.useEffect)(()=>{if(I.PITCH)return;const e=setInterval(()=>{(0,C.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==h&&j.useOwner.getState().setPreviewRole('owner')},[h]);const F=(0,t.useCallback)(()=>P(null),[]);(0,p.useBackLayer)(!!M,F);const Y=e=>P({btn:e,page:e.pages[0].id}),G=(0,t.useCallback)((e,t)=>{const n=e=>D.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return P(null);if('bookings'===e)return P({btn:n('@bookings'),page:'@bookings'});if('chat'===e)return P({btn:n('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return P(t=>({btn:t?.btn??D.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=n(t);return P(n=>({btn:e??n?.btn??D.CAR_BUTTONS[0],page:t}))}P(null)},[]),q=$<1400?$:Math.round(Math.min($,Math.max(960,.72*$))),J=M?M.btn.pages.find(e=>e.id===M.page)?.label??(0,c.pageFor)(M.page)?.title??M.btn.label:'';return(0,B.jsxs)(s.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-w)>1&&W(t)},style:{flex:1,flexDirection:'row',backgroundColor:T.colours.bg,minHeight:0},children:[(0,B.jsxs)(s.default,{testID:"car-board",style:{width:$,minWidth:0,minHeight:0},children:[(0,B.jsx)(a.DisplayBoard,{embedded:!0,noVoice:!0,boardW:$,headerExtra:(0,B.jsx)(S.ParkedOnly,{small:e<1400}),subHeader:(0,B.jsx)(L,{onRota:()=>Y(D.CAR_BUTTONS[0]),onAccount:()=>N(!0)})}),M?(0,B.jsxs)(s.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:q,zIndex:40,backgroundColor:T.colours.bg,borderLeftWidth:1,borderColor:T.colours.gold,boxShadow:'-18px 0 40px rgba(0,0,0,0.55)'},children:[(0,B.jsxs)(s.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,B.jsx)(n.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${J}, back to the board`,onPress:()=>{(0,p.runBackLayer)()||F()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:T.colours.border,alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(x.T,{weight:"semibold",center:!0,children:"Close"})}),(0,B.jsx)(s.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,B.jsx)(x.T,{size:20,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:M.btn.label})}),(0,B.jsx)(s.default,{style:{minWidth:96}})]}),M.btn.pages.length>1?(0,B.jsx)(s.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:M.btn.pages.map(e=>{const t=e.id===M.page;return(0,B.jsx)(n.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>P({btn:M.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?T.colours.gold:T.colours.border,backgroundColor:t?H:'transparent',alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(x.T,{weight:"semibold",colour:t?T.colours.goldLight:T.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,B.jsx)(o.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:'assistant'===M.page&&!1===A?(0,B.jsx)(O,{}):(0,B.jsx)(z,{id:M.page,go:G},M.page)})]}):null]}),(0,B.jsxs)(s.default,{testID:"car-rail",accessibilityRole:"toolbar",accessibilityLabel:"Owner tools",style:{width:v.railW+1,borderLeftWidth:1,borderColor:T.colours.border,backgroundColor:'#0A0A0A',paddingTop:6,paddingBottom:6,alignItems:'stretch',minHeight:0,overflow:'hidden'},children:[(0,B.jsx)(s.default,{style:{height:D.RAIL_TITLE,alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(x.T,{size:11,weight:"semibold",colour:T.colours.goldMuted,center:!0,style:{letterSpacing:1},children:"OWNER"})}),(0,B.jsx)(s.default,{testID:"car-rail-grid",style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'flex-start',minHeight:0},children:D.CAR_BUTTONS.map(e=>{const t=M?.btn.id===e.id;return(0,B.jsxs)(n.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>t?F():Y(e),style:{width:v.colW,height:v.per,alignItems:'center',justifyContent:'center',gap:4,overflow:'hidden'},children:[(0,B.jsx)(s.default,{style:{width:v.circle,height:v.circle,borderRadius:v.circle/2,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:t?T.colours.gold:H,alignItems:'center',justifyContent:'center'},children:(0,B.jsx)(k.CarGlyph,{name:e.icon,size:v.icon,colour:t?'#0B0B0B':T.colours.goldLight})}),(0,B.jsx)(x.T,{size:v.label,weight:t?'semibold':'medium',colour:t?T.colours.goldLight:T.colours.text,center:!0,numberOfLines:1,style:{lineHeight:v.lineH,maxWidth:v.colW-6},children:v.colW<150?e.short:e.label})]},e.id)})})]}),E?(0,B.jsxs)(x.Sheet,{visible:!0,onClose:()=>N(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,B.jsx)(x.T,{center:!0,children:"This car is signed in to The Anchorage as you, with your own rights. Use it only when the car is in Park."}),(0,B.jsx)(x.Muted,{center:!0,children:"To sign it out from your phone: Managers, More, Car screen."}),(0,B.jsx)(x.Button,{testID:"car-sign-out",kind:"secondary",label:"Sign this car out",onPress:()=>{N(!1),V(!0)},style:{minHeight:56}}),(0,B.jsx)(x.Button,{kind:"ghost",label:"Close",onPress:()=>N(!1),style:{minHeight:56}})]}):null,U?(0,B.jsxs)(x.Sheet,{visible:!0,onClose:()=>V(!1),title:"Sign this car out?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,B.jsx)(x.T,{center:!0,children:"You\u2019ll need a new code, approved on your phone, to use it again."}),(0,B.jsx)(x.Button,{testID:"car-sign-out-yes",label:"Yes, sign this car out",onPress:()=>{V(!1),(0,C.carSignOut)()},style:{minHeight:56}}),(0,B.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]);r(_d[1]);var n=e(r(_d[2])),o=e(r(_d[3])),s=e(r(_d[4])),l=e(r(_d[5])),a=r(_d[6]),c=r(_d[7]);r(_d[8]);var d=r(_d[9]),u=r(_d[10]),h=r(_d[11]),b=r(_d[12]),f=r(_d[13]),p=r(_d[14]),x=r(_d[15]),y=r(_d[16]),j=r(_d[17]),w=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),S=r(_d[24]),W=r(_d[25]),v=r(_d[26]),B=r(_d[27]);const H='rgba(201,162,74,0.14)';async function R(){try{const e='undefined'!=typeof navigator?navigator.mediaDevices:null;if(!e?.getUserMedia||!e?.enumerateDevices)return!1;return(await e.enumerateDevices()).some(e=>'audioinput'===e.kind)}catch{return!1}}function L({onRota:e,onAccount:o}){const l=(0,f.useSignedIn)(),a=(0,j.useOwner)(e=>e.attendance),c=(0,j.useOwner)(e=>e.staff),[d,u]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>u(Date.now()),3e4);return()=>clearInterval(e)},[]);const h=a.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(c.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),b=[...new Set(h)],p=b.length?`On now: ${b.join(' \xb7 ')}`:'Nobody clocked in';return(0,B.jsxs)(s.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:T.colours.hairline},children:[(0,B.jsx)(n.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${p}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,B.jsx)(x.T,{size:14,weight:"semibold",colour:T.colours.goldLight,numberOfLines:1,center:!0,children:p})}),l?(0,B.jsx)(n.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:`Signed in as ${l.name}. Car sign-in options.`,onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:T.colours.gold,flexShrink:0},children:(0,B.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,center:!0,numberOfLines:1,children:l.name.replace(' (example)','')})}):null,(0,B.jsx)(W.CarGameButton,{}),(0,B.jsx)(v.CarFullscreenButton,{})]})}function $({go:e}){const{rid:t,now:n}=(0,f.useCtx)(3e4),o=(0,y.useBookings)(t),l=(0,w.ymd)(n),a=(0,w.ymd)(new Date(n.getTime()-24192e5)),c=o.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=l).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),d=o.filter(e=>e.date===l&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,B.jsxs)(s.default,{testID:"car-noshows",style:{gap:10},children:[(0,B.jsx)(x.T,{center:!0,size:18,weight:"semibold",colour:T.colours.goldLight,children:c.length?`${c.length} no-show${1===c.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),d.length?(0,B.jsxs)(s.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:T.colours.amber,borderRadius:12,padding:12},children:[(0,B.jsx)(x.T,{center:!0,weight:"semibold",colour:T.colours.amber,children:"Running more than 15 minutes late"}),d.map(e=>(0,B.jsx)(x.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,B.jsx)(x.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,c.map(e=>(0,B.jsxs)(s.default,{style:{borderWidth:1,borderColor:T.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,B.jsx)(x.T,{center:!0,weight:"semibold",children:`${e.date===l?'Today':(0,w.niceDate)((0,w.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,B.jsx)(x.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,B.jsx)(x.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function O(){return(0,B.jsxs)(s.default,{testID:"car-no-mic",accessibilityLiveRegion:"polite",style:{gap:10,alignItems:'center',paddingVertical:24},children:[(0,B.jsx)(x.T,{center:!0,size:20,weight:"semibold",colour:T.colours.goldLight,children:"The Assistant needs the car\u2019s microphone"}),(0,B.jsx)(x.Muted,{center:!0,style:{maxWidth:520},children:"Sorry, this car\u2019s browser isn\u2019t letting the page use a microphone. For now, please use the Assistant in Managers on your phone."})]})}function z({id:e,go:t}){if('@bookings'===e)return(0,B.jsx)(d.Bookings,{go:t});if('@chat'===e)return(0,B.jsx)(u.Chat,{go:t});if('@noshows'===e)return(0,B.jsx)($,{go:t});if('@orders'===e)return(0,B.jsx)(h.Orders,{});if('@forecast'===e)return(0,B.jsx)(b.Forecasts,{go:t});const n=(0,c.pageFor)(e);if(!n)return(0,B.jsx)(x.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const o=n.C;return(0,B.jsx)(o,{go:t})}},1473,[34,236,402,295,102,426,1279,1379,1396,1341,1135,1395,1393,1100,1041,794,848,865,827,985,2,840,1474,1475,1476,1477,1478,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"RAIL_TITLE",{enumerable:!0,get:function(){return o}}),e.railSizes=function(s,l){const t=l>=1e3?13:11,n=Math.round(1.45*t),c=48+n+8,b=Math.floor((l-o-12)/12)>=c?1:2,h=12/b,p=Math.floor((l-o-12)/h),u=1===b?s>=1600?168:s>=1200?136:120:s>=1600?128:s>=1100?100:88,f=Math.max(44,Math.min(1===b?72:64,p-n-12,u-24));return{railW:u*b,colW:u,cols:b,per:p,circle:f,label:t,lineH:n,icon:Math.round(.46*f)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return l}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}],o=32;const l=s=>s.split('').join(' ')},1474,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGlyph=function({name:e,size:x,colour:n}){const c={stroke:n,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'},l={rota:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h3M14 14h3M7 17h3",...c})]}),signoff:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...c}),(0,h.jsx)(s.Path,{d:"M12 7v5l3 2",...c}),(0,h.jsx)(s.Path,{d:"M15.5 18.5l1.8 1.8 3.4-3.6",...c})]}),menu:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M6 3v8a2 2 0 0 0 2 2v8M10 3v8a2 2 0 0 1-2 2M8 3v6",...c}),(0,h.jsx)(s.Path,{d:"M16 21V3c2.5 1.5 3 5 3 8h-3",...c})]}),bookings:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...c}),(0,h.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...c})]}),noshow:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...c}),(0,h.jsx)(s.Path,{d:"M3 21c0-4 3-6 7-6s7 2 7 6M17 9l4 4M21 9l-4 4",...c})]}),chat:(0,h.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...c}),stock:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M3 7l9-4 9 4-9 4z",...c}),(0,h.jsx)(s.Path,{d:"M3 7v10l9 4 9-4V7M12 11v10",...c})]}),loyalty:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"2",...c}),(0,h.jsx)(s.Circle,{cx:"8",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.5",...c}),(0,h.jsx)(s.Circle,{cx:"16",cy:"12",r:"1.5",...c})]}),takings:(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...c})}),safety:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Path,{d:"M10 14V5a2 2 0 0 1 4 0v9a4 4 0 1 1-4 0z",...c}),(0,h.jsx)(s.Path,{d:"M12 9v7",...c})]}),reviews:(0,h.jsx)(s.Path,{d:"M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z",...c}),assistant:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",...c}),(0,h.jsx)(s.Path,{d:"M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6",...c})]})};return(0,h.jsx)(t.default,{width:x,height:x,viewBox:"0 0 24 24",children:l[e]})},_e.GameGlyph=function({size:e,colour:x}){const n={stroke:x,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,h.jsxs)(t.default,{width:e,height:e,viewBox:"0 0 24 24",children:[(0,h.jsx)(s.Path,{d:"M7 8h10a4 4 0 0 1 4 4v3a3 3 0 0 1-5.4 1.8L14.5 15h-5l-1.1 1.8A3 3 0 0 1 3 15v-3a4 4 0 0 1 4-4z",...n}),(0,h.jsx)(s.Path,{d:"M7 11v3M5.5 12.5h3",...n}),(0,h.jsx)(s.Circle,{cx:"16",cy:"11.5",r:"0.9",...n}),(0,h.jsx)(s.Circle,{cx:"18",cy:"13.5",r:"0.9",...n})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},h=r(d[2])},1475,[34,900,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1476,[34,102,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGameButton=function(){const e=(0,u.useStore)(e=>!1!==e.restaurants.find(e=>e.id===f.VENUE_RID)?.settings?.games),s=(0,c.useSession)(e=>e.meId),j=(0,b.useSignedIn)(),[C,S]=(0,n.useState)(!1),[k]=(0,n.useState)(()=>new Date),x=(0,o.useGameClock)(s,C?new Date:k);return e?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(t.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>S(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:y.colours.gold,flexShrink:0},children:(0,_.jsx)(h.T,{size:13,weight:"semibold",colour:y.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),C?(0,_.jsx)(o.BreakRoom,{car:!0,staffId:s??null,name:j?.name??'Owner',playable:(0,l.gamePlayable)(x),clock:x,onClose:()=>S(!1)}):null]}):null};var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8]),y=r(d[9]),_=r(d[10])},1477,[34,402,1137,1138,800,997,1100,5,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FS_KEY",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"THEATRE_KEY",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EASY_LINK",{enumerable:!0,get:function(){return b}}),_e.theatreUrl=p,_e.inTheatre=v,_e.CarFullscreenButton=function(){const[t,n]=(0,e.useState)(y),[f,T]=(0,e.useState)(!1),[x]=(0,e.useState)(v);(0,e.useEffect)(()=>{if(!u)return;const e=()=>{const e=y();n(e),e||w.set(h,null)};document.addEventListener('fullscreenchange',e),document.addEventListener('webkitfullscreenchange',e);let t='1'===w.get(h)&&!y();const c=()=>{t&&(t=!1,E())};return t&&(document.addEventListener('click',c,!0),document.addEventListener('touchend',c,!0)),()=>{document.removeEventListener('fullscreenchange',e),document.removeEventListener('webkitfullscreenchange',e),document.removeEventListener('click',c,!0),document.removeEventListener('touchend',c,!0)}},[]);const k=(0,e.useCallback)(async()=>{if(y()){w.set(h,null);try{await((document.exitFullscreen??document.webkitExitFullscreen)?.call(document))}catch{}return}const e=window.innerHeight;await E()?(w.set(h,'1'),setTimeout(()=>{(!y()||window.innerHeight<=e+8)&&T(!0)},900)):T(!0)},[]);return!u||x?null:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(c.default,{testID:"car-fullscreen",accessibilityRole:"button",accessibilityLabel:t?'Exit full screen':'Full screen: hide the browser bar',onPress:()=>{k()},style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:l.colours.gold,backgroundColor:t?'rgba(201,162,74,0.14)':'transparent',flexShrink:0},children:(0,o.jsx)(s.T,{size:13,weight:"semibold",colour:l.colours.gold,center:!0,numberOfLines:1,children:t?'Exit full screen':'Full screen'})}),f?(0,o.jsxs)(s.Sheet,{visible:!0,onClose:()=>T(!1),title:"Full screen in the car",maxWidth:600,testID:"car-fullscreen-help",children:[(0,o.jsx)(s.T,{center:!0,children:"The car\u2019s browser keeps its bar at the top. The car\u2019s own full-screen view has no bar at all."}),(0,o.jsx)(s.T,{center:!0,children:"Tap Open full screen. A YouTube page says you\u2019re leaving YouTube: tap the link on it. The car screen then opens with no bar."}),(0,o.jsx)(s.Muted,{center:!0,children:"The first time only, sign the car in again with a new code from your phone: the full-screen view keeps its own sign-in. The Assistant\u2019s microphone doesn\u2019t work there. To leave, tap the car\u2019s \u2715 in the top corner."}),(0,o.jsx)(s.Muted,{center:!0,children:`Easy link to save as a favourite: ${b}`}),(0,o.jsx)(s.Button,{testID:"car-fullscreen-theatre",label:"Open full screen",onPress:()=>{location.href=p(location.origin)},style:{minHeight:56}}),(0,o.jsx)(s.Button,{kind:"secondary",label:"Not now",onPress:()=>T(!1),style:{minHeight:56}})]}):null]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},s=r(d[3]),l=r(d[4]),o=r(d[5]);const u='undefined'!=typeof document,h='cc-car-fullscreen',f='cc-car-theatre',b='covercharge-apps.static.hf.space/car?full';function p(e){return`https://www.youtube.com/redirect?q=${encodeURIComponent(`${e}/car-app/index.html?theatre=1`)}`}const w={get:e=>{try{return localStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{null==t?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}};function v(){if(!u)return!1;try{return/[?&]theatre=1\b/.test(location.search)&&w.set(f,'1'),/TESLA_AUTO/i.test(navigator.userAgent)||'1'===w.get(f)}catch{return!1}}const y=()=>u&&!(!document.fullscreenElement&&!document.webkitFullscreenElement);async function E(){const e=document.documentElement,t=e.requestFullscreen??e.webkitRequestFullscreen;if(!t)return!1;try{return await t.call(e,{navigationUI:'hide'}),!0}catch{return!1}}},1478,[34,236,402,794,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1479,[30,34,846,1480,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1480,[1380,1481,798,991,1073,1430,1161,1040,1041,1431,1454,1433,1130,977,1042,2,1047,1048,1407,993,34,1132,1186,1190,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1341,1070,1085,1086,1082,1043,1025,1100,1425,1420,1439,1482,1349,997,236,1192,1145,1151,1378,1155,1154,1392,1148,15,1162,1163,899,793,985,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1481,[34,102,794,1100,985,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1482,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); +__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]})}},1483,[30,34,846,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1484,[1374,985,795,1335,1485,1011,30,1512,496,34,385,336,236,41,102,5,847,846,1514,36,848,1014,865,840,1349,997,1010,1515,1516,1517,1518,1099,2,1024,1520,1304,25,1521,1522,1523,1524]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1485,[1486,1509,1511]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1486,[215,1487,1490,1504,1505,1506,1507,1508]); +__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1487,[215,1488]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1488,[1489]); +__d(function(g,r,i,a,m,e,d){},1489,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1490,[1491,215,1487,1504,1505]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1491,[1492,1493,1503]); +__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1492,[1493,1497,1502]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1493,[215,372,1494,1498,1499,1500,1501,1497,1502]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1494,[215,1495,339,280,1496,1497]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1495,[504]); +__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1496,[215,339]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1497,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1498,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1499,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1500,[1498]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1501,[]); +__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1502,[372,1496]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1503,[34,1493]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1504,[1491,215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1505,[1491,1504]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1506,[1487]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1507,[215,1487,1490,1488]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1508,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1509,[215,54,1510]); +__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1510,[215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1511,[34,1486]); +__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]}})})},1512,[1513]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1513,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1514,[34,41,102,426,794,847,997,985,2,5,840,1474,1476,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1515,[986,857,856,985]); +__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1516,[798,796,34,1381,1015,402,102,846,985,1007,1014,5,840,794,1287,974,2,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1517,[796,34,236,402,102,840,985,1045,2,25]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1518,[5,796,34,385,283,364,380,236,402,295,426,102,1413,1116,2,900,1100,15,865,794,840,1444,930,1519,1442,1443,1401,1117,1411,929,1465,1452,25,277]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1519,[865,800,1014]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=u(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),k=[],A=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);if(i.includes(c))continue;k.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0});const u='st-jack'===t?{auto:'rota'}:{};d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:f(d,23.5)}:void 0,...u}):d===y&&e<=m&&A.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:f(d,u.auto?e:e-.05),inSite:!0,...u})}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!k.some(e=>e.staffId===t.staffId&&e.date===t.date)),...k],attendance:[...S.attendance,...A]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:f(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:f((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,f=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1520,[848,800,865,1024,15,997,846]); +__d(function(e,o,s,p,t,n,a){"use strict";t.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1521,[]); +__d(function(o,e,s,p,t,c,d){"use strict";t.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1522,[]); +__d(function(o,e,s,p,t,d,f){"use strict";t.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1523,[]); +__d(function(o,s,e,p,d,t,n){"use strict";d.exports="/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1524,[]); +__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]})}},1525,[30,34,846,25]); +__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1526,[1527]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1527,[25,1528,591]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1528,[34,172]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1529,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1530,[25,499,34,270,651]); __r(501); __r(21); __r(0); \ No newline at end of file diff --git a/owner-app/admin.html b/owner-app/admin.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/admin.html +++ b/owner-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer.html b/owner-app/customer.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer.html +++ b/owner-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage.html b/owner-app/customer/anchorage.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage.html +++ b/owner-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/book.html b/owner-app/customer/anchorage/book.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/book.html +++ b/owner-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/feedback.html b/owner-app/customer/anchorage/feedback.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/feedback.html +++ b/owner-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/gift.html b/owner-app/customer/anchorage/gift.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/gift.html +++ b/owner-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/lost.html b/owner-app/customer/anchorage/lost.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/lost.html +++ b/owner-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/loyalty.html b/owner-app/customer/anchorage/loyalty.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/loyalty.html +++ b/owner-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/merch.html b/owner-app/customer/anchorage/merch.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/merch.html +++ b/owner-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/offers.html b/owner-app/customer/anchorage/offers.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/offers.html +++ b/owner-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/refer.html b/owner-app/customer/anchorage/refer.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/refer.html +++ b/owner-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/waitlist.html b/owner-app/customer/anchorage/waitlist.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/waitlist.html +++ b/owner-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/anchorage/whatson.html b/owner-app/customer/anchorage/whatson.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/anchorage/whatson.html +++ b/owner-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/basket.html b/owner-app/customer/basket.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/basket.html +++ b/owner-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/customer/profile.html b/owner-app/customer/profile.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/customer/profile.html +++ b/owner-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/demo.html b/owner-app/demo.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/demo.html +++ b/owner-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/display.html b/owner-app/display.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/display.html +++ b/owner-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/index.html b/owner-app/index.html index a7ade7c217e6028f6704a6e6d52b9f085220865d..6c5e9d250d78391b8a5aac34d7863313ab864b68 100644 --- a/owner-app/index.html +++ b/owner-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/kitchen.html b/owner-app/kitchen.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/kitchen.html +++ b/owner-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/owner.html b/owner-app/owner.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/owner.html +++ b/owner-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/staff.html b/owner-app/staff.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/staff.html +++ b/owner-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-app/sw.js b/owner-app/sw.js index ef8ea9c6dae54e274ffd2b6495cf6975bb84817c..2f02a9a47b539e53913ccf0969ce2760d9cf583b 100644 --- a/owner-app/sw.js +++ b/owner-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Manager service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-owner-2c3839e45d"; +const V = "cc-owner-52b2df90a8"; const BASE = "/owner-app/"; -const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=2c3839e45d0ed04885cc956cf3d93120fb911bbe5f63df4591621f0543f07615"]; +const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=52b2df90a81b86ae4c9de2959a8b626d69f92d17b8823906aeeeba3fb99a96d6"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/owner-app/team.html b/owner-app/team.html index 06b00b0d94da03c677f74ff0ae0bc0e6b663d0d9..a106423e168fd2cad08e9a4f157130d8ee844a07 100644 --- a/owner-app/team.html +++ b/owner-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/_expo/static/js/web/bundle.js b/staff-app/_expo/static/js/web/bundle.js index 24a4f10b7df7b44e3f88d45fac7b923dc7186ab5..0dd023a7f31fad6bde236ebd4f272e4d297b8b6d 100644 --- a/staff-app/_expo/static/js/web/bundle.js +++ b/staff-app/_expo/static/js/web/bundle.js @@ -23,11 +23,11 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_VENUE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PITCH_TEAM",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_TEXT",{enumerable:!0,get:function(){return o}}),e.pitchText=function(a){let n=a;for(const[a,t]of o)a.test(n)?(a.lastIndex=0,n=n.replace(a,t)):a.lastIndex=0;return n};const a={name:'The Harbour Kitchen',tagline:'Harbourside seafood & seasonal plates',location:'12 Quay Street, Portmorran',phone:'01632 960 123',website:'harbourkitchen.example'},n={'st-tracy':{name:'Morgan',job:'Owner',hourlyPence:null,salaried:!0},'st-gordon':{name:'Alex',job:'General Manager',dept:'Management',hourlyPence:null,salaried:!0},'st-bisto':{name:'Ravi',job:'Head Chef',hourlyPence:null,salaried:!0},'st-agate':{name:'Priya',job:'Front of house supervisor',hourlyPence:1450},'st-lenny':{name:'Tom',job:'Commis Chef',hourlyPence:1325},'st-finn':{name:'Lewis',job:'Bar staff',hourlyPence:1290},'st-eilidh':{name:'Chloe',job:'Front of house',hourlyPence:1271},'st-emily':{name:'Ellie',job:'Front of house',hourlyPence:1271},'st-lillie':{name:'Jordan',job:'Kitchen porter (KP)',hourlyPence:1271},'st-jack':{name:'Sam',job:'Kitchen porter (KP)',hourlyPence:1271}},o=[['Harbour View, Dunure, South Ayrshire',a.location],['Harbour View, Dunure',a.location],['Harbour View mug','Harbour Kitchen mug'],['Harbour View','Quay Street'],['anchoragedunure.com',a.website],['01292 502826',a.phone],['Mini Anchors','Little Crew'],['The Anchorage',a.name],['Anchorage','Harbour Kitchen'],['ANCHORAGE','HARBOUR KITCHEN'],['South Ayrshire','the Firth coast'],['Ayrshire','the Firth coast'],['Dunure','Portmorran'],['Kittyfisher boat (Big Sean)','Coastal Fish Co'],['Kittyfisher','Coastal Fish Co'],['Big Sean','Coastal Fish Co'],['Example Fish Co.','Coastal Fish Co'],['Sample Dairy Ltd','Hillside Dairy'],['Sample Fruit & Veg','Fieldfare Veg'],['Mills milk','Hillside Dairy milk'],['Mills','Hillside Dairy'],['J. Pieroni & Sons','Fieldfare Veg'],["Pieroni's",'Fieldfare Veg'],['Pieroni','Fieldfare Veg'],['Alsons (drinks)','Drinks wholesaler'],['Alsons','the drinks wholesaler'],['Spes Bona','the deli wholesaler'],['Tarelgin','the butcher'],['Reids','the bakery'],['Reeds','the bakery'],['Example Butchers Ltd','Quayside Butchers'],['Example Dry Goods Wholesale','Dry goods wholesaler'],['Sample Brewing Co.','Harbourside Brewing'],['Example Cleaning Supplies','Cleaning supplies'],['Sample Packaging Ltd','Packaging supplier'],['Example Kitchen Repairs','Kitchen repairs'],['Preston','Ravi'],['Bisto','Ravi'],['Tracy','Morgan'],['James','Morgan'],['Gordon','Alex'],['Agate','Priya'],['Lenny','Tom'],['Finn','Lewis'],['Eilidh','Chloe'],['Emily','Ellie'],['Gabrielle','Ellie'],['Cameron Mc','Sam'],['Cameron','Sam'],['Lillie','Jordan'],['Lily','Jordan'],['Mia','Jordan'],['Jack','Sam'],['Harvey','Jordan'],['Anna','the supplier'],['(preview)',''],[' (example)','']].map(([a,n])=>[new RegExp(`${/^[A-Za-z]/.test(a)?'(?g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`](_),globalThis.__webpack_require__=o=>{const t=ErrorUtils.reportFatalError;_&&(ErrorUtils.reportFatalError=_=>{throw _});try{return g[`${__METRO_GLOBAL_PREFIX__}__r`](o)}finally{_&&(ErrorUtils.reportFatalError=t)}}},23,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1446,1449]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},24,[25,27,34,709,1447,1450]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},25,[26]); __d(function(g,r,i,a,m,e,d){ /** @@ -41,7 +41,7 @@ __d(function(g,r,i,a,m,e,d){ */ "use strict";var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(t,o,f){var l=null;if(void 0!==f&&(l=""+f),void 0!==o.key&&(l=""+o.key),"key"in o)for(var y in f={},o)"key"!==y&&(f[y]=o[y]);else f=o;return o=f.ref,{$$typeof:n,type:t,key:l,ref:void 0!==o?o:null,props:f}}e.Fragment=t,e.jsx=o,e.jsxs=o},26,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ctx",{enumerable:!0,get:function(){return t}});const t=r(d[0])},27,[28]); -__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1188,1189,1191,1195,1197,1204,1260,1261,1262,1263,1264,1265,1267,1268,1269,1270,1271,1272,1273,1274,1277,1335,1336,1337,1339,1381,1382,1445]); +__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},28,[29,1038,1189,1190,1192,1196,1198,1205,1261,1262,1263,1264,1265,1266,1268,1269,1270,1271,1272,1273,1274,1275,1278,1336,1337,1338,1340,1382,1383,1446]); __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]})}},29,[30,34,792,846,988,25]); __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)},30,[31,32,782,783,785]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},31,[]); @@ -872,7 +872,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},789,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},790,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},791,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1159,1160,899,997,1161,1133,1162,1169,1170,1179,1172,1132,1181,1185,1156,848,1186,1130,985,1187,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:L}=(0,W.useChef)(3e4);(0,he.useReviewAlerts)(i);const _=(0,M.useSignedIn)(),K=_?.id??W.CHEF_ID,V=_?.ownerAccess&&'owner'!==_.role?'owner privileges':_?.managerAccess&&'staff'===_.role?'manager privileges':'';(0,o.useSoldOutLink)(!0,(_?.name??n).replace(' (example)',''));const ge=e?we[e]:void 0,[be,Ce]=(0,P.useState)(ge?.tab??'home'),[Se,Te]=(0,P.useState)(ge?.k??null),[Pe,Ie]=(0,P.useState)(ge?.stock??'levels'),[Re,Ae]=(0,P.useState)(void 0),[Be,He]=(0,P.useState)(ge?.gp??'dishes'),De=(0,P.useRef)(null),Oe=(0,b.ymd)(L),$e=(0,b.ymd)(new Date(L.getTime()+864e5));(0,p.useTipsPosted)(i,Oe);const Ee=(0,Q.useTravelDay)('chef',Oe),Le='home'===be&&!Ee;(0,S.useKitchenTodoChime)(i,Oe,()=>Ge('kitchen','bookings')),(0,de.useAlertWatcher)(i,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,M.ensureAttendance)((new Date).toISOString().slice(0,10),L)},[]);const Fe=(0,P.useRef)({t:'home',k:null});Fe.current={t:be,k:Se};const Me=(0,P.useRef)([]),We=(0,r.useScrollMemory)(De),Ge=(0,P.useCallback)((e,t=null)=>{const s=Fe.current;s.t===e&&s.k===t||(Me.current=[...Me.current,{...s,y:We.leave()}].slice(-30),We.restore(0)),Ce(e),Te(t)},[]),Ne=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Fe.current;let t=Me.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Me.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return We.leave(),Ce(s.t),Te(s.k),We.restore(s.y??0),!0},[]);(0,l.useWebBack)(Ne);const ze=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ie(s),'gp'===e&&s&&He(s),Ge(e,t)})},[Ge]),(0,f.useShiftReminders)({rid:i,staffId:K,name:n,kitchen:!0}),(0,v.useScheduledNotices)({rid:i,staffId:_?.id??'',name:n,onOpen:()=>Ge('kitchen','orderlists')}),(0,C.useOffRotaPrompt)({rid:i,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',Ne);return()=>e.remove()},[Ne]);const Ke=Se?je.find(e=>e.id===Se):null,Ve=((0,B.default)().width,Ke?Ke.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:oe.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[be]);return(0,ye.jsxs)(D.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,ye.jsxs)(H.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,ye.jsx)(H.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,ye.jsx)($.VoiceSlot,{size:44})}),(0,ye.jsx)(H.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,ye.jsx)(H.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${V?`, ${V}`:''}`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,ye.jsxs)(E.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,ye.jsx)(te.StaffAvatar,{id:W.CHEF_ID,size:24,ring:!1}),(0,ye.jsxs)(H.default,{style:{flexShrink:1},children:[(0,ye.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),V?(0,ye.jsx)(E.Muted,{center:!1,size:10,numberOfLines:1,children:V}):null]})]})})}),(0,ye.jsx)(O.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,se.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,ye.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})})]}),(0,ye.jsxs)(A.default,{ref:De,...We.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ye.jsx)(l.BackTitleRow,{back:!('home'===be&&!Se||ze),onBack:Ne,title:Ve}),'home'===be?(0,ye.jsx)(Q.DayBar,{app:"chef",today:Oe}):null,'home'===be&&Ee?(0,ye.jsx)(Q.DayView,{rid:i,day:Ee,today:Oe,app:"chef"}):null,'home'===be?(0,ye.jsx)(ee.WhoBar,{}):null,Le&&_?(0,ye.jsx)(h.MyTasksToday,{rid:i,staffId:_.id,name:_.name,onShift:(0,f.shiftNow)(_.id,L.getTime()).on}):null,Le?(0,ye.jsx)(p.TodaysTipsCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(p.TipsPotCard,{rid:i,today:Oe}):null,Le?(0,ye.jsx)(k.CoversToday,{rid:i,onPress:()=>Ge('kitchen','bookings')}):null,Le?(0,ye.jsx)(y.LastFoodBanner,{rid:i,now:L}):null,Le?(0,ye.jsx)(x.NextTableFreeCard,{rid:i,now:L}):null,Le?(0,ye.jsx)(j.KitchenSignoffs,{rid:i,today:Oe,by:n,app:"chef"}):null,Le?(0,ye.jsxs)(H.default,{style:{gap:4},children:[(0,ye.jsx)(j.PlattersBooked,{rid:i,date:Oe,label:"Platters booked today"}),(0,ye.jsx)(j.PlattersBooked,{rid:i,date:$e,label:"Platters booked tomorrow"})]}):null,Le?(0,ye.jsx)(fe.ChefAssistantButton,{}):null,Le?(0,ye.jsx)(ve,{go:(e,t)=>{'stock'===e&&t&&Ie(t),'gp'===e&&t&&He(t),'orders'===e&&Ae(t),Ge(e,'kitchen'===e?t??null:null)}}):null,'stock'===be?(0,ye.jsx)(U.StockScreen,{initial:Pe},Pe):null,'gp'===be?(0,ye.jsx)(G.GpScreen,{initial:Be},Be):null,'creator'===be?(0,ye.jsx)(oe.DishCreator,{rid:i,canPublish:!1}):null,'orders'===be?(0,ye.jsx)(z.OrdersScreen,{focus:Re},Re??'all'):null,'kitchen'!==be||Ke?null:(0,ye.jsxs)(H.default,{style:{gap:10},children:[(0,ye.jsx)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:je.map((e,t)=>(0,ye.jsx)(R.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Ge(be,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:t?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,ye.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ye.jsxs)(H.default,{style:{flex:1},children:[(0,ye.jsx)(E.T,{weight:"medium",children:e.title}),(0,ye.jsx)(E.Muted,{children:e.sub})]}),(0,ye.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,ye.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,ye.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Se&&K?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-myshift",children:[(0,ye.jsx)(X.ClockInOut,{}),(0,ye.jsx)(Z.MyUpcomingShifts,{staffId:K,team:!0})]}):null,'mypay'===Se?(0,ye.jsxs)(H.default,{style:{gap:10},testID:"chef-mypay",children:[(0,ye.jsx)(Y.MyPeriods,{staffId:K}),(0,ye.jsx)(q.MyHoursPay,{staffId:K}),(0,ye.jsx)(J.MyTips,{staffId:K}),(0,ye.jsxs)(E.Card,{children:[(0,ye.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,ye.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,ye.jsx)(u.PushButton,{})]})]}):null,'avatar'===Se?(0,ye.jsx)(t.AvatarMaker,{meId:_?.id??W.CHEF_ID,me:n}):null,'reviews'===Se?(0,ye.jsx)(ue.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookings'===Se?(0,ye.jsx)(T.TodaysBookings,{rid:i,today:Oe,by:n,app:"chef"}):null,'specials'===Se?(0,ye.jsx)(ne.SpecialsEditor,{rid:i,me:n,app:"chef",now:L}):null,'prep'===Se?(0,ye.jsx)(N.PrepScreen,{}):null,'live'===Se?(0,ye.jsx)(N.TeamScreen,{}):null,'waste'===Se?(0,ye.jsx)(N.WasteScreen,{}):null,'recipes'===Se?(0,ye.jsx)(ce.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Se?(0,ye.jsx)(N.AllergenScreen,{openCards:()=>Ge('kitchen','recipes')}):null,'compliance'===Se?(0,ye.jsx)(N.ComplianceScreen,{}):null,'takings'===Se?(0,ye.jsx)(p.CashUpScreen,{rid:i,today:Oe,canEdit:!1,chartsOnly:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'board'===Se?(0,ye.jsx)(pe.QuestionBoard,{rid:i,today:Oe,manager:!1,by:""}):null,'teamtasks'===Se?(0,ye.jsx)(h.KitchenTeamTasks,{rid:i,actor:_}):null,'orderlists'===Se?(0,ye.jsx)(w.OrderListsScreen,{rid:i,today:Oe,editor:!0,who:{id:K,name:n.replace(' (example)','')}}):null,'foodsafety'===Se?(0,ye.jsx)(u.FoodSafetyCard,{children:(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Ge('kitchen','haccp'),children:(0,ye.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===Se?(0,ye.jsx)(ae.HaccpLog,{mode:"chef",me:n,meId:W.CHEF_ID,now:L}):null,'accidents'===Se?(0,ye.jsx)(ie.AccidentBook,{app:"chef",me:n,meId:W.CHEF_ID,now:L,seeAll:!1}):null]}),(0,ye.jsx)(me.BottomTabs,{tablist:!0,background:F.colours.surface,active:be,onPress:e=>Ge(e),tabs:xe.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon}))}),(0,ye.jsx)(fe.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Ae(t),Ge('orders')):'gp'===e?Ge('gp'):Ge('kitchen',e)}}),(0,ye.jsx)(re.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,ye.jsx)(le.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),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]),v=_r(_d[19]),C=_r(_d[20]),S=_r(_d[21]),T=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),A=e(_r(_d[27])),B=e(_r(_d[28])),H=e(_r(_d[29])),D=_r(_d[30]),O=_r(_d[31]),$=_r(_d[32]),E=_r(_d[33]),L=_r(_d[34]),F=_r(_d[35]),M=_r(_d[36]),_=_r(_d[37]),W=_r(_d[38]),G=_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]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),oe=_r(_d[55]),ae=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]),ke=_r(_d[68]),me=_r(_d[69]),ye=_r(_d[70]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const xe=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:oe.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],je=[{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'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'}],we={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 ve({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,W.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,W.useWeek)(),{covers:u,label:h,enough:p,booked:f}=(0,W.useForecast)(),b=(0,z.useSuggestions)(),k=t.ingredients.filter(e=>e.onHand<=0||(0,W.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),j=t.deliveries.filter(e=>'expected'===e.status),w=!t.recipes.length||!t.ingredients.length,v=w?[]:s.filter(e=>e.below),C=(0,n.useLiveState)(),S=(0,ge.useRecipeCards)(r).filter(e=>!e.signOff),[T,I]=(0,P.useState)(!1);return(0,ye.jsxs)(H.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,ye.jsx)(ae.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,ye.jsxs)(E.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),S.length?(0,ye.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${S.length} recipe card${1===S.length?'':'s'} awaiting your sign-off`,children:[S.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,ye.jsx)(V.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,ye.jsx)(E.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>I(!0),style:{minHeight:56}}),(0,ye.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,ye.jsx)(W.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,ye.jsx)(W.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,W.pct1)(c.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,W.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,ye.jsx)(W.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,L.gbp)((0,W.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,ye.jsx)(W.Tile,{label:"Items low or out",value:t.ingredients.length?`${k.length}`:'Nothing yet',sub:t.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,ye.jsx)(W.Tile,{label:"Waste this week",value:t.waste.length?(0,L.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,W.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,ye.jsx)(W.Tile,{label:"Covers forecast today",value:`${u}`,sub:h,onPress:()=>e('kitchen','prep')}):(0,ye.jsx)(W.Tile,{label:"Booked so far today",value:'ready'===C?`${f}`:'connecting'===C?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,ye.jsx)(W.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,ye.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,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,ye.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,v.length?(0,ye.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,ye.jsxs)(E.Banner,{kind:"warn",title:`${v.length} dishes below ${t.targetGp}% GP`,children:[v.slice(0,4).map(e=>e.item.name).join(', '),v.length>4?'\u2026':'']})}):null,(0,ye.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[oe.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,ye.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,ye.jsxs)(E.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,ye.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,ye.jsx)(be.SoldOutSheet,{visible:T,onClose:()=>I(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},792,[793,976,858,977,984,1040,1041,1042,2,1043,1047,1048,1070,827,1073,1077,1078,1081,1082,1085,1086,1087,1088,34,373,236,402,295,426,102,36,847,1116,794,836,840,1100,1118,1124,1127,1128,1140,1141,1142,1144,1145,1148,1151,1154,1155,1160,1161,899,997,1162,1133,1163,1170,1171,1180,1173,1132,1182,1186,1156,848,1187,1130,985,1188,25]); __d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},793,[34,336,236,402,102,794,899,927,924,840,928,25]); __d(function(g,_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 C.webLine}}),_e.T=R,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return T}}),_e.BrandBar=A,_e.Screen=function({children:e,title:t,subtitle:r,back:l=!0,right:o,maxWidth:n=640,footer:s,scroll:c=!0}){const h=(0,S.jsxs)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===k.APP_VARIANT?(0,S.jsx)(D,{}):null]});return(0,S.jsxs)(x.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,S.jsx)(A,{title:t,subtitle:r,back:l,right:o})}),c?(0,S.jsx)(u.default,{contentContainerStyle:{paddingBottom:40},children:h}):(0,S.jsx)(f.default,{style:{flex:1},children:h}),s?(0,S.jsx)(f.default,{style:O.footer,children:(0,S.jsx)(f.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=z,_e.Card=v,_e.Badge=function({label:e,kind:t="neutral"}){const r={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,S.jsx)(f.default,{style:[O.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:I?'center':'flex-start'}],children:(0,S.jsx)(R,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return E}}),_e.Row=V,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return $}}),_e.Field=function({label:e,...r}){return(0,S.jsxs)(f.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,S.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...r,style:[O.input,r.multiline&&{minHeight:70,textAlignVertical:'top'},r.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:l,sub:o,testID:n,accessibilityLabel:s}){return(0,S.jsxs)(c.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${s??e}${!s&&o?`, ${o}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:r,style:[O.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,S.jsx)(R,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e.trim()}),o?(0,S.jsx)(R,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:o}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:l,disabled:o,a11y:n}){return(0,S.jsxs)(V,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,S.jsx)(R,{style:{flex:1,flexShrink:1},children:r}),(0,S.jsx)(b.default,{testID:l,disabled:o,accessibilityLabel:n??r,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:r=1,max:l=20,label:o,step:n=1,format:s,testID:u}){const h=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,S.jsxs)(V,{gap:10,children:[(0,S.jsx)(c.default,{testID:u?`${u}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${o??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[O.stepBtn,e<=r?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,S.jsx)(f.default,{testID:u?`${u}-value`:void 0,accessibilityLabel:o?`${o}: ${h}`:h,children:(0,S.jsx)(R,{weight:"semibold",size:p.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:h})}),(0,S.jsx)(c.default,{testID:u?`${u}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${o??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,b(e+n))),style:[O.stepBtn,e>=l?{opacity:.4}:null],children:(0,S.jsx)(R,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:r,children:l,maxWidth:n,testID:h,footer:b}){const{height:j}=(0,y.default)(),C=o.default.useContext(x.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},w=Math.max(320,j-C.top-C.bottom-24);return(0,S.jsx)(s.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,S.jsx)(f.default,{style:[O.overlay,{padding:12,paddingTop:12+C.top,paddingBottom:12+C.bottom}],children:(0,S.jsxs)(f.default,{style:[O.sheet,{maxHeight:w},n?{maxWidth:n}:null],testID:h,children:[(0,S.jsxs)(V,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,S.jsx)(P,{style:{flex:1},children:r}),(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:B?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,S.jsx)(R,{size:B?18:24,colour:p.colours.text,children:B?'Close':'\u2715'})})]}),(0,S.jsx)(u.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:l}),b?(0,S.jsx)(f.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:h?`${h}-footer`:void 0,children:b}):null]})})})},_e.SectionTitle=function({children:e}){return(0,S.jsx)(R,{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 O}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),l=_r(d[3]),o=e(_r(d[4])),n=e(_r(d[5])),s=e(_r(d[6]));_r(d[7]);var c=e(_r(d[8])),u=e(_r(d[9])),h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),x=_r(d[14]),p=_r(d[15]),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),k=_r(d[19]),W=_r(d[20]),S=_r(d[21]);const B=['kirkton','abbotsford'].includes(w.VENUE_RID),I='display'!==k.APP_VARIANT;function R({children:e,style:r,size:l=p.font.body,weight:o="regular",colour:n=p.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:b,accessibilityLabel:f}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),x=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,w=h.default.flatten(r)||{},k=1===w.flex||1===w.flexGrow||'number'==typeof w.width||'left'===w.textAlign,W=c??(I&&('semibold'===o||'bold'===o)&&!k);return(0,S.jsx)(t.Text,{testID:u??(y?'cc-url':void 0),...W?{dataSet:{centre:'heading'}}:{},accessibilityRole:b,accessibilityLabel:f,numberOfLines:s,style:[{minWidth:0,fontFamily:p.fonts[o],fontSize:l,color:n,lineHeight:(0,j.lineFor)(l)},W&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},r,x,(0,C.webLine)(r,l),W&&'left'!==w.textAlign?{textAlign:'center'}:null],children:e})}const L=e=>(0,S.jsx)(R,{size:p.font.title,weight:"semibold",center:!0,...e}),P=e=>(0,S.jsx)(R,{size:p.font.large,weight:"semibold",center:!0,...e}),T=e=>(0,S.jsx)(R,{colour:p.colours.muted,size:p.font.small,...e,center:e.center??I});function A({title:e,back:t=!0,right:l,subtitle:o}){return(0,S.jsxs)(f.default,{style:O.brandBar,children:[(0,S.jsxs)(f.default,{style:O.row,children:[(0,S.jsx)(f.default,{style:O.brandSide,children:t?(0,S.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>r.router.canGoBack()?r.router.back():r.router.replace(k.ENTRY[k.APP_VARIANT]),style:O.backBtn,hitSlop:10,children:(0,S.jsx)(R,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,S.jsx)(c.default,{onPress:()=>r.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:O.brandCenter,children:(0,S.jsx)(W.RestaurantBrand,{size:W.HEADER_LOGO})}),(0,S.jsx)(f.default,{style:[O.brandSide,{alignItems:'flex-end'}],children:l?(0,S.jsx)(f.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,S.jsx)(L,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,S.jsx)(T,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function D(){const e=(0,r.useLocalSearchParams)().rid??w.VENUE_RID,t=(0,l.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,S.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{n.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,S.jsx)(R,{center:!0,size:14,colour:p.colours.gold,children:t})}):null}function z({label:e,sub:t,onPress:r,kind:l="primary",disabled:o,small:n,style:s,accessibilityLabel:u,accessibilityHint:h,testID:b}){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],x={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,S.jsxs)(c.default,{testID:b,accessibilityRole:"button",accessibilityLabel:u??e,accessibilityHint:h,accessibilityState:{disabled:!!o},disabled:o,onPress:r,style:({pressed:e})=>[O.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:x,opacity:o?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:j.control.min,minWidth:44},s],children:[(0,S.jsx)(R,{weight:"semibold",size:n?p.font.small:p.font.body,colour:y,center:!0,children:e.trim()}),t?(0,S.jsx)(R,{size:n?p.font.small-2:p.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function v({children:e,style:t,onPress:r,highlight:l}){const o=l===p.colours.gold||l===p.colours.accentBorder,n=(0,S.jsx)(f.default,{testID:"cc-card",style:[O.card,{alignItems:'stretch'},l?{borderColor:o?p.colours.accentBorder:l,borderWidth:o?1:2}:null,t],children:e});return r?(0,S.jsx)(c.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function F({kind:e="info",title:t,children:r}){const l={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,S.jsxs)(f.default,{accessibilityRole:"summary",style:[O.banner,{backgroundColor:l[0],borderLeftColor:l[1]}],children:[t?(0,S.jsx)(R,{weight:"semibold",colour:l[2],center:!0,children:t}):null,o.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,S.jsx)(R,{size:p.font.small,colour:l[2],center:!0,children:r}):r]})}T.statusLine=!0,z.centreRow=!0;const H=()=>(0,S.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."}),E=()=>(0,S.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function V({children:e,style:t,gap:r=8,wrap:l}){const n=o.default.Children.map(e,e=>{if(!o.default.isValidElement(e))return e;const t=e,r=h.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:o.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===v?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),s=h.default.flatten(t)||{},c=o.default.Children.toArray(n).filter(o.default.isValidElement),u=e=>e.type;if(I&&'space-between'===s.justifyContent&&1!==s.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,S.jsx)(f.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const b=I&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==s.justifyContent&&'space-between'!==s.justifyContent;return(0,S.jsx)(f.default,{...b?{dataSet:{centre:'buttons'}}:{},style:[O.row,{gap:r},b&&{justifyContent:'center',flexWrap:'wrap'},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:n})}const $=()=>(0,S.jsx)(f.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const O=h.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},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:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:j.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:j.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',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,boxSizing:'border-box',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:{maxWidth:'100%',flexShrink:0,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:j.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}})},794,[795,796,30,800,34,379,395,236,402,295,41,410,102,426,36,840,844,845,5,846,847,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},795,[]); @@ -945,7 +945,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/asset __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},862,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},863,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},864,[]); -__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 h}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return g}}),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 S}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return v}}),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 D}}),_e.openShiftOf=T,_e.loggedBreakMins=$,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 U}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return x}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return F}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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',h=e=>!!e.out&&!!e.signOff,g={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},y=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return b(new Date(a,n-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),S=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),E=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],R=1271,v=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,D=[{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 T(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function $(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-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 B=()=>{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:{},chatRead:{},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:D.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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},U=(0,u.create)()((0,f.persist)((e,a)=>({...B(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:a,job:n,active:!0,level:q[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}: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,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}: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,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=y(t,e),o=y(n,e);i.shifts.filter(e=>e.date===a&&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 a=y(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,a)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??$({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=T(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:$({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),g.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,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>g.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};g.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(B()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=j().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,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=B();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}})),V=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,q={owner:'Owner',manager:'Manager',staff:'Staff'},x={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 K=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,a)=>a.indexOf(e)===t),W=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=K(e);return n.includes(a)||n.includes(a.split(' ')[0])},F=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return $}}),_e.openShiftOf=P,_e.loggedBreakMins=A,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return W}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),a=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,a)=>t&&a.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${a} (${t})`:a},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return H}});var e,t=_r(_d[0]),a=_r(_d[1]),n=_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,t,a)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=a&&a<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,k={send:null},y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,I=e=>{const[t,a,n]=e.split('-').map(Number);return(new Date(t,a-1,n).getDay()+6)%7},w=(e,t)=>{const[a,n,i]=e.split('-').map(Number);return y(new Date(a,n-1,i+t))},S=e=>w(e,-I(e)),E=(e,t)=>e.filter(e=>e.date===t),O=(e,t,a)=>e.find(e=>e.staffId===t&&e.date===a),R=(e,t)=>t?e:e.filter(e=>e.published),v=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],_=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,$=[{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 P(e,t,a){const n=new Date(a).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&n-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function A(e,t=new Date){const a=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():a)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),M=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,N=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function C(){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,...B.includes(e.id)?{displayClock:!0}:{}}))}const B=['st-jack'];function U(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const V=()=>{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:{},chatRead:{},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:$.map(e=>({...e})),workEmail:'',staff:C(),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:U(),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?a.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?a.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?n.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},q=(0,u.create)()((0,f.persist)((e,a)=>({...V(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,a,n)=>e(e=>({staff:[...e.staff,{id:M('st'),name:t,role:a,job:n,active:!0,level:K[a]}]})),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,a)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(a))}})),clearRate:t=>e(e=>{const a={...e.hourly};return delete a[t],{hourly:a}}),updateStaff:(t,a)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...a}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:M('of')},...e.offers]})),updateOffer:(t,a)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...a}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:M('ph'),caption:t,tone:N[e.photos.length%N.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,a)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:M('cr'),text:t,at:a,status:'requested'},...e.changeRequests]}),setSite:a=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:a}),setBranding:(t,a)=>e(e=>{const n={...e.branding};return a?n[t]={...n[t],...a}:delete n[t],{branding:n}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:M('sp')},...e.socialPosts]})),setSocialPost:(t,a)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...a}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,a,n)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[a]??[];return{...e,reactions:{...e.reactions,[a]:i.includes(n)?i.filter(e=>e!==n):[...i,n]}}})})),chatSeen:(t,a)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(a))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(a)?e:{...e,seenBy:[...e.seenBy,a]})}:e),chatMarkRead:(t,a)=>e(e=>{const n={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(a))(!n[e]||Date.parse(t)>Date.parse(n[e]))&&(n[e]=t);const i=e=>Math.max(Date.parse(n['*']??'')||0,Date.parse(n[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:n},chat:s}}),chatPatch:(t,a)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...a}:e)})),chatMute:(t,a)=>e(e=>{const n=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),sys:(t,a,n)=>e(e=>({chat:[...e.chat,{id:M('m'),ch:t,from:'system',text:a,at:n,reactions:{},seenBy:[]}]})),tick:(t,a,n,i)=>e(e=>({checks:{...e.checks,[t]:{by:a,at:n,value:i}}})),untick:t=>e(e=>{const a={...e.checks};return delete a[t],{checks:a}}),addLost:t=>e(e=>({lost:[{...t,id:M('lp'),status:'held'},...e.lost]})),setLost:(t,a)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...a}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:M('cp')},...e.campaigns]})),setCampaign:(t,a)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...a}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:I(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:I(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,n)=>{const i=a(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const a=w(t,e),o=w(n,e);i.shifts.filter(e=>e.date===a&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!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:I(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 a=w(t,6);let n=0;return e(e=>({shifts:e.shifts.map(e=>e.datea||e.published&&!e.changed?e:(n++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),n},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,a)=>e(e=>{const n=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const a={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[a,...e.leave]})),a},setLeave:(t,n)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)}));const i=a().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:M('sw'),status:'open'},...e.swaps]})),setSwap:(t,a)=>e(e=>{const n=e.swaps.find(e=>e.id===t);return{shifts:'approved'===a&&n?.toId?e.shifts.map(e=>e.id===n.shiftId?{...e,staffId:n.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:a}:e)}}),toggleAvail:(t,a)=>e(e=>{const n=e.availability[t]??[];return{availability:{...e.availability,[t]:n.includes(a)?n.filter(e=>e!==a):[...n,a]}}}),clock:(t,a,n,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'===n)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:a,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??A({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,a,n,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?.[a]?new Date(o[a]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[a]:n,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:M('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${a} from ${c} to ${new Date(n).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,a,n)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...a,geo:n?[...e.geo??[],n].slice(-20):e.geo}:e)})),breakToggle:(t,n,i)=>{const s=a(),r=P(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===n?d:!d)return!1;const c='start'===n?[...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:A({breaks:c})}:e)}),!0},adjustBreak:(t,a,n,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:a,adjusted:{by:n,at:s,reason:i}}:e),attLog:[{id:M('al'),at:s,text:`${n} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${a}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const n=a(),i=t.id?n.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,a,n)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:a,to:n,reason:s}),d=n.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 a=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:a,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')]}),k.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:M('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,n,i,s)=>{const r=a(),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:n,byId:i,at:s},audit:[...e.audit??[],{at:s,by:n,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:M('al'),at:s,text:`${n} 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,n,i,s)=>{const r=a().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:n,resolvedBy:i,resolvedAt:s};k.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,a)=>e(e=>({consent:{...e.consent,[t]:a}})),resetOwner:()=>e(V()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const a=new Set(e.staff.map(e=>e.id)),n=C().filter(e=>!a.has(e.id));return{staff:n.length?[...e.staff,...n]:e.staff,hourly:{...e.hourly,...U()},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=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=V();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=S(y(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:w(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}})),x=(e,t,a)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${a(t)}/h`,K={owner:'Owner',manager:'Manager',staff:'Staff'},W={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 F=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,a)=>a.indexOf(e)===t),G=(e,t)=>{const a=t.trim().toLowerCase();if(!a)return!1;const n=F(e);return n.includes(a)||n.includes(a.split(' ')[0])},H=(e,t)=>{const a=t.trim().toLowerCase();return!a||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(a))}},865,[5,6,841,802,806,804,807,808,815,818,15,839]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},866,[]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},867,[]); __d(function(s,t,r,i,a,c,e){"use strict";a.exports={uri:"/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},868,[]); @@ -1065,7 +1065,7 @@ __d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModul __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},982,[804]); __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 u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).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 u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),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(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};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 u=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):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},983,[982]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return c.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const c=e.IS_CAR?b[n]:'nolink'===n&&'display'===e.APP_VARIANT?p:f[n];return(0,h.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${c}`,style:{borderRadius:16,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface,padding:14,gap:4},children:[(0,h.jsx)(u.T,{size:12,weight:"semibold",colour:l.colours.goldMuted,children:o.toUpperCase()}),(0,h.jsx)(u.T,{size:18,weight:"semibold",children:c})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]),h=r(d[7]);const f={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},p="This Display isn't paired yet. Tap Not paired to pair it.",b={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when the car is back online.',nolink:'Not connected yet. Check the car has internet. If this stays, sign the car in again from Managers on your phone.'}},984,[846,34,102,985,2,840,794,25]); -__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return he}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),It(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=he.getState().venueId;if(!s||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=he.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Gt,i.readAccessLog=async function(){const e=he.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Qt}}),i.uploadOrderLogo=async function(e,t){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Qt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=Jt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Qt).createSignedUrl(e,3600);if(t?.signedUrl)return Jt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Qt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return zt}}),i.claimInvite=ca,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(na,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ia,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=he.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=he.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ia,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(na),await T.kv.remove(ia),Se({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=he.getState().venueId;if(ae.PITCH||!s||'staff'!==he.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await ma('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'}}},i.claimInviteForSync=async function(e){const t=await ca(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return await ma('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),ma('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return ma('staff_app_link_history',{p_venue:he.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await ma('revoke_staff_app_link',{p_venue:he.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=he.getState().venueId;if(!e||'staff'!==he.getState().kind)return{};try{const t=await ma('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=he.getState().venueId;if(!t||'staff'!==he.getState().kind)throw new Error('Connect to the venue first.');return Number(await ma('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=he.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(sa,n),Sa(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ua();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(la,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:fa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(la,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(na,null);await T.kv.set(na,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||Sa()}return'revoked'!==i&&'unknown'!==i||await pa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await pa(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}Se({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=he.getState().venueId;if(!a||'staff'!==he.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await ma('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:fa(e)}}},i.carList=async function(){const e=he.getState().venueId;if(!e)return[];return(await ma('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=he.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await ma('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:fa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(sa),await ha();try{await _e().auth.signOut()}catch{}Se({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(na),await T.kv.remove(ia),await ha();try{await _e().auth.signOut()}catch{}Se({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Se({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ga,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return ma}}),i.mendSession=ya,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,wa=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,h.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,h.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Se({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 Ka(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void Se({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void Se({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];Se({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>Se({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>Se({mode:e?he.getState().venueId?'live':he.getState().mode:he.getState().venueId?'offline':he.getState().mode}))),await va()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ua}}),i.goLive=Ea,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ga}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Va.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Va.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),ma('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Ue(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Ue(a.from_time),to:Ue(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Va.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ga.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Va.get(a);e&&!e.ok&&Va.delete(a)}));const n=Va.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=he.getState().venueId;if(!n||'staff'!==he.getState().kind)throw new Error('Connect to your venue first.');const i=await ma('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),h=t(r[10]),S=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),D=t(r[21]),U=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),j=t(r[34]),B=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,U.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const he=(0,D.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Se=e=>he.setState(e),ye=e=>{const t=he.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=he.getState().mode;return'live'===e||'offline'===e||'connecting'===e};he.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),De=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Ue=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=De(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==he.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=De(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==he.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(j.useFloor.getState().plans[e]??(0,j.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:he.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&j.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>j.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>B.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>B.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>B.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>B.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(B.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==he.getState().kind&&('device'!==he.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>B.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>B.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(B.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={...B.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;B.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{B.useShellStore.getState().server[e]||B.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const je=new Set;function Be(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,h.isAnchorage)(e)&&(0,h.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,h.isAnchorage)(e)&&(s={...s,signOff:(0,h.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,h.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,h.isAnchorage)(e)&&(0,h.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,h.isAnchorage)(e)&&(0,h.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!je.has(e)){je.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){je.delete(e),Se({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,D.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==he.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,h.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${he.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=De(62),t=e=>ye('rota.manage')||e.staffId===he.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,S.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,S.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=De(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===he.getState().staffRef&&'open'===e.status,writable:()=>'staff'===he.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,S.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===he.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const gt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function mt(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function _t(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:j.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:gt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...St??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...St?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...St?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},St=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&j.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&mt(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=j.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,St=null;const yt=()=>new Date(Date.now()-2592e6).toISOString(),wt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},vt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},bt=()=>he.getState().perms.includes('*');function kt(){const e=()=>he.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!wt(t.ch)&&(t.from===e()||bt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('created_at',yt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=yt(),toRow:(e,t)=>{const a=wt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=vt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=vt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function It(e,t,a){const s=he.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':wt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Ot(e){const t=he.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':vt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function Rt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function At(e){const t=De(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===he.getState().staffRef,writable:()=>'staff'===he.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ut=e=>null==e||''===e?null:Number(e),Ct=e=>e.filter(e=>!e.startsWith('data:'));function Et(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',De(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Ct(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Tt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Ct(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Nt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function Mt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',De(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function xt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ut(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function Kt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function qt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Lt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function Pt(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===he.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:he.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function $t(e){const t=De(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,S.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Bt(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===he.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ft(e){const t=De(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=he.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===he.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Wt(e,t=!1){const a=De(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Ht(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===he.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Vt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Gt(){const e=he.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Qt='order-list-logos';const Jt=new Map;const zt=(0,D.create)(()=>({live:!1,known:!1}));async function Zt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const Xt=(e,t)=>Ee({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)}),ea='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function ta(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Xt(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function aa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ea).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Xt(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const sa='pair:v1',na='staff:v1',ia='staff:rejoin:v1';async function ra(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function oa(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ia,null);if(!e)return'none';try{await ua();const{data:t,error:a}=await ra(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ia),await T.kv.remove(na),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(na,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ia),'refused')}catch{return'offline'}}const da=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 ua(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}Se({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 ca(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ua();const{data:t,error:a}=await ra(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(na,n),await T.kv.set(ia,e),Re&&Sa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Se({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const la='car:request:v1',fa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function pa(){await T.kv.remove(na),await T.kv.remove(la),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ga(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ua(),!0}catch{return!1}}const ma=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let _a=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],_a&&(clearInterval(_a),_a=null)}async function Sa(){await ha(),await va()}async function ya(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ia,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await oa()&&(Sa(),!0)}catch{return!1}}(0,d.setSessionMender)(ya);let wa=o.VENUE_RID;async function va(){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 e=wa;try{if(Se({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Oa(e);const t=await T.kv.get(sa,null);let a=await T.kv.get(na,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await oa();if('offline'===t)return Se({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{wa===e&&Sa()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(na,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void Se({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await ma('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(sa):(await T.kv.remove(na),await T.kv.remove(ia)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void Se({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))Se({mode:'offline'});else if(da(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await oa()&&setTimeout(()=>{wa===e&&Sa()},500)}i=he.getState().perms}Se({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await ka(n.venueId,e,n.kind)}catch(e){Se({mode:'local',lastError:String(e?.message??e)})}}const ba=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 ka(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ea(a),Oe.push(Ha(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[_t(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Wa()},onRemote:()=>{Wa()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[wa]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[wa],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&&V.useSetup.getState().patch(wa,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[wa]?.staffGrade!==a.sites[wa]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Be(a),La(a)];ye('wages.view')&&n.push(Pa(a)),'staff'===s&&(n.push(ut(),ct(),lt(),pt(a)),ft(e));const i='staff'===s&&await Yt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(kt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Vt('hr_questions')&&(n.push(ta(a)),ba.add('hr_questions'),aa(e,a)),'guest'!==s&&await Vt('sold_out_items')?(n.push(Wt(a,await Vt('sold_out_items','auto'))),ba.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Vt('sold_out_links')?(n.push(Ht(a)),ba.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Zt()&&(n.push(Rt(a)),'staff'===s&&n.push(At(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Vt('staff','nickname'),Ze=await Vt('staff','display_clock');const[e,t,s,i]=await Promise.all([Vt('scheduled_notifications'),Vt('order_lists'),Vt('venue_clock_area'),Vt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Bt(a),Ft(a)),ba.add('daily_tasks'),ba.add('daily_task_ticks')),e&&(n.push(qt(a)),Gt()),t&&n.push(Lt(a),Pt(a),$t(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ba.add(n)}if('guest'!==s&&await Vt('day_tips')){n.push(Mt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ba.add(e);await Vt('tips_pot_events')&&n.push(xt(a),Kt(a)),'staff'===s&&(n.push(Et(a),Tt(a),Nt(a)),ba.add('cash_ups'),ba.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Vt('scheduled_notifications')&&n.push(qt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===he.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Vt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ba.add('ingredient_prices'),await Vt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ba.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Vt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ba.add('specials_boards'));const c={onActivity:()=>Se({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Se({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Se({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await ma('whoami')??[]).some(t=>t.venue_id===e))return void(wa===a&&Sa());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await ma('whoami');if(!t?.some(t=>t.venue_id===e))return void(wa===a&&Sa())}catch(e){if(da(e)){const e=await oa();return void('ok'!==e&&'refused'!==e||wa===a&&Sa())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Ot(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(Se({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):Se({mode:'offline'}),!ye('wages.view')){const e=he.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ba.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const h=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);Se({lastSyncAt:(new Date).toISOString()})},e=>{Se({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(h)}),_a=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...he.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Ia='guest:sent:v1';async function Oa(e){Se({kind:'guest',venueSlug:e,perms:[]});try{const t=(await ma('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){Se({venueId:t.id,venueName:t.name}),await Ea(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),mt(e,t.app?.events)}await Ra(e),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Se({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Ra(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Aa(e)}async function Ra(e){const t=await ma('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Aa(e){let t=await T.kv.get(Ia,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ga())return;for(const a of n)try{const s=(await ma('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await ma('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Se({lastError:`Order: ${e?.message}`}))}await T.kv.set(Ia,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await ma('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Ia,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await ma('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),Se({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Se({mode:(0,E.isOnline)()?he.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),_a=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ua={bridges:()=>Ie,restart:Sa},Ca='golive:v1:';async function Ea(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await Ka(e):(await T.kv.get(Ca+e,!1)||await Ka(e),await T.kv.get(Ma+e,!1)||(xa(e),await T.kv.set(Ma+e,!0)),await T.kv.get(Ta+e,!1)||(Na(),await T.kv.set(Ta+e,!0)))}const Ta='golive:v3:';function Na(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 Ma='golive:v2:';function xa(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 Ka(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,h.isDemoCard)(e)),log:m.log.filter(e=>!(0,h.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ca+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),j.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:[],swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ca+e,!0)}const qa=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function La(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(j.useFloor.getState().live[e]??{}).map(([e,t])=>qa(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===he.getState().kind||ye('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:he.getState().staffRef??ve}),fromRow:e=>qa(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>j.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>j.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Pa(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const $a='staff-avatars',ja=new Map;let Ba=!1;const Fa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Wa(){if(!Ba){Ba=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===he.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from($a).download(t);if(n||!s)continue;const i=await Fa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ba=!1}}}function Ha(e){const t=async()=>{const t=he.getState().staffRef,a=t?Ye.get(t)??he.getState().staffUuid:void 0;if(!t||!a||'staff'!==he.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from($a).remove([t]).catch(()=>{})};if(!s)return void(n&&(await ma('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Se({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 _e().storage.from($a).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await ma('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Se({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==he.getState().staffRef){const e=s[t].path;ja.set(t,null),ma('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from($a).remove([e])).catch(()=>{})}});return t(),s}const Va=new Map,Ga=(0,D.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return b.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return b.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return k.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return we}}),i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();J.useOwner.getState().chatMarkRead(e,{[t]:a});const s=J.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>J.useOwner.getState().chatSeen(t,e)),Ot(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await _e().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(J.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await _e().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return J.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...st(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ae.PITCH)return ne.unlockCashUp(e,t,a);const s=Se.getState().venueId;if(!s||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await _e().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?Y.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):Y.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)}}},i.readCashAudit=async function(e){if(ae.PITCH)return ne.cashAudit(e);const t=Se.getState().venueId;if(!t)return[];let a=_e().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:n}=await a;return n||!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,k.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await _e().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(Zt.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=Qt,i.readAccessLog=async function(){const e=Se.getState().venueId;if(!e)return[];try{const{data:t}=await _e().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Jt}}),i.uploadOrderLogo=async function(e,t){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await _e().storage.from(Jt).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=zt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await _e().storage.from(Jt).createSignedUrl(e,3600);if(t?.signedUrl)return zt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await _e().storage.from(Jt).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return Zt}}),i.claimInvite=la,i.signedInHereAs=async function(e){ke();const t=await T.kv.get(ia,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return ke(),await T.kv.get(ra,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Se.getState();if(!o.IS_WILDINGS||'staff'!==e.kind||e.venueId!==o.VENUE_UUID||e.staffRef!==I.useSession.getState().meId)return null;ke();const t=await T.kv.get(ra,null);return t?(0,I.appUrl)('staff',t):null},i.forgetSignInHere=async function(){ke(),await T.kv.remove(ia),await T.kv.remove(ra),he({mode:'signin',perms:[]});try{await ha()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Se.getState().venueId;if(ae.PITCH||!s||'staff'!==Se.getState().kind)return{ok:!0};if(!(0,z.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await _a('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'}}},i.claimInviteForSync=async function(e){const t=await la(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ae.PITCH)return ne.reissueInvite(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await _e().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.ensureStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return _a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.refreshStaffAppLinks=async function(e){const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return await _a('refresh_staff_app_links',{p_venue:t,p_staff_ref:e}),_a('ensure_short_staff_app_links',{p_venue:t,p_staff_ref:e})},i.staffAppLinkHistory=async function(e){return _a('staff_app_link_history',{p_venue:Se.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await _a('revoke_staff_app_link',{p_venue:Se.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ae.PITCH)return ne.linkPhones();const e=Se.getState().venueId;if(!e||'staff'!==Se.getState().kind)return{};try{const t=await _a('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(ae.PITCH)return ne.resetPhone(e);const t=Se.getState().venueId;if(!t||'staff'!==Se.getState().kind)throw new Error('Connect to the venue first.');return Number(await _a('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ae.PITCH)return ne.inviteStatus();const e=Se.getState().venueId;if(!e)return{};const{data:t,error:a}=await _e().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},i.pairWithCode=async function(e){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:t,error:a}=await _e().rpc(o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_pairing_code':o.IS_GREENSIDE?'claim_greenside_pairing_code':o.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':o.IS_KIRKTON?'claim_kirkton_pairing_code':o.IS_WILDINGS?'claim_wildings_pairing_code':o.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':o.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)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:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await T.kv.set(na,n),ya(),{ok:!0,venueName:s.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}`}}},i.carPairStart=async function(){if(!(0,C.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await ca();const{data:e,error:t}=await _e().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await T.kv.set(fa,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:pa(e)}}},i.carPairPoll=async function(e){try{ke();const t=e??await T.kv.get(fa,null);if(!t)return'unknown';const{data:a,error:s}=await _e().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if('approved'===i&&n?.external_ref){const e={kind:'staff',venueId:n.venue_id,venueSlug:n.venue_slug,venueName:n.venue_name,staffRef:n.external_ref,staffUuid:n.staff_id,role:n.role_key,displayName:n.display_name},t=await T.kv.get(ia,null);await T.kv.set(ia,e),I.useSession.getState().meId!==e.staffRef&&(I.useSession.getState().signIn(e.staffRef),J.useOwner.setState({staffAs:e.staffRef,previewRole:'owner'})),t&&t.staffRef===e.staffRef||ya()}return'revoked'!==i&&'unknown'!==i||await ga(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{ke(),await _e().rpc('car_sign_out')}catch{}await ga(),await ha();try{await _e().auth.signOut({scope:'local'})}catch{}he({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is signed out.'})},i.carApprove=async function(e,t="Tesla"){const a=Se.getState().venueId;if(!a||'staff'!==Se.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await _a('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:pa(e)}}},i.carList=async function(){const e=Se.getState().venueId;if(!e)return[];return(await _a('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Se.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await _a('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:pa(e)}}},i.unpairDisplay=async function(){await T.kv.remove(na),await ha();try{await _e().auth.signOut()}catch{}he({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await T.kv.remove(ia),await T.kv.remove(ra),await ha();try{await _e().auth.signOut()}catch{}he({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.'})},i.wipeThisDevice=async function(e={}){try{await ha()}catch{}try{(0,C.isSupabaseConfigured)()&&await _e().auth.signOut({scope:'local'})}catch{}let t=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 e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${o.VENUE_RID}:`)):(0,b.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!o.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}he({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!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=ma,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return _a}}),i.mendSession=wa,i.startAppSync=async function(e=o.VENUE_RID){if(o.IS_ISOLATED_VENUE&&e!==o.VENUE_RID)return;if(Re)return;Re=!0,va=e,'customer'===ve&&'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(ke(),'customer'!==ve){const t=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'===ve&&(0,S.isAnchorage)(e)?[L.useStore,J.useOwner,G.useKitchen,Q.useSafety,F.useCardStore,g.useGpCalc,W.useOrderSheets,_.useSpecials,O.useHr]:[L.useStore,J.useOwner,G.useKitchen];if(await Promise.all(a.map(t)),'chef'===ve&&(0,S.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void he({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 qa(e)}catch{if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e))return void he({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,C.isSupabaseConfigured)())return void he({mode:'off'});K.mutationQueue.subscribe(()=>{const e=K.mutationQueue.waiting,t=e[0];he({pending:K.mutationQueue.pending.length,failed:K.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,M.describeWrite)(t)}: ${(0,M.plainReason)({...t.lastErr},'retry')}`:void 0})}),K.mutationQueue.onFailed(e=>he({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:K.mutationQueue.failed.length,refused:{what:(0,M.describeWrite)(e),why:'conflict'===e.reason?(0,M.plainReason)({code:'conflict'},'refused'):(0,M.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),Oe.push((0,E.onConnectivity)(e=>he({mode:e?Se.getState().venueId?'live':Se.getState().mode:Se.getState().venueId?'offline':Se.getState().mode}))),await ba()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return Ca}}),i.goLive=Ta,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Qa}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Ga.get(a);if('customer'!==ve||!(0,C.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Ga.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),_a('public_day',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:De(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:De(a.from_time),to:De(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),Ga.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Qa.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ga.get(a);e&&!e.ok&&Ga.delete(a)}));const n=Ga.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Se.getState().venueId;if(!n||'staff'!==Se.getState().kind)throw new Error('Connect to your venue first.');const i=await _a('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});L.useStore.getState().updateRestaurant(e,{...i,id:e})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),O=t(r[18]),R=t(r[19]),A=t(r[20]),U=t(r[21]),D=t(r[22]),C=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),M=t(r[27]),x=t(r[28]),K=t(r[29]),q=t(r[30]),L=t(r[31]),P=t(r[32]),$=t(r[33]),B=t(r[34]),j=t(r[35]),F=t(r[36]),W=t(r[37]),H=t(r[38]),V=t(r[39]),G=t(r[40]),Q=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=(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})(se),ie=t(r[51]),re=t(r[52]),oe=t(r[53]),de=t(r[54]),ue=t(r[55]),ce=t(r[56]),le=t(r[57]),fe=t(r[58]),pe=t(r[59]),ge=t(r[60]),me=t(r[61]);const _e=()=>(0,D.getSupabase)();K.mutationQueue.setExecutor(N.executeMutation);const Se=(0,U.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),he=e=>Se.setState(e),ye=e=>{const t=Se.getState().perms;return t.includes('*')||t.includes(e)},we=()=>{const e=Se.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Se.subscribe(()=>(0,fe.setLiveData)(we()));let ve=P.IS_CAR?'car':P.APP_VARIANT,be=!1;const ke=()=>{be||((0,T.setSyncNamespace)(ve),be=!0)};let Ie=[],Oe=[],Re=!1;const Ae=()=>(new Date).toISOString().slice(0,10),Ue=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),De=e=>e?e.slice(0,5):'',Ce=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))):[],Ee=e=>JSON.parse(JSON.stringify(e));function Te(e,t){const a=Ue(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>L.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Ee(e);if(t)return{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:Ce(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,z.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:Ce(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,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}return'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ne(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>L.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>'guest'!==Se.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,z.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Ee(e.lines??[]),allergies:Ce(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:Ee(e.allergyChain??{}),readiness:Ee(e.readiness??{}),allergy_ticks:Ee(e.allergyTicks??{}),handover_check:e.handoverCheck?Ee(e.handoverCheck):null,accepted:e.accepted?Ee(e.accepted):null,doc:Ee(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)=>L.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>L.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Me(e){const t=Ue(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...$.useBlocks.getState().blocks,...$.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Se.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:Ee(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,$.blockClock)(t.from_time)??a?.from,n=(0,$.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>$.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>$.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let xe=null;function Ke(e){const t=e=>Ee({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(B.useFloor.getState().plans[e]??(0,B.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>ye('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:xe??(0,pe.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:Se.getState().staffRef??ve}),fromRow:e=>(xe=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,ge.withSeedBest)(e,t[0]):void 0;a&&B.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>B.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function qe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>j.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>ye('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,z.isUuid)(e.supplierId)?e.supplierId:(0,pe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),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,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),Ge.get(t)??t)}:{}};var t},apply:(t,a)=>j.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.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=>j.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Le=new Set;function Pe(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>j.useShellStore.getState().events.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,z.isUuid)(t.id)&&!!(j.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Se.getState().kind&&('device'!==Se.getState().kind||ye('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,z.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Le.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)=>j.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>j.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function $e(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(j.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={...j.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;j.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Le]}}}))},afterRead:()=>{j.useShellStore.getState().server[e]||j.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Le]}}}))},subscribe:()=>()=>{}}}const Be=new Set;function je(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=L.useStore.getState().menu;return F.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,z.isUuid)(t.card.id)&&!((0,S.isAnchorage)(e)&&(0,S.isDemoCard)(t.card)),writable:()=>ye('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,S.isAnchorage)(e)&&(s={...s,signOff:(0,S.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,S.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,S.isAnchorage)(e)&&(0,S.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,pe.photoPath)(a,s),t=Fe(s.photo);t&&((0,F.cachePhotoAs)(e,t),We(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,pe.cardToRow)(s,a);return{...i,...r,doc:Ee({card:s,item:n})}},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,S.isAnchorage)(e)&&(0,S.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(!ye('recipes.edit')&&t.length){const e=new Set(t);F.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);F.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=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)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&L.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&L.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=F.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=L.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Fe=e=>(0,F.readLocalPhoto)(e);async function We(e,t){if(!Be.has(e)){Be.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await _e().storage.from(pe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Be.delete(e),he({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const He=new Map,Ve=(0,U.create)(()=>({n:0}));(0,F.setStoragePhotoResolver)(e=>{const t=He.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,C.isSupabaseConfigured)()&&'off'!==Se.getState().mode?(t||(He.set(e,{url:'',at:Date.now()}),_e().storage.from(pe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(He.set(e,{url:t.signedUrl,at:Date.now()}),Ve.setState(e=>({n:e.n+1})),F.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Ge=new Map;const Qe=(e,t)=>{const a=(0,z.isUuid)(t)?t:(0,pe.uuidFrom)(`sup:${e}:${t}`);return Ge.set(a,t),a};function Je(e){return{name:'order_sheets',table:'suppliers',list:()=>W.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,S.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Ge.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>W.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.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=>W.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,z.isUuid)(e)?e:(0,pe.uuidFrom)(`sup:${Se.getState().venueId}:${e}`)})}}let ze=!1,Ze=!1;const Ye=new Map,Xe=new Map,et=new Map,tt=new Map,at=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',st=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'},nt=(e,t)=>({...e,managerAccess:t}),it=()=>({nickname:ze,display:Ze}),rt=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=nt({role:e.role,level:e.level??st(at(e)).level},!0===e.managerAccess);return(0,x.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},it())};const ot=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},dt=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function ut(){return{name:'rota',table:'rota_shifts',list:()=>J.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&Ye.has(e.staffId),writable:()=>ye('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Ye.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(ot());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:dt(e.start),end_time:dt(e.end),published:!!e.published,doc:Ee(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function ct(){const e=Ue(62),t=e=>ye('rota.manage')||e.staffId===Se.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>J.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&t(e),writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Ee(e.breaks??[]),break_mins:e.breakMins??0,doc:Ee((0,h.privateAttendance)(o.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,h.privateAttendance)(o.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function lt(){const e=Ue(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&e.staffId===Se.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Se.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:Ye.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,z.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:Ee({...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)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function ft(e){J.leaveRemote.decide=t=>!(!ye('rota.manage')||!(0,z.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(K.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),Oe.push(()=>{J.leaveRemote.decide=null})}function pt(e){J.timesheetRemote.send=(t,a)=>{if(!ye('rota.manage')||!(0,z.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return K.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:Ee(s)}}),!0}const s=a;if('attendance_confirm'===t)return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return K.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:Ee(s.breaks??[]),p_reason:n,p_doc:Ee((0,h.privateAttendance)(o.VENUE_RID,s))}}),!0},Oe.push(()=>{J.timesheetRemote.send=null})}function gt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>L.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Se.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,z.isUuid)(a)?a:(0,pe.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,z.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Ee(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>L.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=>L.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const mt=e=>L.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function _t(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}));L.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function St(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=L.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Ee({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:B.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>ye('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...yt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...yt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...yt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ht??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ht=t.feature_flags??{},yt=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}),Ee({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 a=t[0];a&&(L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,c.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&B.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&_t(e,a.events))},subscribe:e=>{const t=L.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=B.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ht=null,yt=null;const wt=()=>new Date(Date.now()-2592e6).toISOString(),vt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Ye.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},bt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Xe.get(e));return 2===t.length&&t[0]&&t[1]?(0,de.dmId)(t[0],t[1]):null},kt=()=>Se.getState().perms.includes('*');function It(){const e=()=>Se.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>J.useOwner.getState().chat.filter(e=>(0,z.isUuid)(e.id)).map(e=>Ee({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=>!!vt(t.ch)&&(t.from===e()||kt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('created_at',wt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=wt(),toRow:(e,t)=>{const a=vt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Ye.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=bt(String(e.channel));if(!t)return null;const a=e.from_staff?Xe.get(String(e.from_staff)):'system';return a?Ee({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)=>J.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Xe.get(String(t.from_staff)):'system',n=bt(String(t.channel)),i=e();if(!n||!i||s===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=J.useOwner.getState();if((r.chatMuted[i]??[]).includes(n))return;if(!(0,de.inChannel)(n,r.staff.find(e=>e.id===i)))return;if((0,ue.soundAllowed)())try{(0,ue.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=n.startsWith('dm:')?'sent you a message':`in ${'all'===n?'Everyone':'foh'===n?'Front of house':'kitchen'===n?'Kitchen':'managers'===n?'Managers':n}`,u=String(t.body??t.text??'').slice(0,120);(0,w.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Ot(e,t,a){const s=Se.getState();if(!oe.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=Ye.get(e),i='*'===t?'*':vt(t);if(n&&i)try{await _e().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Rt(e){const t=Se.getState().staffRef,a=t?Ye.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await _e().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':bt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&J.useOwner.getState().chatMarkRead(t,i)}catch{}}function At(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=R.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Ee(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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)=>R.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,A.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[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=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Ut(e){const t=Ue(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>R.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.reminderId)&&e.staffRef===Se.getState().staffRef,writable:()=>'staff'===Se.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)=>R.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>R.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Dt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Ct=e=>null==e||''===e?null:Number(e),Et=e=>e.filter(e=>!e.startsWith('data:'));function Tt(e){return{name:'cash_ups',table:'cash_ups',list:()=>Y.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',Ue(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:Ee(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:Et(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)=>Y.useCashUp.setState(s=>({cashUps:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function Nt(e){return{name:'sales_reports',table:'sales_reports',list:()=>Y.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>ye('wages.manage')||(0,y.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Ee(e.vals),categories:e.categories,photos:Et(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)=>Y.useCashUp.setState(s=>({sales:Dt(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=>Y.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function Mt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=Y.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,Y.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Ee({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,Y.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>Y.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function xt(e){return{name:'day_tips',table:'day_tips',list:()=>Y.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',Ue(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=>Y.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>Y.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:()=>Y.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ct(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>Y.useCashUp.setState(s=>({pot:Dt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function qt(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=Y.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>ye('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=>Y.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>Y.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Lt(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>Z.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Ee(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>Z.useNotifs.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>Z.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Pt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=X.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,z.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Ee(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Ee(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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)=>X.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...ee.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Dt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function $t(e){const t=()=>ye('venue.settings')||ye('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>X.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,z.isUuid)(a.id)&&(0,z.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,X.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Se.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Se.getState().staffRef)||null,doc:Ee(n),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)=>X.useOrderLists.setState(s=>({items:Dt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Bt(e){const t=Ue(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>X.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('venue.settings')||ye('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:Ee(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>X.useOrderLists.setState(s=>({history:Dt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>X.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function jt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=te.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Ee(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>ye('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&&te.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,h.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>te.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Ft(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=ie.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,ie.libraryRowId)(e),kind:'library',doc:Ee({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,ie.personRowId)(e,i),kind:'person',staffRef:i,doc:Ee({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=J.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,re.canEditTasks)(t,a)},writable:()=>'staff'===Se.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=>ie.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,ie.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Wt(e){const t=Ue(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>ie.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Se.getState();return e.byRef===t.staffRef||ye('staff.manage')},writable:()=>'staff'===Se.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)=>ie.useDailyTasks.setState(s=>({ticks:Dt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>ie.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Ht(e,t=!1){const a=Ue(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ce.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,pe.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)=>ce.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ce.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{le.autoSync.soldOutRead.add(e)}}}function Vt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>le.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:(0,pe.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)=>le.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>le.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{le.autoSync.linksRead.add(e)}}}async function Gt(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:n}=await Promise.race([_e().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&T.kv.get(a,!1):(T.kv.set(a,!0),!0)}catch{return T.kv.get(a,!1)}}async function Qt(){const e=Se.getState().venueId;if(e)try{const{data:t}=await _e().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();Zt.setState({live:!!t?.push_live,known:!0})}catch{}}const Jt='order-list-logos';const zt=new Map;const Zt=(0,U.create)(()=>({live:!1,known:!1}));async function Yt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('reminders:ok',!1):(T.kv.set('reminders:ok',!0),!0)}catch{return T.kv.get('reminders:ok',!1)}}async function Xt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([_e().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&T.kv.get('chat:ok',!1):(T.kv.set('chat:ok',!0),!0)}catch{return T.kv.get('chat:ok',!1)}}const ea=(e,t)=>Ee({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)}),ta='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function aa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>O.useHr.getState().questions.filter(t=>t.venue===e&&(0,z.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ea(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);O.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>O.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function sa(e,t){const a=(t,a,s)=>{K.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(O.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,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),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:n}=await _e().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?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:n}=await _e().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?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 _e().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 _e().from('hr_questions').select(ta).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||O.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ea(e,t)))}catch{}}}),Oe.push(()=>{Object.assign(O.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const na='pair:v1',ia='staff:v1',ra='staff:rejoin:v1';async function oa(e){const t=o.IS_QUEUED_VENUE?'claim_'+o.VENUE_RID+'_invite':o.IS_GREENSIDE?'claim_greenside_invite':o.IS_ABBOTSFORD?'claim_abbotsford_invite':o.IS_KIRKTON?'claim_kirkton_invite':o.IS_WILDINGS?'claim_wildings_invite':o.IS_KIRKMICHAEL?'claim_kirkmichael_invite':o.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:ve,p_device:(0,I.deviceId)()},s=await _e().rpc(t,{...a,p_phone:(0,I.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?_e().rpc(t,a):s}async function da(){if('display'===ve||'customer'===ve||ae.PITCH)return'none';const e=await T.kv.get(ra,null);if(!e)return'none';try{await ca();const{data:t,error:a}=await oa(e);if(a)return(0,b.inviteRefusal)(a.message)?(await T.kv.remove(ra),await T.kv.remove(ia),'refused'):'offline';const s=t?.[0];return s?(await T.kv.set(ia,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await T.kv.remove(ra),'refused')}catch{return'offline'}}const ua=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 ca(){ke();const{data:e}=await _e().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await _e().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}he({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 la(e){if(ae.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,b.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,C.isSupabaseConfigured)())return{status:'off'};try{await ca();const{data:t,error:a}=await oa(e);if(a){const e=(0,b.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,o.venueKey)(`cc-pending-invite:${ve}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await T.kv.set(ia,n),await T.kv.set(ra,e),Re&&ya(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return he({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const fa='car:request:v1',pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function ga(){await T.kv.remove(ia),await T.kv.remove(fa),I.useSession.getState().meId&&I.useSession.getState().signOut()}async function ma(){if(!(0,C.isSupabaseConfigured)())return!1;try{return await ca(),!0}catch{return!1}}const _a=async(e,t={})=>{if(ae.PITCH)return(0,se.pitchRpc)(e,t);const{data:a,error:s}=await _e().rpc(e,t);if(s)throw s;return a};let Sa=null;async function ha(){for(const e of Oe)try{e()}catch{}Oe=[],Ie.forEach(e=>e.stop()),Ie=[],Sa&&(clearInterval(Sa),Sa=null)}async function ya(){await ha(),await ba()}async function wa(){if(!(0,C.isSupabaseConfigured)()||'customer'===ve||ae.PITCH)return!1;try{ke();const{data:e}=await _e().auth.getSession();if(e.session){const{error:e}=await _e().auth.refreshSession();if(!e)return!0}if('display'===ve)return!1;if(!await T.kv.get(ra,null))return!1;if(e.session)try{await _e().auth.signOut({scope:'local'})}catch{}return'ok'===await da()&&(ya(),!0)}catch{return!1}}(0,d.setSessionMender)(wa);let va=o.VENUE_RID;async function ba(){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 e=va;try{if(he({mode:'connecting'}),await K.mutationQueue.load(),'customer'===ve)return void await Ra(e);const t=await T.kv.get(na,null);let a=await T.kv.get(ia,null);if(o.IS_ISOLATED_VENUE&&(t&&!(0,o.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,o.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await _e().auth.getSession();if('display'!==ve&&a&&!s.session){const t=await da();if('offline'===t)return he({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{va===e&&ya()},6e4);'refused'===t&&a.staffRef&&I.useSession.getState().meId===a.staffRef&&I.useSession.getState().signOut(),a=await T.kv.get(ia,null),({data:s}=await _e().auth.getSession())}const n='display'===ve?t:a;if(!s.session||!n)return void he({mode:'display'===ve?'unpaired':'signin',perms:[]});let i=[];try{const e=(await _a('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===ve?await T.kv.remove(na):(await T.kv.remove(ia),await T.kv.remove(ra)),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId===n.staffRef&&I.useSession.getState().signOut(),void he({mode:'display'===ve?'unpaired':'signin',perms:[],message:'display'===ve?'This display was unpaired by a manager.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,E.isOnline)()||/fetch|network/i.test(String(t?.message)))he({mode:'offline'});else if(ua(t)&&'display'!==ve){const{error:t}=await _e().auth.refreshSession();t&&'ok'===await da()&&setTimeout(()=>{va===e&&ya()},500)}i=Se.getState().perms}he({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),'staff'===n.kind&&n.staffRef&&I.useSession.getState().meId!==n.staffRef&&(I.useSession.getState().signIn(n.staffRef),J.useOwner.setState({staffAs:n.staffRef})),await Ia(n.venueId,e,n.kind)}catch(e){he({mode:'local',lastError:String(e?.message??e)})}}const ka=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 Ia(e,a,s){if(!(0,o.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');await Ta(a),Oe.push(Va(e));try{const{data:t}=await _e().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])et.set(e.key,e.id),tt.set(e.id,e.key)}catch{}const n=[St(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>J.useOwner.getState().staff.map(rt),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>ye('staff.manage'),deletes:!1,revision:e=>(0,x.staffRevision)(e,it()),toRow:(e,t)=>(0,x.staffRow)(e,t,it(),e.managerAccess||e.ownerAccess?null:et.get(at(e))),fromRow:e=>{if(!e.external_ref)return null;Ye.set(String(e.external_ref),String(e.id)),Xe.set(String(e.id),String(e.external_ref)),ja.set(String(e.external_ref),e.avatar_path??null);const t=nt(st(tt.get(String(e.role_id))),!0===e.manager_access);return(0,x.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},it())},apply:e=>J.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),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ha()},onRemote:()=>{Ha()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=J.useOwner.getState(),t=V.useSetup.getState().sites[va]?.staffGrade??{};return e.staff.filter(e=>Ye.has(e.id)).map(a=>Ee({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=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Ye.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=Xe.get(String(e.staff_id));return t?Ee({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=>J.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=V.useSetup.getState().sites[va],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&&V.useSetup.getState().patch(va,{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=J.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=V.useSetup.subscribe((t,a)=>{t.sites[va]?.staffGrade!==a.sites[va]?.staffGrade&&e()});return()=>{t(),a()}}},Te(a,!1),Te(a,!0),Me(a),Ke(a),Ne(a),qe(a),Pe(a),$e(a),Je(a),{name:'supplier_directory',table:'suppliers',list:()=>J.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,z.isUuid)(e.id),writable:()=>ye('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:Ee(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>J.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&(0,z.isUuid)(e.supplierId),writable:()=>ye('suppliers.order')||ye('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Ae(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Ee(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},je(a),Pa(a)];ye('wages.view')&&n.push($a(a)),'staff'===s&&(n.push(ut(),ct(),lt(),gt(a)),pt(e)),'staff'===s&&await Gt('staff_leave')&&(n.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>J.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,z.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Se.getState().staffRef&&'pending'===e.status||ye('rota.manage')),writable:()=>'staff'===Se.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:Ee(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>J.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>J.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),ka.add('staff_leave'),ft(e));const i='staff'===s&&await Xt();if(oe.useChatSync.setState({synced:i,checked:!0}),Oe.push(()=>oe.useChatSync.setState({synced:!1})),i&&n.push(It(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(de.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Xe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Ye.has(e.id),writable:()=>ye('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Ye.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Ye.get(e.id),include:e.include}),fromRow:e=>{const t=Xe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>de.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=>de.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Gt('hr_questions')&&(n.push(aa(a)),ka.add('hr_questions'),sa(e,a)),'guest'!==s&&await Gt('sold_out_items')?(n.push(Ht(a,await Gt('sold_out_items','auto'))),ka.add('sold_out_items')):le.autoSync.soldOutRead.add(a),'guest'!==s&&await Gt('sold_out_links')?(n.push(Vt(a)),ka.add('sold_out_links')):le.autoSync.linksRead.add(a),R.useReminders.getState().ensure(a),'guest'!==s&&await Yt()&&(n.push(At(a)),'staff'===s&&n.push(Ut(a))),Z.useNotifs.getState().ensure(a),X.useOrderLists.getState().ensure(a),'staff'===s){ze=await Gt('staff','nickname'),Ze=await Gt('staff','display_clock');const[e,t,s,i]=await Promise.all([Gt('scheduled_notifications'),Gt('order_lists'),Gt('venue_clock_area'),Gt('daily_tasks')]);ie.useDailyTasks.getState().ensure(a),i&&(n.push(Ft(a),Wt(a)),ka.add('daily_tasks'),ka.add('daily_task_ticks')),e&&(n.push(Lt(a)),Qt()),t&&n.push(Pt(a),$t(a),Bt(a)),s&&n.push(jt(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&ka.add(n)}if('guest'!==s&&await Gt('day_tips')){n.push(xt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])ka.add(e);await Gt('tips_pot_events')&&n.push(Kt(a),qt(a)),'staff'===s&&(n.push(Tt(a),Nt(a),Mt(a)),ka.add('cash_ups'),ka.add('sales_reports'),t(r[63])(r[62],r.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(n.push(ut(),ct()),await Gt('scheduled_notifications')&&n.push(Lt(a)));let d=!1;const u=()=>{const e=J.useOwner.getState().staff.find(e=>e.id===Se.getState().staffRef);return!!e&&e.active&&ye('recipes.edit')&&(0,m.costsAllowedFor)(e)};'staff'===s&&u()&&await Gt('ingredient_prices')&&(n.push((0,g.gpSyncSpec)('ing',u)),ka.add('ingredient_prices'),await Gt('card_costs')&&(n.push((0,g.gpSyncSpec)('card',u)),ka.add('card_costs'))),(0,me.specialsSyncOn)()&&'guest'!==s&&await Gt('specials_boards')&&(n.push((0,me.specialsBoardSpec)(a,()=>ye('recipes.edit')||ye('floor.manage')||ye('*'))),ka.add('specials_boards'));const c={onActivity:()=>he({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>he({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{he({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await _a('whoami')??[]).some(t=>t.venue_id===e))return void(va===a&&ya());for(const a of Ie){if(a.spec.name!==t)continue;const{count:s,error:n}=await _e().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())}};Ie=n.map(t=>new q.EntityBridge(t,e,c)),await Promise.all(Ie.map(e=>e.start()));const l=async()=>{if('staff'===s&&(0,E.isOnline)())try{const t=await _a('whoami');if(!t?.some(t=>t.venue_id===e))return void(va===a&&ya())}catch(e){if(ua(e)){const e=await da();return void('ok'!==e&&'refused'!==e||va===a&&ya())}}let t=0;for(const[a,s]of Ie.entries()){const i='chat'===n[a]?.name;try{await s.read(),t++,i&&(oe.useChatSync.getState().error&&oe.useChatSync.setState({error:void 0}),await Rt(e))}catch(e){const t=String(e?.message??e);if((i||/fetch|network|Failed/i.test(t))&&oe.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t?(he({mode:(0,E.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),K.mutationQueue.flush()):he({mode:'offline'}),!ye('wages.view')){const e=Se.getState().staffRef;J.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await l();const f=new Map;for(const e of Ie)f.set(e.spec.table,[...f.get(e.spec.table)??[],e]);const p=[...f.keys()].filter(e=>ka.has(e)).map(e=>({table:e,venueColumn:f.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,q.venueChannel)(e,p,(e,t,a)=>{for(const s of f.get(e)??[])s.remote(t,a);he({lastSyncAt:(new Date).toISOString()})},e=>{he({realtime:e}),'SUBSCRIBED'===e?(_&&l(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Oe.push(()=>{_e().removeChannel(S)}),Sa=setInterval(()=>{l()},6e4),Oe.push((0,E.onConnectivity)(e=>{e&&l()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...Se.getState(),queue:K.mutationQueue.pending.map(e=>e.table),failedTables:K.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const Oa='guest:sent:v1';async function Ra(e){he({kind:'guest',venueSlug:e,perms:[]});try{const t=(await _a('public_venue',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!o.IS_ISOLATED_VENUE||t.id===o.VENUE_UUID)){he({venueId:t.id,venueName:t.name}),await Ta(e);const a=t.app?.restaurant;a&&L.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,c.withWildingsAddress)({...a,id:e}):t)})),_t(e,t.app?.events)}await Aa(e),he({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{he({mode:(0,E.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Aa(e).catch(()=>{})},6e4);Oe.push(()=>clearInterval(t)),o.IS_ISOLATED_VENUE||await Ua(e)}async function Aa(e){const t=await _a('public_menu',{p_venue_slug:(0,u.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));F.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);if(!s)return t.signOff?{...t,signOff:null}:t;const n=s.updated_at?new Date(s.updated_at).toISOString():t.updatedAt;return{...t,photo:s.photo_url||void 0,signOff:t.signOff??{by:'Head chef',at:n}}})}))}const a=t.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));a.length&&L.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}})}async function Ua(e){let t=await T.kv.get(Oa,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=L.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,z.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await ma())return;for(const a of n)try{const s=(await _a('guest_create_booking',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_booking:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&L.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{await _a('guest_create_takeaway',{p_venue_slug:(0,u.queuedDatabaseSlug)(e),p_order:{...Ee(a),...(0,v.takeGuard)(a.id),allergies:Ce(a.allergies)}}),t={...t,[a.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},he({lastError:`Order: ${e?.message}`}))}await T.kv.set(Oa,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await _a('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await T.kv.set(Oa,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await _a('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));L.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??{},n={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return Da(n)===Da(e)?e:n})})),he({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{he({mode:(0,E.isOnline)()?Se.getState().mode:'offline'})}finally{a=!1}}};Oe.push(L.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),Sa=setInterval(()=>{n()},15e3),n()}const Da=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),Ca={bridges:()=>Ie,restart:ya},Ea='golive:v1:';async function Ta(e){'live'!==L.useStore.getState().clock.mode&&L.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)?await qa(e):(await T.kv.get(Ea+e,!1)||await qa(e),await T.kv.get(xa+e,!1)||(Ka(e),await T.kv.set(xa+e,!0)),await T.kv.get(Na+e,!1)||(Ma(),await T.kv.set(Na+e,!0)))}const Na='golive:v3:';function Ma(){const e=e=>JSON.stringify(e).includes('(example)');try{G.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 xa='golive:v2:';function Ka(e){const t=e=>JSON.stringify(e).includes('(example)');L.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)))})),J.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 qa(e){if(l.LIVE_VENUE_BUILD&&(0,l.isLiveVenue)(e)){const t=(0,f.stripCoreLiveSamples)(L.useStore.getState()),a=(0,G.stripKitchenExamples)(G.useKitchen.getState()),s=J.useOwner.getState(),n=(0,f.stripOwnerLiveSamples)(s),i={accidents:Q.useSafety.getState().accidents.filter(e=>!(0,Q.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(L.useStore.getState(),t)&&(await(0,p.archiveChefCache)('core',L.useStore.getState()),L.useStore.setState(t)),r(G.useKitchen.getState(),a)&&(await(0,p.archiveChefCache)('kitchen',G.useKitchen.getState()),G.useKitchen.setState(a)),r(s,n)&&(await(0,p.archiveChefCache)('owner',s),J.useOwner.setState(n)),r(Q.useSafety.getState(),i)&&(await(0,p.archiveChefCache)('safety',Q.useSafety.getState()),Q.useSafety.setState(i));const o=(0,O.stripHrSamples)(O.useHr.getState());r(O.useHr.getState(),o)&&(await(0,p.archiveChefCache)('hr',O.useHr.getState()),O.useHr.setState(o));const d=(0,g.stripGpSamples)(g.useGpCalc.getState());r(g.useGpCalc.getState(),d)&&(await(0,p.archiveChefCache)('gp',g.useGpCalc.getState()),g.useGpCalc.setState(d));const u=W.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,p.archiveChefCache)('order-sheets',u),W.useOrderSheets.setState(c));const m=F.useCardStore.getState(),_={cards:m.cards.filter(e=>!(0,l.isLiveVenue)(e.restaurantId)||!(0,S.isDemoCard)(e)),log:m.log.filter(e=>!(0,S.demoActor)(e.by))};return r(m,_)&&(await(0,p.archiveChefCache)('recipe-cards',m),F.useCardStore.setState(_)),void await T.kv.set(Ea+e,!0)}const t=t=>t.restaurantId===e&&!(0,z.isUuid)(t.id);L.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)))})),$.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,z.isUuid)(t.id))})),B.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),J.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,z.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,z.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,z.isUuid)(e.id)),leave:e.leave.filter(e=>(0,z.isUuid)(e.id)),swaps:[]}));try{G.useKitchen.setState(e=>(0,G.stripKitchenExamples)(e))}catch{}J.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,z.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,z.isUuid)(e.id)&&(0,z.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 T.kv.set(Ea+e,!0)}const La=(e,t)=>Ee({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Pa(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(B.useFloor.getState().live[e]??{}).map(([e,t])=>La(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Se.getState().kind||ye('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:Se.getState().staffRef??ve}),fromRow:e=>La(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>B.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>B.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function $a(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(V.useSetup.getState().sites[e]?.grades??V.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:()=>ye('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=V.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));V.useSetup.getState().patch(e,{grades:i})},subscribe:t=>V.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ba='staff-avatars',ja=new Map;let Fa=!1;const Wa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ha(){if(!Fa){Fa=!0;try{for(const[e,t]of ja){const a=H.useAvatars.getState().photos[e];if(!t){a?.path&&H.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Se.getState().staffRef)continue;const{data:s,error:n}=await _e().storage.from(Ba).download(t);if(n||!s)continue;const i=await Wa(s);i.startsWith('data:image/')&&H.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Fa=!1}}}function Va(e){const t=async()=>{const t=Se.getState().staffRef,a=t?Ye.get(t)??Se.getState().staffUuid:void 0;if(!t||!a||'staff'!==Se.getState().kind)return;const s=H.useAvatars.getState().photos[t];try{const n=ja.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&_e().storage.from(Ba).remove([t]).catch(()=>{})};if(!s)return void(n&&(await _a('set_staff_avatar',{p_staff_ref:t,p_path:null}),ja.set(t,null),i(n)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void he({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 _e().storage.from(Ba).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await _a('set_staff_avatar',{p_staff_ref:t,p_path:d}),ja.set(t,d),n!==d&&i(n),H.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){he({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:H.useAvatars.getState().photos},s=H.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),ye('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Se.getState().staffRef){const e=s[t].path;ja.set(t,null),_a('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>_e().storage.from(Ba).remove([e])).catch(()=>{})}});return t(),s}const Ga=new Map,Qa=(0,U.create)(()=>({n:0}))},985,[5,930,6,801,806,802,807,986,988,989,804,991,993,994,995,996,13,997,998,1001,1002,815,931,974,1003,975,1004,1008,1009,1007,1010,800,846,1011,1014,981,857,1016,924,925,1018,1019,865,839,1021,1024,1025,1026,1027,2,1028,1029,1030,1031,1032,1033,977,979,858,832,828,1034,1037,1038]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=O,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return b}}),_e.useGpCalcView=function(){const e=b();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...O(e)}:e,[e])},Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return v}}),_e.gpSyncItems=E,_e.gpSyncFromRow=P,_e.mergeGpItems=w,_e.gpSyncSpec=function(e,t){const i='ing'===e?'ingredient_prices':'card_costs';return{name:i,table:i,deletes:!1,list:()=>E(b.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:C(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>P(e,t),apply:(t,i)=>b.setState(n=>w(n,e,t,i)),subscribe:t=>b.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i.cardCosts===n.cardCosts)||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),r=(e=a)&&e.__esModule?e:{default:e},d=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,t,i,n,s,a=0,r=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:a,allergens:r}),m=e=>new Date(Date.now()-864e5*e).toISOString(),S={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},k=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...h('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...h('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(S[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:m(7*(i.length-t))}))})),y=(e,t,i,n,s,a,r,d="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:a,status:r,description:d,allergens:[]}),I=[y('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),y('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),y('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),y('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),y('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),y('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function O(e){const t=e=>I.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),a=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),r=e=>{const t=k.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},d=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(d).forEach(e=>e.lines.forEach(e=>a.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>a.has(e.id)||!r(e)),cardCosts:d}}const b=(0,d.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:k,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),a=n.ingredients.map(e=>e.id===t.id?t:e);let r=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,a,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(d(t)-d(s))/d(s)*100;i.length&&(r=[{id:f('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...r].slice(0,20))}const d=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:d?a.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):a,alerts:r})},addPricePaid:(e,t,n)=>{const s=i(),a=s.ingredients.find(t=>t.id===e);if(!(a&&t>0))return;const r=[...a.prices?.length?a.prices:[{p:a.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),d={...a,prices:r};i().saveIngredient({...d,packPrice:(0,o.costingPrice)(d,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=f('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)}))}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>r.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...O({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&b.persist.rehydrate()});const v='1970-01-01T00:00:00.000Z',C=e=>JSON.parse(JSON.stringify(e));function E(e,t){const i=O(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??v,doc:C({...e,updatedAt:e.updatedAt??v})})):Object.entries(i.cardCosts).map(([e,t])=>({id:e,updatedAt:t.updatedAt??v,doc:C({...t,updatedAt:t.updatedAt??v})})),s=new Set(n.map(e=>e.id)),a=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...a]}function P(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('card'!==e||Array.isArray(s.lines))?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function w(e,t,i,n){const s={...e.gone??{}},a=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e.cardCosts??{})),r=[];for(const e of i){const i=`${t}:${e.id}`,n=a.get(e.id),d=n?n.updatedAt??v:void 0,c=s[i];if(e.deletedAt){if(n&&d>e.deletedAt)continue;a.delete(e.id),(!c||ce.updatedAt)continue;if(n&&d>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?a.set(e.id,o):r.push([e.id,o]),delete s[i]}for(const e of n)a.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...a.values(),...r.map(([,e])=>e)],gone:s}}return{cardCosts:Object.fromEntries([...a.entries(),...r]),gone:s}}},986,[806,34,807,5,808,815,818,987,832,839]); __d(function(_g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return i}}),e.priceStats=c,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return o}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return l}}),e.convert=function(t,n,i){const c=u[n],o=u[i];return c&&o&&c.dim===o.dim?t*c.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return d}}),e.perBaseUnit=function(t){const n=u[t.packUnit];if(!(n&&t.packSize>0))return null;const i=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/i*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/i*1e3,per:'litre'}:{pence:t.packPrice/i,per:'item'}},Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return g}}),e.lineCost=m,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return p}}),e.suggestAllergens=function t(n,i,c=[],o=0){const s=new Set;for(const u of n.lines)if(u.ingId.startsWith('dish:')){const n=c.find(t=>t.id===u.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>s.add(t)),t(n,i,c,o+1).forEach(t=>s.add(t)))}else i.find(t=>t.id===u.ingId)?.allergens?.forEach(t=>s.add(t));return[...s]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:h(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return S}}),e.suggestForMultiple=function(t,n,i,c,o){const s=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?b(Math.ceil(s)):Math.ceil(s)},e.amountLabel=k,e.cardCostSummary=function(t,n,i,c){const o=(t?.lines??[]).map(t=>{const i=n.find(n=>n.id===t.ingId);return{line:t,name:i?.name??'Removed ingredient',cost:m(t,n),label:k(t,i)}}),s=o.reduce((t,n)=>t+n.cost,0),u=Math.max(1,t?.portions||1),a=s/u,l=t?.target??i.defaultTarget??70,f=a>0?y(a,l,i.vatPct,i.pricePoints):null,d=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,g=d??(c&&c>0?c:f),p=g&&a>0?P(a,g,i.vatPct):null;return{lines:o,batch:s,perPortion:a,target:l,suggested:f,price:g,priceIsSuggested:!(d||c&&c>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,l):null,missing:o.filter(t=>t.cost<=0).length}};var t=r(_d[0]);const n=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],i=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function c(t,n=5){const c=i(t),o=c.slice(-Math.max(1,n)),s=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:s,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",i=5)=>'average'===n?c(t,i).avg:c(t,i).latest;const s={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},u={kg:{dim:'mass',f:s.kg},g:{dim:'mass',f:s.g},oz:{dim:'mass',f:s.oz},lb:{dim:'mass',f:s.lb},stone:{dim:'mass',f:s.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=['kg','g','stone','lb','oz','L','ml','each'],l=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const f=(t,n)=>[...'mass'===u[t].dim?['g','kg','oz','lb']:'vol'===u[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],d=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;const g=(t,n)=>{const i=(t?.servingName||'serving').trim().toLowerCase();return 1===n?i:/(s|sh|ch|x)$/.test(i)?`${i}es`:`${i}s`};function m(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?p(o,n,i,c+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=d(o);return null==n?0:t.qty*n}const s=u[o.packUnit],a=u[t.unit];if(!a||s.dim!==a.dim)return 0;const l=o.packPrice/(o.packSize*s.f),f=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*a.f*l/(1-f/100)}const p=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+m(o,n,i,c),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,i){const c=h(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}}function b(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}function y(t,n,i,c){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+i/100);return c?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const S=t=>`${t.toFixed(1)}x`;function k(t,n){const i=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${i} ${g(n,t.qty)}`:'each'===t.unit?`${i} ${1===t.qty?'item':'items'}`:`${i} ${l(t.unit,t.qty)}`}},987,[982]); __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 f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});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:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},988,[]); @@ -1088,7 +1088,7 @@ __d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1006,[975]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1007,[1003,975,1008]); -__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1008,[1003]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1009,[]); __d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return v}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class v{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=c(t),this.saveKnown())})}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=s.get(e);if(!this.pending(e)){if(f){const t=c(f);if(this.rev(f)===this.rev(h)){this.known[e]=l,t!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(h),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,h.length>l&&!f)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||e.syncable(s)&&e.writable()&&this.known[n]!==t&&!this.pending(n)&&this.write(s)}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1010,[1005,931,1003,975,1007]); __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 b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);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??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`: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}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},1011,[829,808,839,815,818,827,1012,1013]); @@ -1122,7 +1122,7 @@ __d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},1038,[1039]); __d(function(g,r,i,a,m,e,d){function n(n,t){const o=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o,s){const u=()=>r.importAll(t,s);{const l=o?.[String(t)];if(Array.isArray(l)){const c=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(c?.isReady?.(l))return u();const f=n(t,o);if(null!=f)return f.then(u);throw new Error(`Cannot import module ${s??t}: the async bundle loader is unavailable. Load the initial Expo bundle before importing these chunks: ${l.join(', ')}`)}try{return u()}catch(s){const l=n(t,o);if(null!=l)return l.then(u);throw s}}const l=n(t,o);return null!=l?l.then(u):u()}function o(n,o,s){const u=t(n,o,s),l=Promise.resolve(u);return l._result=u,l}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},1039,[]); __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)},1040,[34]); __d(function(_g,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,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return p}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[w,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(p,Math.ceil(f.w)+4),j=e&&l>0&&l-2*vu(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.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 t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const w=()=>f(e=>e.layers.some(e=>e.own)),p=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1041,[34,236,402,102,815,840,794,1040,25]); -__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.120'},1042,[]); +__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.121'},1042,[]); __d(function(_g,_r,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'},1043,[796,991,34,379,402,102,794,840,1021,1022,865,1025,1026,1027,992,1044,985,1045,994,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1044,[]); __d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1045,[1046,931,985,846]); @@ -1179,7 +1179,7 @@ __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return z}}),_e.useTableNames=B,_e.resetTableLive=N,_e.seatBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'seated'),N(e,t.table)},_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=M,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return F}}),_e.TablePicker=A,_e.WalkInSheet=R,_e.AssignTableSheet=W,_e.undoNotice=E,_e.NewBookingSheet=_,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[n,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,O.jsxs)(O.Fragment,{children:[s?(0,O.jsx)(R,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:E}):null,l?(0,O.jsx)(_,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,i.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,O.jsx)(W,{booking:n.b,combine:n.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),O=_r(_d[27]);const z=Array.from({length:12},(e,t)=>String(t+1));function B(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function N(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function M(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=B(e),a=(0,S.useFloor)(t=>t.live[e])??{},n=(0,S.usePlan)(e),i=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(i,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[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,S.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,x.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 F=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function A({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=n?6:8,y=n?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(i??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,O.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],i=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!i,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,O.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:i?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,O.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,O.jsx)(T.T,{weight:"bold",size:22,colour:i?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,O.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,O.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,O.jsx)(T.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const L=[1,2,3,4,5,6,7,8];function R({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:y,r:w,now:C}=(0,p.useCtx)(15e3),D=M(y,C),[I,$]=(0,r.useState)(2),[P,z]=(0,r.useState)(!1),[B,F]=(0,r.useState)(i??null),R=(0,S.usePlan)(y),W=(0,f.useBookings)(y),E=(0,v.useBlocks)(e=>e.blocks),_=(0,v.closedAreasAt)(E,y,(0,x.ymd)(C),(0,x.hm)(C)),H=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(D).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(R,W.filter(e=>e.date===(0,x.ymd)(C)),e,I,C,(0,k.turnFor)(I,w.settings.turnMins),90,void 0,{closed:_})?.table??null},[R,W,D,I,_.size,C.getTime()]);(0,r.useEffect)(()=>{B&&(0,S.tablesOf)(B).some(e=>'Closed'===D[e]?.label)&&F(null)},[B,_.size]);const[U,q]=(0,r.useState)(!1),[V,Y]=(0,r.useState)(''),G=(e,t=String(e),s=()=>{z(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,O.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,O.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},K=(0,O.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),Q=(0,O.jsxs)(b.default,{style:{gap:8,width:n?256:void 0},children:[(0,O.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,O.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[L.map(e=>G(e)),G(9,'9+',()=>{z(!0),$(e=>e>=9?e:9)})]}),P?K:null]}),[X,J]=(0,r.useState)(!1),Z=async(t=B)=>{if(!X){J(!0);try{const s=await f.repo.bookings.seatWalkIn(y,I,t??void 0,V);N(y,t??void 0),a(s),e()}finally{J(!1)}}},ee=(0,O.jsxs)(b.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,O.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,O.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),B?(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>F(null)}):null]}),(0,O.jsx)(A,{use:D,value:B,onPick:e=>{D[e]&&!D[e].busy?Z(e):F(B===e?null:e)},big:n,dense:n,best:H,bestSet:(0,u.bestTables)(R)}),(0,O.jsxs)(T.Muted,{children:["Tap a free table to seat them there",H&&!B?` (suggested for ${I}: ${(0,l.tableNumbers)(H)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(C)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,O.jsx)(T.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${B?` \xb7 ${(0,l.tableNumbers)(B)}`:''}`,disabled:X,onPress:()=>{Z()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,O.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[Q,ee]}):(0,O.jsxs)(O.Fragment,{children:[Q,ee]}),(0,O.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[U?(0,O.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,O.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>q(!0)}),(0,O.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,O.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function W({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,p.useCtx)(15e3),i=M(o,n),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(n)),t,e.partySize,n,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,n.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),B=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&N(o,l),t()},R=C?(0,O.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,O.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,O.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,O.jsx)(b.default,{testID:"combine-short",children:(0,O.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,O.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>L(I)}),(0,O.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,O.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,O.jsx)(T.T,{size:15,colour:j.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,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${F(e)}`,testID:"assign-table-sheet",footer:R,children:[v&&!C?(0,O.jsx)(b.default,{testID:"assign-suggested",children:(0,O.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,O.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,O.jsx)(A,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await L([e])}})]})}function E(e){(0,i.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${F(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function _({date:e,onClose:t,wide:i,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:B}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,F]=(0,r.useState)(ee.blocks),[R,W]=(0,r.useState)(!1),[E,_]=(0,r.useState)(''),[H,U]=(0,r.useState)(2),[q,V]=(0,r.useState)(null),[Y,G]=(0,r.useState)(''),[K,Q]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ne=(0,S.usePlan)(u),ie=(0,P.dogSetUp)(ne),re=!0===te.dog&&ie,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(H,c.settings.turnMins),be=A.filter(e=>e.date===M),ge=e=>(0,k.freeTablesAt)(ne,be,H,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(L,u,M,e)}),he=re&&q?ge(q):[];(0,r.useEffect)(()=>{ae(null)},[re,q,H]);const pe=(0,y.bookingSlots)(c,ue,e=>A.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),H,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0)),me=(0,w.ukPhone)(K),[fe,ye]=(0,r.useState)(!1),ke=q?pe.find(e=>e.time===q):void 0,xe=ke&&ke.left=2&&!!q&&(!xe||fe)&&(0,o.validParty)(H)&&me.ok&&(0,w.emailOk)(X)&&(!je||we&&R)&&(!re||he.length>0)&&!Te,ve=te.wheelchair>0||te.stepFree;return(0,O.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:i?760:void 0,testID:"booking-sheet",children:[(0,O.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:H,audience:"staff"}),te.dog&&!ie?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(F(e),V(null),W(!1))}}),(0,O.jsxs)(T.Row,{gap:6,children:[(0,O.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,O.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,O.jsx)(T.Field,{label:"Name",value:E,onChangeText:_,placeholder:"e.g. Reid",testID:"nb-name"}),(0,O.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:K,onChangeText:Q,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&K?(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,O.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,O.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,O.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(T.T,{center:!0,children:"Covers"}),(0,O.jsx)(s.PartySizeInput,{value:H,onChange:e=>{U(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!ge(e.time).length||!(0,D.dogTimeOk)(c,A,M,e.time,de);return(0,O.jsx)(T.Chip,{label:e.time,sub:(0,v.blockAt)(L,u,M,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':e.left>0?`${e.left} left`:'Full',disabled:(e.past??!e.available)||t,selected:q===e.time,onPress:()=>{V(e.time),W(!1),ye(!1)}},e.time)})}),xe?(0,O.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(H,xe.left,xe.time)}),(0,O.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&q?(0,O.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,O.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,O.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ne.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),he.length?(0,O.jsx)(T.Row,{wrap:!0,gap:6,children:he.slice(0,10).map((e,t)=>(0,O.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${ve&&(0,P.accessibleSetUp)(ne)&&!(0,P.isAccessible)(ne,e.table)?' \xb7 not step-free':''}`,selected:(le??he[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",H," at ",q,". Try another time."]})]}):null,je?(0,O.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,O.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",je.from,"\u2013",je.to,je.reason?` (${je.reason})`:'']}),we?(0,O.jsx)(T.Chip,{label:R?'Manager override on':'Override and book anyway',selected:R,onPress:()=>W(e=>!e)}):(0,O.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,O.jsx)(b.default,{testID:"nb-closed",children:(0,O.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,O.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:H,date:M,time:q,today:(0,x.ymd)(h),bookings:A,audience:"staff",showTables:!1!==c.settings.tableRequests}),ve&&!(0,P.accessibleSetUp)(ne)?(0,O.jsx)(T.T,{size:13,colour:j.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,O.jsx)(T.Field,{label:"Notes (optional)",value:Y,onChangeText:G,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,n.depositDue)((0,n.depositOf)(c.settings),H)?(0,O.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(c.settings),H))," (",(0,a.gbp)((0,n.depositOf)(c.settings).perPersonPence)," per person for ",(0,n.depositOf)(c.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,O.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),Te?(0,O.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",q,". Try another time: dogs are very welcome then."]}):null,(0,O.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Se,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||he.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:H,date:M,time:q,notes:Y.trim(),security:(0,n.depositDue)((0,n.depositOf)(c.settings),H)?'deposit':'none',depositPaid:0,...(0,n.depositDue)((0,n.depositOf)(c.settings),H)?{depositDue:(0,n.depositDue)((0,n.depositOf)(c.settings),H),depositPolicy:(0,n.depositWords)((0,n.depositOf)(c.settings),H,c.name).join(' '),depositRefundable:(0,n.depositOf)(c.settings).refundable,depositCutoffHours:(0,n.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===q)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??he[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,B)).catch(()=>{}),d?.({date:M,time:q,name:E.trim()}),t()}})]})}},1096,[796,1097,1098,829,836,14,1099,34,828,402,102,846,1100,848,1104,1079,827,840,833,794,1014,1011,1105,1106,1111,1081,1075,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1097,[34,402,412,102,1098,840,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const f=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(f)?f:u))},f=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),b=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`},1098,[]); -__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{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]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); +__d(function(g,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=k,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(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]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!f||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(s.default,{...h('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:l?`${12+l}px`:'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])),s=e(r(d[4])),l=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,w=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function k({a:e,onDone:t,big:o}){const s=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'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?y.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?y.ink:'danger'===s?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,l.default)(),z=e.actions??[];return(0,b.jsxs)(s.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:w(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(s.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)(s.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)(s.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]}),z.length||S?null:(0,b.jsx)(k,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,z.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:z.map(e=>(0,b.jsx)(k,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},1099,[34,236,402,295,102,426,840,794,994,25]); __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 c.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return c.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return D}}),_e.useShiftManager=b,_e.useSignedIn=h,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(w),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),c=h(),m=o||'staff'===s.APP_VARIANT,y=(0,t.useContext)(D),O=b(),S=m?y&&O?'manager':'staff':c?p(i,l(c)):i,M=(0,r.useOwner)(e=>e.staff),A=(0,n.useRestaurant)(u),P=(0,n.useNow)(e),I=c?c.id:m&&f?f:d[S],R=M.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:A,now:P,role:S,me:R,meId:I,today:(0,a.venueYmd)(P),signedIn:!!c}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return S}}),_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()-O(n));const c=(0,a.ymd)(f),d=(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===O(t)&&e.date>=c&&e.date<=d&&!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,c=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,...c})})}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 M}}),_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()-O(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=h(),t=(0,r.useOwner)(e=>e.hourly);return e?t:A};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]),c=_r(_d[10]);const d={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=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,p=(e,t)=>m[e]>m[t]?t:e,w=(0,t.createContext)(!1),y=()=>(0,t.useContext)(w),D=(0,t.createContext)(!1);function b(){const e=(0,t.useContext)(w)||'staff'===s.APP_VARIANT,n=h(),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 h(){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 O=e=>(e.getDay()+6)%7,S=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const M=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const A={}},1100,[806,34,848,865,827,846,985,1101,997,15,1103]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); __d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[1103]); @@ -1222,7 +1222,7 @@ __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listScores=o,_e.submitScore=async function(e,t){const f=r.useSync.getState(),l=Math.max(0,Math.round(Number(t.score)||0));if(c()&&f.staffRef&&t.staffId===f.staffRef)try{const{data:r,error:s}=await a().from('game_scores').insert({venue_id:f.venueId,game:'lenny',level_id:e,staff_ref:f.staffRef??null,name:String(t.name||'Crew').replace(/\s+/g,' ').trim().slice(0,24),character_id:t.characterId??null,score:l,stars:Math.max(0,Math.min(3,Number(t.stars)||0)),stats:{...t.stats??{},badges:t.badges??[],character:t.character??null}}).select('id').single();if(s)throw s;const{count:n}=await a().from('game_scores').select('id',{count:'exact',head:!0}).eq('venue_id',f.venueId).eq('game','lenny').eq('level_id',e).gt('score',l);return{rank:(n??0)+1,entries:await o(e,10),id:r.id}}catch{}const u=await s.kv.get(n,{}),y=[...u[e]??[],{...t,score:l,date:(new Date).toISOString()}].sort((e,t)=>t.score-e.score).slice(0,50);return await s.kv.set(n,{...u,[e]:y}),{rank:y.findIndex(e=>e.score===l)+1,entries:y.slice(0,10),id:null}},_e.loadProgress=async function(e){if(!e)return null;const t=r.useSync.getState();if(l(e))try{const{data:r,error:s}=await a().from('game_progress').select('progress').eq('venue_id',t.venueId).eq('game','lenny').eq('staff_ref',e).maybeSingle();if(s)throw s;if(r)return v(r.progress)}catch{}return v((await s.kv.get(f,{}))[e])},Object.defineProperty(_e,"LENNY_LAST_WORLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LENNY_LEVELS",{enumerable:!0,get:function(){return y}}),_e.cleanProgress=v,_e.saveProgress=async function(e,t){const n=v(t);if(!e||!n||JSON.stringify(n).length>16e3)return;const c=await s.kv.get(f,{});await s.kv.set(f,{...c,[e]:n});const o=r.useSync.getState();if(l(e))try{await a().from('game_progress').upsert({venue_id:o.venueId,game:'lenny',staff_ref:e,progress:n,updated_at:(new Date).toISOString()},{onConflict:'venue_id,game,staff_ref'})}catch{}};var e=_r(d[0]),t=_r(d[1]),r=_r(d[2]),s=_r(d[3]);const a=()=>(0,e.getSupabase)(),n='lenny:scores:v1',c=()=>(0,t.isSupabaseConfigured)()&&!!r.useSync.getState().venueId&&'staff'===r.useSync.getState().kind;async function o(e,t=10){if(c())try{const{data:s,error:n}=await a().from('game_scores').select('*').eq('venue_id',r.useSync.getState().venueId).eq('game','lenny').eq('level_id',e).order('score',{ascending:!1}).limit(t);if(n)throw n;return(s??[]).map(e=>({name:e.name,staffId:e.staff_ref,characterId:e.character_id??void 0,character:e.stats?.character,score:e.score,stars:e.stars,badges:e.stats?.badges??[],stats:e.stats,date:e.created_at}))}catch{}return((await s.kv.get(n,{}))[e]??[]).sort((e,t)=>t.score-e.score).slice(0,t)}const f='lenny:progress:v1',l=e=>{const t=r.useSync.getState();return c()&&!!t.staffRef&&e===t.staffRef};const u='festival',y=['mop','dsoap','dish','dtower','dscrub','mussels','ppeel','pfifo','bin1','bin2','bin3','mothersday','bin4','creel1','creel2','dsundae','dplate','pass','rush','delivery','death','line','steak','festival'];function v(e){if(!e||'object'!=typeof e||Array.isArray(e))return null;const t=e,r=e=>('string'==typeof e||'number'==typeof e)&&String(e).length>0&&String(e).length<=60?String(e):null,s={};if(t.stars&&'object'==typeof t.stars&&!Array.isArray(t.stars))for(const[e,a]of Object.entries(t.stars).slice(0,300)){const t=r(e),n=Math.max(0,Math.min(3,Math.floor(Number(a)||0)));t&&(s[t]=n)}const a={},n=t.badges;if(Array.isArray(n))for(const e of n.slice(0,100)){const t=r(e);t&&(a[t]=!0)}else if(n&&'object'==typeof n)for(const[e,t]of Object.entries(n).slice(0,100)){const s=r(e);s&&t&&(a[s]=!0)}const c={stars:s,badges:a,charactersUnlocked:!0===t.charactersUnlocked};return'number'==typeof t.v&&Number.isInteger(t.v)&&t.v>=0&&t.v<=9999&&(c.v=t.v),Array.isArray(t.legacyWorlds)&&t.legacyWorlds.length<=50&&t.legacyWorlds.every(e=>null!==r(e)&&'string'==typeof e)&&(c.legacyWorlds=[...t.legacyWorlds]),c}},1139,[931,974,985,975]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useSuggestions=j,_e.OrdersScreen=function({focus:e}={}){const[s,t]=(0,n.useState)('sheets');return(0,x.jsxs)(l.default,{style:{gap:12},children:[(0,x.jsx)(y.Seg,{value:s,onChange:t,options:[{id:'sheets',label:'Order sheets'},{id:'suggested',label:'Suggested orders'},{id:'history',label:'Order history'}]}),'sheets'===s?(0,x.jsx)(m.OrderSheets,{focus:e}):'suggested'===s?(0,x.jsx)(w,{}):(0,x.jsx)($,{})]})};var s=r(_d[0]),t=r(_d[1]),n=r(_d[2]),i=e(r(_d[3])),l=e(r(_d[4])),d=r(_d[5]),o=r(_d[6]),u=r(_d[7]),c=r(_d[8]),h=r(_d[9]),p=r(_d[10]),y=r(_d[11]),f=r(_d[12]),m=r(_d[13]),x=r(_d[14]);const b=(e,s)=>'kg'===s?Math.ceil(2*e)/2:Math.ceil(e);function j(){const{k:e,now:s,rid:n}=(0,y.useChef)(6e4),{pct:i}=(0,y.useForecast)(),l=(0,u.supplierView)('chef',(0,o.useOwner)(e=>e.suppliers)).filter(e=>!e.archived),d=1+Math.max(0,i)/100;return l.map(i=>{const l=e.ingredients.filter(e=>e.supplierId===i.id).map(e=>({i:e,qty:(0,t.fishInStone)(n,e)?(0,t.fromStone)(Math.ceil(2*(0,t.toStone)(Math.max(0,e.par*d-e.onHand),e.unit))/2,e.unit):b(Math.max(0,e.par*d-e.onHand),e.unit)})).filter(e=>e.qty>0),o=(0,p.weekday)(s),u=i.orderDays.includes(o),[c,h]=(i.cutoff||'23:59').split(':').map(Number),y=new Date(s);y.setHours(c,h,0,0);const f=e.orders.some(e=>e.supplierId===i.id&&new Date(e.at).toDateString()===s.toDateString()),m=[1,2,3,4,5,6,7].map(e=>(o+e)%7).find(e=>i.orderDays.includes(e));return{s:i,lines:l,ordersToday:u,cutPassed:s>y,placedToday:f,nextDay:m,total:Math.round(l.reduce((e,s)=>e+s.qty*s.i.cost,0))}}).filter(e=>e.lines.length||e.ordersToday)}function w(){const{me:e,rid:o}=(0,y.useChef)(),{label:u,covers:m,enough:b,booked:w}=(0,y.useForecast)(),$=(0,f.useKitchen)(e=>e.addOrder),S=j(),[C,M]=(0,n.useState)({}),[O,k]=(0,n.useState)('');return(0,x.jsxs)(l.default,{style:{gap:10},children:[(0,x.jsxs)(d.Muted,{children:[b?`Built from par levels and today's forecast (${m} Covers, ${u} vs a typical day).`:`Built from par levels (no forecast yet: not enough history; ${w} Covers booked so far).`," Adjust, then call the supplier or use their ordering website. Nothing is sent by CoverCharge."]}),O?(0,x.jsx)(d.Banner,{kind:"success",title:"Saved to order history",children:O}):null,S.map(({s:n,lines:u,ordersToday:y,cutPassed:f,placedToday:m,nextDay:b,total:j})=>{const w=u.map(e=>({...e,q:C[`${n.id}:${e.i.id}`]??e.qty})),S=Math.round(w.reduce((e,s)=>e+s.q*s.i.cost,0)),O=s=>{$({supplierId:n.id,by:e,status:s,lines:w.filter(e=>e.q>0).map(e=>({ing:e.i.id,qty:e.q,cost:e.i.cost})),total:S}),k(`${n.name}: ${(0,c.gbp)(S)} (${s}).`)};return(0,x.jsxs)(d.Card,{highlight:!y||m||f?void 0:h.colours.gold,children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{weight:"semibold",children:n.name}),(0,x.jsxs)(d.Muted,{children:[n.category," \xb7 min order ",(0,c.gbp)(n.minOrder)]})]}),m?(0,x.jsx)(d.Badge,{kind:"ok",label:"ORDERED TODAY"}):y?(0,x.jsx)(d.Badge,{kind:f?'red':'amber',label:f?`CUT-OFF ${n.cutoff} PASSED`:`ORDER BY ${n.cutoff}`}):(0,x.jsx)(d.Badge,{label:`NEXT ${null!=b?p.DAY3[b].toUpperCase():'\u2014'}`})]}),w.length?w.map(e=>(0,x.jsxs)(d.Row,{wrap:!0,style:{justifyContent:'space-between'},children:[(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(d.T,{size:14,children:e.i.name}),(0,x.jsxs)(d.Muted,{children:["On hand ",(0,s.ingredientQty)(o,e.i,e.i.onHand)," \xb7 par ",(0,s.ingredientQty)(o,e.i,e.i.par)]})]}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone less':'Less'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,-1)}))}),(0,x.jsx)(l.default,{accessible:!0,accessibilityLabel:(0,s.ingredientSpeech)(o,e.i,e.q),children:(0,x.jsx)(d.T,{size:16,style:{minWidth:76,textAlign:'center'},children:(0,s.ingredientQty)(o,e.i,e.q)})}),(0,x.jsx)(d.Button,{small:!0,kind:"ghost",label:"More",accessibilityLabel:`${(0,t.fishInStone)(o,e.i)?'Half a stone more':'More'} ${e.i.name}`,onPress:()=>M(s=>({...s,[`${n.id}:${e.i.id}`]:(0,t.stepQuantity)(o,e.i,e.q,1)}))})]},e.i.id)):(0,x.jsx)(d.Muted,{children:"Everything is at par."}),w.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(d.T,{weight:"semibold",children:["Estimated ",(0,c.gbp)(S)]}),S{i.default.openURL(`tel:${n.phones[0].replace(/\s/g,'')}`).catch(()=>{}),O('placed (by phone)')}}):null,n.website?(0,x.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open website",onPress:()=>{i.default.openURL(n.website).catch(()=>{}),O('placed (on website)')}}):null]})]}):null,void 0]},n.id)})]})}function $(){const{k:e,rid:t}=(0,y.useChef)(),n=(0,o.useOwner)(e=>e.suppliers);return(0,x.jsx)(l.default,{style:{gap:8},children:e.orders.map(i=>(0,x.jsxs)(d.Card,{children:[(0,x.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(d.T,{weight:"semibold",style:{flex:1},children:n.find(e=>e.id===i.supplierId)?.name}),(0,x.jsx)(d.Badge,{kind:"neutral",label:i.status.toUpperCase()})]}),(0,x.jsxs)(d.Muted,{children:[new Date(i.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",i.by,i.total?` \xb7 ${(0,c.gbp)(i.total)}`:'']}),i.lines.length?(0,x.jsx)(d.Muted,{children:i.lines.map(n=>{const i=e.ingredients.find(e=>e.id===n.ing);return`${(0,s.ingredientQty)(t,i??{name:n.ing,unit:''},n.qty)} ${i?.name??n.ing}`}).join(', ')}):null]},i.id))})}},1140,[1129,982,34,379,102,794,865,988,836,840,1100,1124,1018,1141,25]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.openLink=j,_e.useSheetReminders=T,_e.OrderSheets=function({focus:e}){const{rid:t,now:l}=(0,x.useChef)(3e4),o=(0,u.useSheets)(t).filter(e=>(0,n.chefCanSee)(t,e)&&!e.placeholder),[h,c]=(0,s.useState)(e??null),p=T(),f=(0,b.wd)(l);return(0,y.jsxs)(d.default,{style:{gap:10},testID:"order-sheets",children:[(0,y.jsx)(i.Banner,{kind:"info",title:"Nothing is sent for you",children:"Text, WhatsApp and phone orders open your phone\u2019s own app with the order already written. Check it, then press Send yourself."}),p.map(e=>(0,y.jsx)(r.default,{accessibilityRole:"button",onPress:()=>c(e.supplierId),children:(0,y.jsxs)(i.Banner,{kind:'red'===e.tone?'danger':'warn',title:`\u23f0 ${e.text}`,children:["Tap to open the ",e.name," order sheet."]})},e.supplierId)),(0,y.jsxs)(i.Muted,{children:["Today is ",b.DAYS[f],". Edit suppliers in Managers \u203a Settings \u203a Supplier order sheets."]}),o.map(e=>(0,y.jsx)(C,{s:e,open:h===e.id,onToggle:()=>c(h===e.id?null:e.id)},e.id)),o.length?null:(0,y.jsx)(i.Muted,{children:"No order sheets yet. Add suppliers in Managers \u203a Settings \u203a Supplier order sheets."})]})};var t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),d=e(_r(_d[7])),i=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]);function j(e){if('undefined'!=typeof window){const t=window;return'function'==typeof t.__ccOpenLink?void t.__ccOpenLink(e):void(/^https?:/.test(e)?window.open(e,'_blank','noopener'):window.location.href=e)}o.default.openURL(e).catch(()=>{})}async function w(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0}catch{}return!1}const k={online:'\ud83c\udf10',phone:'\ud83d\udcde',text:'\ud83d\udcac',whatsapp:'\u2706',tbc:'\ud83d\udd8a\ufe0f'},S={borderWidth:1,borderColor:f.colours.border,borderRadius:10,paddingHorizontal:12,paddingVertical:10,color:f.colours.text,backgroundColor:f.colours.surface2,fontSize:f.font.body};function T(){const{rid:e,now:t}=(0,x.useChef)(6e4),l=(0,u.useSheets)(e).filter(t=>(0,n.chefCanSee)(e,t)&&!t.placeholder),s=(0,u.useOrderSheets)(e=>e.opened),o=(0,h.useShellfish)(e,'','chef'),r=(0,b.remindersFor)(l,t,s);for(const n of l){const l=o.items.filter(e=>(e.supplierId===n.id||!e.supplierId&&n.shellfish)&&o.isLow(e.key));!l.length||s[n.id]&&new Date(s[n.id]).toDateString()===t.toDateString()||r.push({supplierId:n.id,name:n.name,text:`${'text'===n.method||'whatsapp'===n.method?'Text':'Order from'} ${n.contact||n.name}: ${l.map(t=>`${(0,c.fmtStockCount)(e,t,o.counts[t.key]??0)} ${t.plural.toLowerCase()}`).join(' and ')} left`,tone:'amber',cutoffPassed:!1})}return r}function C({s:e,open:n,onToggle:o}){const{rid:T,r:C,me:$,now:D}=(0,x.useChef)(3e4),v=(0,u.useOrderSheets)(e=>e.patch),I=(0,u.useOrderSheets)(e=>e.markOpened),M=(0,u.useOrderSheets)(t=>t.opened[e.id]),[B,L]=(0,s.useState)({}),[P,O]=(0,s.useState)(''),[R,A]=(0,s.useState)(''),[z,_]=(0,s.useState)(!1),W=(0,h.useShellfish)(T,$,'chef'),H=(0,b.nextDelivery)(e,D),K=(0,b.orderLines)(e,B,P,T),E=(C.address??C.location??'').split(',').map(e=>e.trim()).filter(Boolean),q=E.length>=3?E[1]:E[0]??'',N=(0,b.orderMessage)(e,C.name,q,K,$.split(' ')[0],D),U=e.orderDays.includes((0,b.wd)(D)),Q=(e,t)=>L(n=>({...n,[e.id]:(0,l.stepQuantity)(T,e,n[e.id]||0,t)})),Y=t=>{I(e.id,D.toISOString()),j(t)},F='text'===e.method||'whatsapp'===e.method||'phone'===e.method,G=Math.round(100*parseFloat(R.replace(/[\xa3,]/g,''))),V=W.items.filter(t=>t.supplierId===e.id||!t.supplierId&&e.shellfish),J=V.filter(e=>W.isLow(e.key));return(0,y.jsxs)(d.default,{testID:`sheet-${e.id}`,style:{borderRadius:14,borderWidth:1.5,borderColor:U||J.length?f.colours.amber:n?f.colours.gold:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} order sheet`,onPress:o,style:{padding:12,gap:4},children:[(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(i.T,{weight:"semibold",size:f.font.large,style:{flex:1},children:[k[e.method]," ",e.name]}),(0,y.jsx)(i.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':b.METHOD_LABEL[e.method]})]}),(0,y.jsx)(i.Muted,{children:e.goods}),(0,y.jsxs)(i.Row,{wrap:!0,gap:6,children:[e.deliveryDays.length?(0,y.jsx)(i.Badge,{kind:"neutral",label:`Delivers ${(0,b.dayRange)(e.deliveryDays)}`}):null,e.orderDays.length?(0,y.jsx)(i.Badge,{kind:U?'amber':'neutral',label:`Order ${(0,b.dayRange)(e.orderDays)}${e.cutoff?` by ${e.cutoff}`:''}`}):null,e.frequency?(0,y.jsx)(i.Badge,{kind:"neutral",label:e.frequency}):null,e.priceCapPerKg?(0,y.jsx)(i.Badge,{kind:"blue",label:`Cap ${(0,p.gbp)(e.priceCapPerKg)}/kg`}):null,V.length?(0,y.jsx)(i.Badge,{kind:J.length?'amber':'ok',label:V.map(e=>`${e.icon} ${(0,c.fmtStockCount)(T,e,W.counts[e.key]??0)}`).join(' \xb7 ')}):null,M&&new Date(M).toDateString()===D.toDateString()?(0,y.jsx)(i.Badge,{kind:"ok",label:"Opened today \u2713"}):null]})]}),n?(0,y.jsxs)(d.default,{style:{padding:12,paddingTop:0,gap:10},children:[H?(0,y.jsxs)(i.Muted,{children:["Next delivery if you order now: ",(0,b.niceDay)(H),"."]}):null,e.reminder?(0,y.jsxs)(i.Muted,{children:["Reminder on ",e.orderDays.map(e=>b.DAYS[e]).join(', '),": ",e.reminder]}):null,e.notes?(0,y.jsx)(i.T,{size:f.font.small,colour:f.colours.muted,children:e.notes}):null,e.placeholder?(0,y.jsx)(i.Banner,{kind:"warn",title:"Still to be set up",children:"Add the supplier, how to order and delivery days in Managers \u203a Settings \u203a Supplier order sheets."}):null,e.items.map(e=>(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsxs)(i.T,{children:[e.name,e.unit?(0,y.jsxs)(i.T,{size:f.font.small,colour:f.colours.muted,children:[" (",(0,l.quantityUnit)(T,e),")"]}):null]}),(0,y.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone less':'Less'} ${e.name}`,onPress:()=>Q(e,-1),style:{minWidth:44,minHeight:44}}),(0,y.jsx)(d.default,{accessible:!0,accessibilityLabel:(0,l.fishQtySpeech)(T,e,B[e.id]||0),children:(0,y.jsx)(i.T,{weight:"bold",size:20,style:{minWidth:76,textAlign:'center'},children:(0,l.fishInStone)(T,e)?(0,l.fishQtyText)(T,e,B[e.id]||0):B[e.id]||0})}),(0,y.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,l.fishInStone)(T,e)?'Half a stone more':'More'} ${e.name}`,testID:`qty-${e.id}`,onPress:()=>Q(e,1),style:{minWidth:44,minHeight:44}})]})]},e.id)),(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsx)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:"Anything else (one line each)"}),(0,y.jsx)(t.TextInput,{value:P,onChangeText:O,multiline:!0,placeholder:"e.g. 2 boxes lemons",placeholderTextColor:f.colours.muted,style:[S,{minHeight:60}]})]}),F?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['whatsapp'===e.method?'WhatsApp number':'phone'===e.method?'Phone number':'Mobile number',e.number?'':' (blank: fill in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`number-${e.id}`,value:e.number,onChangeText:t=>v(T,e.id,{number:t}),keyboardType:"phone-pad",placeholder:"07\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,'online'===e.method?(0,y.jsxs)(d.default,{style:{gap:4},children:[(0,y.jsxs)(i.T,{size:f.font.small,weight:"medium",colour:f.colours.muted,children:['Open Coldweb'===e.urlLabel?'Coldweb ordering link':'Website link',e.url?'':' (blank: paste it in once, it is saved)']}),(0,y.jsx)(t.TextInput,{testID:`url-${e.id}`,value:e.url,onChangeText:t=>v(T,e.id,{url:t.trim()}),autoCapitalize:"none",keyboardType:"url",placeholder:"https://\u2026",placeholderTextColor:f.colours.muted,style:S})]}):null,e.priceCapPerKg?(0,y.jsxs)(d.default,{style:{gap:6,padding:10,borderRadius:12,backgroundColor:f.colours.blueBg},children:[(0,y.jsxs)(i.T,{weight:"semibold",colour:"#E2C489",children:["Price cap ",(0,p.gbp)(e.priceCapPerKg),"/kg \xb7 buy from the cheapest UK seller under it"]}),(0,y.jsxs)(i.Muted,{children:["Seller: ",e.seller||'to be chosen']}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.T,{size:f.font.small,style:{flex:1},children:"Price you found (\xa3/kg)"}),(0,y.jsx)(t.TextInput,{testID:"price-found",value:R,onChangeText:A,keyboardType:"decimal-pad",placeholder:"e.g. 22.50",placeholderTextColor:f.colours.muted,style:[S,{width:120}]})]}),G>0?(0,y.jsx)(i.Badge,{kind:G<=e.priceCapPerKg?'ok':'red',label:G<=e.priceCapPerKg?`${(0,p.gbp)(G)}/kg is under the cap \u2713`:`${(0,p.gbp)(G)}/kg is over the ${(0,p.gbp)(e.priceCapPerKg)} cap: look for a cheaper seller`}):null]}):null,'online'!==e.method&&'tbc'!==e.method?(0,y.jsxs)(d.default,{testID:`preview-${e.id}`,style:{padding:10,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface2},children:[(0,y.jsx)(i.T,{size:12,weight:"semibold",colour:f.colours.gold,children:'phone'===e.method?'READ THIS OUT':'YOUR MESSAGE'}),(0,y.jsx)(i.T,{size:f.font.small,children:K.length?N:'Add quantities above to write the order.'})]}):null,(0,y.jsxs)(i.Row,{wrap:!0,gap:8,children:['text'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"\ud83d\udcac Open in Messages",disabled:!K.length,onPress:()=>Y((0,b.smsLink)(e.number,N))}):null,'whatsapp'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:"Open in WhatsApp",disabled:!K.length,onPress:()=>Y((0,b.waLink)(e.number,N))}):null,'phone'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83d\udcde Call ${e.name}`,disabled:!e.number,onPress:()=>Y((0,b.telLink)(e.number))}):null,'online'===e.method?(0,y.jsx)(i.Button,{testID:`send-${e.id}`,kind:"success",label:`\ud83c\udf10 ${e.urlLabel??'Open website'}`,disabled:!e.url,onPress:()=>Y(e.url)}):null,'online'!==e.method&&'tbc'!==e.method&&K.length?(0,y.jsx)(i.Button,{kind:"ghost",label:z?'Copied \u2713':'Copy order',onPress:async()=>{const e=await w(N);_(e),e&&setTimeout(()=>_(!1),2e3)}}):null]}),'text'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: Messages opens with the order written and asks who to send it to."}):null,'whatsapp'===e.method&&!e.number&&K.length?(0,y.jsx)(i.Muted,{children:"No number saved: WhatsApp opens with the order written and asks who to send it to."}):null,'phone'!==e.method||e.number?null:(0,y.jsx)(i.Muted,{children:"Add the phone number above to call from here."}),'online'!==e.method||e.url?null:(0,y.jsx)(i.Muted,{children:"Add the link above and the button opens it."})]}):null]})}},1141,[796,804,982,34,379,236,402,102,794,1016,981,983,836,1017,840,1124,25]); -__d(function(g,_r,_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:u,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),f=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,o.useLiveState)();if('ready'!==$)return(0,p.jsx)(o.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,p.jsxs)(n.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface,padding:u?10:12,gap:6},b],children:[(0,p.jsxs)(r.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:u?1:void 0},children:[(0,p.jsxs)(i.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:["LIVE \xb7 ",I]}),(0,p.jsx)(i.T,{size:12,colour:c.colours.muted,children:"Tap to update \u203a"})]}),(0,p.jsx)(i.Row,{gap:u?14:18,style:{flex:u?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,p.jsx)(i.T,{size:u?42:34,weight:"bold",colour:s<=0?c.colours.red:o?c.colours.amber:c.colours.text,style:{lineHeight:u?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,p.jsxs)(i.T,{size:13,colour:o?c.colours.amber:c.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),f[t.key]?(0,p.jsxs)(i.T,{size:12,weight:"semibold",colour:c.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,f[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-f[t.key]))]}):null]},t.key)})})]}),!u&&L.length?(0,p.jsxs)(n.default,{testID:"shellfish-low",style:{backgroundColor:c.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,p.jsxs)(i.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.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,p.jsx)(i.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,u||L.length||!h?null:(0,p.jsx)(r.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,p.jsx)(i.T,{size:13,colour:c.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,p.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:u=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,f]=(0,s.useState)(!1);if(!h.items.length)return null;const x=u>=80,w=Math.max(28,Math.min(52,Math.round(.6*u))),C=Math.max(22,Math.min(34,Math.round(.42*u)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.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:()=>f(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:u,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,r=b[t.key]??0,d=Math.max(0,o-r),y=d<=0,f=y||h.isLow(t.key);return(0,p.jsxs)(n.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:f?'rgba(255,107,94,0.07)':'transparent',...l.look.web(f?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,p.jsx)(i.T,{size:C,children:t.icon}),(0,p.jsx)(i.T,{size:w,weight:"bold",colour:f?'#FF8E82':c.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,p.jsxs)(n.default,{style:{gap:0},children:[(0,p.jsx)(i.T,{size:x?15:13,weight:"semibold",colour:f?'#FFB3AA':c.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),f&&u>=60?(0,p.jsx)(i.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,p.jsxs)(i.T,{size:x?14:12,weight:"semibold",colour:r?c.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,r)]})]})]},t.key)})}),y?(0,p.jsx)(j,{rid:e,by:t,app:o,onClose:()=>f(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=w,_e.SundayRoastChip=function(e){return(0,p.jsx)(w,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_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]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]);const f=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,u.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:r,onOrder:u,group:h}){const b=(0,d.useShellfish)(e,o,l,h),y='roast'===h,[k,j]=(0,s.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,k[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):k,[C,S]=(0,s.useState)(null),$=x(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&j(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=k[e.key]&&k[e.key]!==Math.round(b.counts[e.key]??0));return(0,p.jsxs)(i.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,p.jsx)(i.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,p.jsxs)(n.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?c.colours.amber:c.colours.border,backgroundColor:c.colours.surface2},children:[(0,p.jsxs)(i.T,{center:!0,size:13,colour:c.colours.muted,children:[s.icon," ",s.plural]}),(0,p.jsx)(i.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?c.colours.amber:c.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,p.jsx)(i.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,p.jsx)(i.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,p.jsx)(n.default,{style:{minHeight:52}})]},s.key)})}),(0,p.jsx)(i.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,a.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,a.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,p.jsx)(i.Banner,{kind:"success",title:C}):null,(0,p.jsxs)(n.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:c.colours.gold,backgroundColor:c.colours.goldTint},children:[(0,p.jsx)(i.T,{weight:"semibold",colour:c.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,p.jsxs)(i.Row,{gap:10,children:[(0,p.jsxs)(i.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,p.jsx)(i.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,w[s.key]||0)}),(0,p.jsx)(i.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,p.jsx)(i.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=k[e.key]&&b.recount(e.key,Math.max(0,Math.round(k[e.key])))}),j({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,p.jsx)(i.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),j({})},style:{minHeight:54}})]}),u?(0,p.jsx)(i.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:u}):null,(0,p.jsxs)(n.default,{style:{gap:2},children:[(0,p.jsx)(i.T,{size:12,weight:"semibold",colour:c.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,p.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(i.T,{size:13,style:{flex:1},children:(0,a.describe)(e,b.itemOf(e.kind))}),(0,p.jsxs)(i.Muted,{children:[f(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,p.jsx)(i.Row,{wrap:!0,gap:6,children:b.synced?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"ok",label:"Shared live"}),(0,p.jsx)(i.Muted,{children:"Every paired device sees the same count."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(i.Badge,{kind:"neutral",label:"Saved on this device"}),(0,p.jsx)(i.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function w({rid:e,by:t,app:o,size:u="m",group:b}){const y=(0,d.useShellfish)(e,t,o,b),f=k(e),[x,w]=(0,s.useState)(!1),C=(0,h.useNow)(3e4);if(!y.items.length)return null;if('roast'===b&&!(0,a.isSundayIn)(C))return null;const S='m'===u?20:17,$='xs'!==u;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.default,{testID:'roast'===b?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===b?'Sunday roast: ':''}${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(y.counts[t.key]??0)-(f[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>w(!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:y.items.map((t,s)=>{const o=y.counts[t.key]??0,l=f[t.key]??0,r=Math.max(0,o-l),d=r<=0,u=d||y.isLow(t.key);return(0,p.jsxs)(n.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,r)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:u?'rgba(255,107,94,0.10)':'transparent'},children:[(0,p.jsx)(i.T,{size:S-2,children:t.icon}),(0,p.jsx)(i.T,{size:S,weight:"bold",colour:d?c.colours.red:u?c.colours.amber:c.colours.text,style:{lineHeight:S+4},children:(0,a.fmtStockCount)(e,t,r)}),$&&(l||d||u)?(0,p.jsx)(i.T,{size:10,weight:"semibold",colour:d||u?'#FFB3AA':c.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),x?(0,p.jsx)(j,{rid:e,by:t,app:o,group:b,onClose:()=>w(!1)}):null]})}},1142,[982,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); +__d(function(g,_r,_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=x,_e.ShellfishTile=function({rid:e,by:t,app:s,big:r,onOrder:c,style:b}){const y=(0,u.useShellfish)(e,t,s),p=x(e),[k,C]=(0,o.useState)(!1),S=j(e,y.items.find(e=>e.supplierId)?.supplierId),$=(0,l.useLiveState)();if('ready'!==$)return(0,f.jsx)(l.LiveWait,{state:$,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const L=y.items.filter(e=>y.isLow(e.key)),I=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(i.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:L.length?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface,padding:r?10:12,gap:6},b],children:[(0,f.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:r?1:void 0},children:[(0,f.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:["LIVE \xb7 ",I]}),(0,f.jsx)(a.T,{size:12,colour:h.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(a.Row,{gap:r?14:18,style:{flex:r?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)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(a.T,{size:r?42:34,weight:"bold",colour:s<=0?h.colours.red:o?h.colours.amber:h.colours.text,style:{lineHeight:r?50:42},children:(0,d.fmtStockCount)(e,t,s)}),(0,f.jsxs)(a.T,{size:13,colour:o?h.colours.amber:h.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(a.T,{size:12,weight:"semibold",colour:h.colours.goldLight,children:["Reserved: ",(0,d.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,d.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!r&&L.length?(0,f.jsxs)(i.default,{testID:"shellfish-low",style:{backgroundColor:h.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",L.map(t=>`${(0,d.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,d.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),c?(0,f.jsx)(a.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:c}):null]}):null,r||L.length||!c?null:(0,f.jsx)(n.default,{accessibilityRole:"button",onPress:c,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(a.T,{size:13,colour:h.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),k?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>C(!1),onOrder:c?()=>{C(!1),c()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:l=76}){const c=(0,u.useShellfish)(e,t,s),b=x(e),[y,p]=(0,o.useState)(!1);if(!c.items.length)return null;const k=l>=80,j=Math.max(28,Math.min(52,Math.round(.6*l))),C=Math.max(22,Math.min(34,Math.round(.42*l)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${c.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,c.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:l,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...r.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:c.items.map((t,s)=>{const o=c.counts[t.key]??0,n=b[t.key]??0,u=Math.max(0,o-n),y=u<=0,p=y||c.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,u)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:k?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...r.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)(a.T,{size:C,children:t.icon}),(0,f.jsx)(a.T,{size:j,weight:"bold",colour:p?'#FF8E82':h.colours.text,style:{lineHeight:Math.round(1.15*j),letterSpacing:-.5,minWidth:Math.round(.85*j),textAlign:'center'},children:(0,d.fmtStockCount)(e,t,u)}),(0,f.jsxs)(i.default,{style:{gap:0},children:[(0,f.jsx)(a.T,{size:k?15:13,weight:"semibold",colour:p?'#FFB3AA':h.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&l>=60?(0,f.jsx)(a.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,d.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(a.T,{size:k?14:12,weight:"semibold",colour:n?h.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,d.fmtStockCount)(e,t,n)]})]})]},t.key)})}),y?(0,f.jsx)(w,{rid:e,by:t,app:s,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=w,_e.ShellfishChip=C,_e.SundayRoastChip=function(e){return(0,f.jsx)(C,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),r=_r(_d[4]),n=e(_r(_d[5])),i=e(_r(_d[6])),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),p=_r(_d[14]),f=_r(_d[15]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function x(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.ymd)((0,b.useNow)(6e4));return(0,y.reservedOn)(t,o,(0,y.reservablesOf)(s))}function j(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function w({rid:e,by:s,app:l,onClose:r,onOrder:n,group:c}){const b=(0,u.useShellfish)(e,s,l,c),y='roast'===c,[p,x]=(0,o.useState)({}),w=y?Object.fromEntries(b.items.map(e=>[e.key,p[e.key]??Math.max(0,Math.round(b.counts[e.key]??0))])):p,[C,S]=(0,o.useState)(null),$=j(e,b.items.find(e=>e.supplierId)?.supplierId),L=(s,o)=>{const l=b.itemOf(s);l&&x(r=>{const n=r[s]??(y?Math.max(0,Math.round(b.counts[s]??0)):0);return{...r,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,n,o):Math.max(0,Math.min(99,n+o))}})},I=(e,t=!1)=>{const s=b.itemOf(e);b.sell(e,t)&&S(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},T=Object.values(w).reduce((e,t)=>e+t,0),v=y&&b.items.some(e=>null!=p[e.key]&&p[e.key]!==Math.round(b.counts[e.key]??0));return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:r,title:y?`Sunday roast: ${b.items.map(e=>e.plural).join(' & ')}`:b.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:y?'roast-panel':'shellfish-panel',children:[(0,f.jsx)(a.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:b.items.map(s=>{const o=b.counts[s.key]??0;return(0,f.jsxs)(i.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:b.isLow(s.key)?h.colours.amber:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(a.T,{center:!0,size:13,colour:h.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(a.T,{center:!0,size:48,weight:"bold",colour:b.isLow(s.key)?h.colours.amber:h.colours.text,style:{lineHeight:56},children:(0,d.fmtStockCount)(e,s,o)}),(0,f.jsx)(a.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:()=>I(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(a.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>I(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(i.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(a.Button,{kind:"ghost",label:b.undoable?`\u21b6 Undo: ${(0,d.describe)(b.undoable,b.itemOf(b.undoable.kind))}`:'\u21b6 Nothing to undo',testID:y?'roast-undo':'shellfish-undo',disabled:!b.undoable,onPress:()=>{const e=b.undoable;b.undoLast(),e&&S(`Undone: ${(0,d.describe)(e,b.itemOf(e.kind))}.`)}}),C?(0,f.jsx)(a.Banner,{kind:"success",title:C}):null,(0,f.jsxs)(i.default,{testID:y?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,f.jsx)(a.T,{weight:"semibold",colour:h.colours.goldLight,children:y?'Count before service':'Delivery in'}),b.items.map(s=>(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsxs)(a.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:y?`One less ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>L(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(a.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,d.fmtStockCount)(e,s,w[s.key]||0)}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:y?`One more ${s.name.toLowerCase()}, now ${w[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>L(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>L(s.key,5)})]},s.key)),y?(0,f.jsx)(a.Button,{kind:"success",label:`Set today\u2019s count: ${b.items.map(e=>`${w[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!v,onPress:()=>{b.items.forEach(e=>{null!=p[e.key]&&b.recount(e.key,Math.max(0,Math.round(p[e.key])))}),x({}),S('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,f.jsx)(a.Button,{kind:"success",label:T?`Add to stock: ${b.items.filter(e=>w[e.key]).map(t=>`${(0,d.fmtStockCount)(e,t,w[t.key])} ${(1===w[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!T,onPress:()=>{b.items.forEach(e=>b.deliver(e.key,w[e.key]??0)),S('Delivery added to the count.'),x({})},style:{minHeight:54}})]}),n?(0,f.jsx)(a.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:n}):null,(0,f.jsxs)(i.default,{style:{gap:2},children:[(0,f.jsx)(a.T,{size:12,weight:"semibold",colour:h.colours.gold,children:"RECENT"}),b.events.slice(0,6).map(e=>(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,style:{flex:1},children:(0,d.describe)(e,b.itemOf(e.kind))}),(0,f.jsxs)(a.Muted,{children:[k(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:b.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(a.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(a.Muted,{children:"Not connected to the shared venue yet."})]})})]})}function C({rid:e,by:t,app:l,size:c="m",group:y}){const p=(0,u.useShellfish)(e,t,l,y),k=x(e),[j,C]=(0,o.useState)(!1),S=(0,b.useNow)(3e4);if(!p.items.length)return null;if('roast'===y&&!(0,d.isSundayIn)(S))return null;const $='m'===c?20:17,L='xs'!==c;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.default,{testID:'roast'===y?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===y?'Sunday roast: ':''}${p.items.map(t=>`${t.plural} ${(0,d.fmtStockCount)(e,t,Math.max(0,(p.counts[t.key]??0)-(k[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>C(!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)',...r.look.web({cursor:'pointer'})}),children:p.items.map((t,o)=>{const l=p.counts[t.key]??0,r=k[t.key]??0,n=Math.max(0,l-r),u=n<=0,c=u||p.isLow(t.key);return(0,f.jsxs)(i.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,d.speakStockCount)(e,t,n)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(a.T,{size:$-2,children:t.icon}),(0,f.jsx)(a.T,{size:$,weight:"bold",colour:u?h.colours.red:c?h.colours.amber:h.colours.text,style:{lineHeight:$+4},children:(0,d.fmtStockCount)(e,t,n)}),!L||!(r||u||c)||u&&s.IS_CAR?null:(0,f.jsx)(a.T,{size:10,weight:"semibold",colour:u||c?'#FFB3AA':h.colours.goldLight,children:u?'none left':r?`${(0,d.fmtStockCount)(e,t,r)} res`:'low'})]},t.key)})}),j?(0,f.jsx)(w,{rid:e,by:t,app:l,group:y,onClose:()=>C(!1)}):null]})}},1142,[982,846,34,984,1143,402,102,794,983,981,1016,840,848,1075,827,25]); __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}},1143,[5,797,841,798,236,844]); __d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StockScreen=function({initial:e="levels"}){const[t,i]=(0,l.useState)(e);return(0,x.jsxs)(r.default,{style:{gap:12},children:[(0,x.jsx)(p.Seg,{value:t,onChange:i,options:[{id:'levels',label:'Stock levels'},{id:'take',label:'Stock take'},{id:'deliveries',label:'Deliveries in'}]}),'levels'===t?(0,x.jsx)(y,{}):'take'===t?(0,x.jsx)(j,{}):(0,x.jsx)(f,{})]})};var t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),l=_r(_d[4]),d=e(_r(_d[5])),r=e(_r(_d[6])),o=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),x=_r(_d[13]);function y(){const{k:e,rid:t}=(0,p.useChef)(),d=(0,c.useOwner)(e=>e.suppliers),b=(0,i.useSheets)(t),[y,j]=(0,l.useState)('all'),f=e.ingredients.filter(e=>e.onHand<=0),v=e.ingredients.filter(e=>(0,p.isLow)(e.onHand,e.par)),k='alerts'===y?[...f,...v]:e.ingredients,S=[...new Set(k.map(e=>e.supplierId))].map(e=>{const t=d.find(t=>t.id===e),i=b.find(t=>t.id===e);return{id:e,name:t?.name||i?.name||'Supplier not linked',category:t?.category||i?.goods||'Stock'}});return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsxs)(o.Row,{wrap:!0,gap:10,children:[(0,x.jsx)(p.Tile,{label:"Stock value (at cost)",value:(0,u.gbp)((0,p.stockValue)(e.ingredients)),sub:`${e.ingredients.length} ingredients`}),(0,x.jsx)(p.Tile,{label:"Low or out",value:`${v.length+f.length}`,sub:`${f.length} out \xb7 ${v.length} below half par`,tone:f.length?'red':v.length?'amber':'ok',onPress:()=>j('alerts')})]}),f.length?(0,x.jsxs)(o.Banner,{kind:"danger",title:"Out of stock",children:[f.map(e=>e.name).join(', '),". Mark the dishes that need it as sold out (Kitchen \u203a Live tickets \u203a Sold out), or order now."]}):null,(0,x.jsx)(p.Seg,{value:y,onChange:j,options:[{id:'all',label:'All'},{id:'alerts',label:'Alerts only'}]}),e.ingredients.length?null:(0,x.jsx)(o.Muted,{children:"No stock items yet. Add your real ingredients to start counting."}),S.map(e=>(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.T,{weight:"semibold",children:[e.category," \xb7 ",e.name]}),k.filter(t=>t.supplierId===e.id).map(e=>{const i=e.onHand<=0?'out':(0,p.isLow)(e.onHand,e.par)?'low':'ok';return(0,x.jsxs)(r.default,{style:{gap:4,paddingVertical:4},accessible:!0,accessibilityLabel:`${e.name} ${(0,n.ingredientSpeech)(t,e,e.onHand)} of par ${(0,n.ingredientSpeech)(t,e,e.par)}`,children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},children:e.name}),'out'===i?(0,x.jsx)(o.Badge,{kind:"red",label:"OUT"}):'low'===i?(0,x.jsx)(o.Badge,{kind:"amber",label:"LOW"}):null,(0,x.jsxs)(o.T,{size:13,colour:h.colours.muted,children:[(0,n.ingredientQty)(t,e,e.onHand)," / par ",(0,n.ingredientQty)(t,e,e.par)]})]}),(0,x.jsx)(p.Bar,{pct:e.onHand/e.par*100,colour:'out'===i?h.colours.red:'low'===i?h.colours.amber:h.colours.gold}),(0,x.jsxs)(o.Muted,{children:[(0,u.gbp)(Math.round((0,s.displayedCost)(t,e,e.cost)))," per ",(0,s.quantityUnit)(t,e)," \xb7 value ",(0,u.gbp)(Math.round(e.onHand*e.cost))]})]},e.id)})]},e.id))]})}function j(){const{k:e,me:i,rid:d}=(0,p.useChef)(),c=(0,b.useKitchen)(e=>e.saveStockTake),[y,j]=(0,l.useState)({}),[f,v]=(0,l.useState)(''),k=e.ingredients.map(e=>{const t=y[e.id],i=void 0===t||''===t?void 0:Number(t.replace(',','.')),n=void 0!==i&&Number.isFinite(i)&&i>=0&&(!(0,s.fishInStone)(d,e)||2*i===Math.round(2*i))?(0,s.inputQuantity)(d,e,i):void 0,l=void 0===n||Number.isNaN(n)?void 0:n-e.onHand;return{i:e,counted:n,variance:l,cost:void 0===l?0:Math.round(l*e.cost)}}),S=k.filter(e=>void 0!==e.variance),w=S.reduce((e,t)=>e+t.cost,0);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Count what's on the shelves. Expected = last count + deliveries \u2212 waste. Fish is entered in stone, in half-stone steps. Variance shows what's unexplained (portioning, theft, missed waste)."}),e.stockTakes[0]?(0,x.jsxs)(o.Muted,{children:["Last stock take ",new Date(e.stockTakes[0].at).toLocaleDateString('en-GB')," by ",e.stockTakes[0].by,": variance ",(0,u.gbp)(Math.round(e.stockTakes[0].lines.reduce((e,t)=>e+(t.counted-t.expected)*t.cost,0))),"."]}):null,(0,x.jsx)(o.Card,{children:k.map(({i:e,variance:i,cost:l})=>(0,x.jsxs)(r.default,{style:{gap:6,paddingVertical:8},children:[(0,x.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, expected ${(0,n.ingredientSpeech)(d,e,e.onHand)}`,children:[(0,x.jsx)(o.T,{size:16,children:e.name}),(0,x.jsxs)(o.Muted,{children:["Expected ",(0,n.ingredientQty)(d,e,e.onHand)]})]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'space-between'},children:[(0,x.jsx)(t.TextInput,{accessibilityLabel:`Count ${e.name} in ${(0,s.quantityUnit)(d,e)}`,accessibilityValue:{text:y[e.id]?(0,n.ingredientSpeech)(d,e,(0,s.inputQuantity)(d,e,Number(y[e.id]))):'Not counted'},keyboardType:"decimal-pad",placeholder:(0,s.quantityUnit)(d,e),placeholderTextColor:h.colours.muted,value:y[e.id]??'',onChangeText:t=>j(i=>({...i,[e.id]:t})),style:{minHeight:44,width:80,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:8,paddingVertical:6,color:h.colours.text,textAlign:'right'}}),(0,s.fishInStone)(d,e)?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Half a stone less ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String(Math.max(0,(0,s.halfStone)(Number(t[e.id])||0)-.5))}))}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Half a stone more ${e.name}`,onPress:()=>j(t=>({...t,[e.id]:String((0,s.halfStone)(Number(t[e.id])||0)+.5)}))})]}):null,(0,x.jsx)(r.default,{style:{minWidth:86,alignItems:'flex-end'},accessible:!0,accessibilityLabel:void 0===i?'No variance yet':`${(0,n.ingredientSpeech)(d,e,i)} variance, ${(0,u.gbp)(l)}`,children:void 0===i?(0,x.jsx)(o.Muted,{children:"\u2014"}):(0,x.jsxs)(o.T,{size:14,colour:Math.abs(i)<.001?h.colours.ok:i<0?h.colours.red:h.colours.amber,children:[i>0?'+':'',(0,n.ingredientQty)(d,e,i),'\n',(0,u.gbp)(l)]})})]})]},e.id))}),(0,x.jsxs)(o.Banner,{kind:w<0?'warn':'info',title:`Variance so far: ${(0,u.gbp)(w)}`,children:[S.length," of ",e.ingredients.length," counted."]}),(0,x.jsx)(o.Button,{label:"Save stock take",disabled:!S.length,onPress:()=>{const e={};S.forEach(t=>{e[t.i.id]=t.counted}),c(e,i),j({}),v(`Saved: ${S.length} items, variance ${(0,u.gbp)(w)}. Stock levels updated.`)}}),f?(0,x.jsx)(o.Banner,{kind:"success",title:"Stock take saved",children:f}):null]})}function f(){const{k:e,me:t}=(0,p.useChef)(),i=(0,c.useOwner)(e=>e.suppliers),[n,s]=(0,l.useState)(e.deliveries.find(e=>'expected'===e.status)?.id??null);return(0,x.jsxs)(r.default,{style:{gap:10},children:[(0,x.jsx)(o.Muted,{children:"Check each delivery against the order: count it in, check the invoice price, flag shorts and price changes. Accepting adds it to stock and updates costs (and GP)."}),e.deliveries.map(e=>{const l=i.find(t=>t.id===e.supplierId);return(0,x.jsxs)(o.Card,{highlight:n===e.id?h.colours.gold:void 0,children:[(0,x.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`Delivery from ${l?.name}`,onPress:()=>s(n===e.id?null:e.id),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{weight:"semibold",children:l?.name??'Supplier'}),(0,x.jsx)(o.Muted,{children:'expected'===e.status?`Due ${e.due} \xb7 ${e.lines.length} lines`:`Accepted by ${e.checkedBy} ${e.at?new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`})]}),(0,x.jsx)(o.Badge,{kind:'expected'===e.status?'amber':'ok',label:'expected'===e.status?'TO CHECK':'ACCEPTED'})]})}),n===e.id?(0,x.jsx)(v,{id:e.id,me:t}):null]},e.id)})]})}function v({id:e,me:i}){const{k:d,rid:c}=(0,p.useChef)(),b=d.deliveries.find(t=>t.id===e),[y,j]=(0,l.useState)(b.lines.map(e=>({...e}))),f=(e,t)=>j(i=>i.map(i=>i.ing===e?{...i,...t}:i)),v='expected'!==b.status,k=(0,l.useMemo)(()=>y.map(e=>{const t=d.ingredients.find(t=>t.id===e.ing),i=e.receivede.short>0),w=k.filter(e=>Math.abs(e.pct)>=.5),$=y.reduce((e,t)=>e+t.received*t.price,0);return(0,x.jsxs)(r.default,{style:{gap:8,marginTop:8},children:[k.map(({l:e,i:i,short:l,pct:d})=>(0,x.jsxs)(r.default,{style:{gap:4,borderTopWidth:1,borderColor:h.colours.border,paddingTop:6},children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{style:{flex:1},weight:"medium",children:i.name}),l?(0,x.jsx)(o.Badge,{kind:"red",label:`SHORT ${(0,n.ingredientQty)(c,i,l)}`}):null,Math.abs(d)>=.5?(0,x.jsx)(o.Badge,{kind:"amber",label:`PRICE ${d>0?'+':''}${d.toFixed(0)}%`}):null]}),(0,x.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,x.jsxs)(o.Muted,{children:["Ordered ",(0,n.ingredientQty)(c,i,e.ordered)]}),(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Received (",(0,s.quantityUnit)(c,i),")"]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Received ${i.name} in ${(0,s.quantityUnit)(c,i)}`,accessibilityValue:{text:(0,n.ingredientSpeech)(c,i,e.received)},keyboardType:"decimal-pad",value:String((0,s.fishInStone)(c,i)?(0,s.halfStone)((0,s.toStone)(e.received,i.unit)):e.received),onChangeText:t=>f(e.ing,{received:(0,s.inputQuantity)(c,i,Number(t.replace(',','.'))||0)}),style:{minHeight:44,width:60,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]}),(0,s.fishInStone)(c,i)&&!v?(0,x.jsxs)(o.Row,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Receive half a stone less ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,-1)})}),(0,x.jsx)(o.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Receive half a stone more ${i.name}`,onPress:()=>f(e.ing,{received:(0,s.stepQuantity)(c,i,e.received,1)})})]}):null,(0,x.jsxs)(o.Row,{gap:4,children:[(0,x.jsxs)(o.Muted,{children:["Invoice \xa3/",(0,s.quantityUnit)(c,i)]}),(0,x.jsx)(t.TextInput,{editable:!v,accessibilityLabel:`Invoice price ${i.name}`,keyboardType:"decimal-pad",value:((0,s.displayedCost)(c,i,e.price)/100).toFixed(2),onChangeText:t=>f(e.ing,{price:100*(Number(t.replace(',','.'))||0)/((0,s.fishInStone)(c,i)?(0,s.fromStone)(1,i.unit):1)}),style:{minHeight:44,width:70,borderWidth:1,borderColor:h.colours.border,borderRadius:8,paddingHorizontal:6,paddingVertical:4,color:h.colours.text,textAlign:'right'}})]})]}),(0,x.jsxs)(o.Muted,{children:["Last cost ",(0,u.gbp)(Math.round((0,s.displayedCost)(c,i,i.cost)))," per ",(0,s.quantityUnit)(c,i)]})]},e.ing)),(0,x.jsxs)(o.T,{weight:"semibold",children:["Invoice total ",(0,u.gbp)(Math.round($))]}),S.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Shorts to chase",children:[S.map(e=>`${e.i.name}: ${(0,n.ingredientQty)(c,e.i,e.short)} short`).join(' \xb7 '),". Ask the supplier for a credit note."]}):null,w.length?(0,x.jsxs)(o.Banner,{kind:"warn",title:"Price changes",children:[w.map(e=>`${e.i.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%`).join(' \xb7 '),". Check GP \u203a Price changes once accepted."]}):null,v?(0,x.jsx)(o.Muted,{children:b.note?`Noted: ${b.note}.`:'No issues noted.'}):(0,x.jsx)(o.Button,{label:"Accept delivery into stock",testID:"accept-delivery",onPress:()=>d.acceptDelivery(e,y,i,[S.length?`${S.length} short`:'',w.length?`${w.length} price changes`:''].filter(Boolean).join(', '))})]})}},1144,[796,1016,1129,982,34,402,102,794,865,836,840,1124,1018,25]); __d(function(g,_r,_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,100][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:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,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))]})}},1145,[796,1146,34,402,102,426,794,865,836,827,840,1147,1100,1050,25]); @@ -1235,302 +1235,303 @@ __d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ActionTile=function({label:e,sub:r,icon:c,onPress:u,primary:h,tone:b="gold",count:f,testID:x,accessibilityLabel:y}){const j='blue'===b?i.colours.blue:i.colours.gold;return(0,s.jsxs)(t.default,{testID:x,accessibilityRole:"button",accessibilityLabel:y??(r?`${e}, ${r}`:e),onPress:u,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:68,borderRadius:16,borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline,backgroundColor:e?i.colours.tilePressed:i.colours.tile,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:12,paddingHorizontal:14,paddingVertical:12}),children:[(0,s.jsx)(o.default,{style:{width:40,height:40,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:h?i.colours.accentBg:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:h?i.colours.accentBorder:i.colours.hairline},children:(0,s.jsx)(l.Icon,{name:c,size:21,colour:j})}),(0,s.jsxs)(o.default,{style:{flexShrink:1,minWidth:0},children:[(0,s.jsx)(n.T,{size:15,weight:"semibold",numberOfLines:1,colour:i.colours.text,children:e}),r?(0,s.jsx)(n.T,{size:12,numberOfLines:1,colour:i.colours.muted,children:r}):null]}),f?(0,s.jsx)(o.default,{style:{backgroundColor:i.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,s.jsx)(n.T,{size:12,weight:"bold",colour:i.colours.onGold,center:!0,children:f})}):null]})},_e.ActionGrid=function({children:e,testID:t="action-grid"}){const l=r.default.Children.toArray(e).filter(Boolean),i=[];for(let e=0;e(0,s.jsxs)(o.default,{style:{flexDirection:'row',gap:12},children:[e,1===e.length?(0,s.jsx)(o.default,{style:{flex:1}}):null]},r))})},Object.defineProperty(_e,"CardHeading",{enumerable:!0,get:function(){return c}});var r=e(_r(d[0])),t=e(_r(d[1])),o=e(_r(d[2])),l=_r(d[3]),i=_r(d[4]),n=_r(d[5]),s=_r(d[6]);const c=({children:e,right:r})=>(0,s.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,s.jsx)(n.T,{size:12,weight:"semibold",colour:i.colours.goldMuted,style:{letterSpacing:1.6,textTransform:'uppercase'},children:e}),r]})},1152,[34,402,102,1153,840,794,25]); __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])},1153,[34,900,25]); __d(function(g,_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 M}}),_e.allocate=O,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:T,now:C,today:S,role:k,meId:v,me:D}=(0,x.useCtx)(6e4),B=(0,u.useOwner)(e=>e.staff),F=(0,u.useOwner)(e=>e.attendance),N=(0,u.useOwner)(e=>e.shifts),R=(0,u.useOwner)(e=>e.tronc),E=(0,u.useOwner)(e=>e.troncCash),L=(0,u.useOwner)(e=>e.troncHistory),z=(0,u.useOwner)(e=>e.troncLog),_=(0,c.useOrders)(T),V=(0,j.useVenuePay)(T).pay,[q,H]=(0,i.useState)(-1),[U,W]=(0,i.useState)(''),[Y,K]=(0,i.useState)(!1),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(R.text),[Z,ee]=(0,i.useState)(null),te='staff'!==k,se='owner'===k,{s:oe,e:ie,key:ne}=(0,j.venueRange)(V,'tips',q,C),re=`${(0,h.niceDate)(oe)} \u2013 ${(0,h.niceDate)(ie)} ${ie.getFullYear()}`,le=L.find(e=>e.key===ne),ae=e=>u.useOwner.getState().setOwner({tronc:{...R,...e}}),de=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ce=Math.round((ie.getTime()-oe.getTime())/864e5)+1,ue=(0,i.useMemo)(()=>{let e=_.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(oe)&&e.createdAt.slice(0,10)<=(0,h.ymd)(ie)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!de)for(let t=0;tC)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[ne,_.length,de]),pe=E[ne]??0,he=le?le.pot:ue+pe,me=(0,i.useMemo)(()=>{const e={};for(let t=0;tS)break;const o=(0,h.ymd)(s);B.forEach(t=>{const s=F.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,C).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[ne,F.length,N.length,B.length]),fe=B.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&R.includeManagers||'owner'===e.role&&R.includeOwner)),ye=(0,i.useMemo)(()=>{if(le)return le.rows;const e=fe.map(e=>{const t=(me[e.id]?.paid??0)/60,s=R.points[M(e)]??1;return'hours'===R.method?t:'points'===R.method?t*s:'equal'===R.method?t>0?1:0:R.custom[e.id]??0}),{amounts:t}=O(he,e),s=e.reduce((e,t)=>e+t,0);return fe.map((o,i)=>({staffId:o.id,hours:(me[o.id]?.paid??0)/60,points:R.points[M(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[le,fe.map(e=>e.id).join(),me,R,he]),ge=ye.reduce((e,t)=>e+t.amount,0),xe=le?0:(()=>{const e=ye.map(e=>e.pct);return O(he,e).remainder})(),je=Object.entries(R.custom).filter(([e])=>fe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),be='custom'===R.method&&Math.abs(je-100)>.01,we=new Date(ie.getFullYear(),ie.getMonth()+2,0),Te=[...L].sort((e,t)=>t.end.localeCompare(e.end))[0],Ce=0!==L.length&&(0,h.parseYmd)(Te.end)<(0,h.addMins)(C,-89280),Se=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return`${I(t.name)},${M(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return te?(0,P.jsxs)(l.default,{style:{gap:10},children:[(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,P.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>H(q-1)}),(0,P.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,P.jsx)(d.T,{weight:"semibold",children:re}),le?(0,P.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${le.lockedAt}`}):q>=0?(0,P.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,P.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:q>=0,onPress:()=>H(q+1)})]}),(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Card tips on orders"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.card:ue)})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:"Cash tips"}),(0,P.jsx)(d.T,{children:(0,p.gbp)(le?le.cash:pe)})]}),le?null:(0,P.jsxs)(d.Row,{gap:6,children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:U,onChangeText:W,style:[d.styles.input,{flex:1}]}),(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(U)>=0)||''===U.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...E,[ne]:Math.round(100*Number(U))}}),W('')}})]}),(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,P.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(he)})]}),(0,P.jsx)(d.Muted,{children:de?'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).'})]}),le?(0,P.jsxs)(d.Muted,{children:["Locked with method: ",$[le.method],"."]}):(0,P.jsxs)(d.Card,{children:[(0,P.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,P.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,P.jsx)(d.Chip,{label:$[e],selected:R.method===e,onPress:()=>se&&ae({method:e})},e))}),se?null:(0,P.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===R.method?Object.entries(R.points).map(([e,t])=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{children:e}),(0,P.jsx)(d.Row,{gap:6,children:(0,P.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>se&&ae({points:{...R.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===R.method?(0,P.jsxs)(P.Fragment,{children:[fe.map(e=>(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,P.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(R.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ae({custom:{...R.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ae({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,P.jsxs)(d.T,{size:13,colour:be?m.colours.red:m.colours.ok,children:["Total ",je.toFixed(1),"%",be?' (must be 100%)':' \u2713']})]}):null,(0,P.jsx)(d.Toggle,{label:"Include managers",value:R.includeManagers,onChange:e=>se&&ae({includeManagers:e})}),(0,P.jsx)(d.Toggle,{label:"Include owner",value:R.includeOwner,onChange:e=>se&&ae({includeOwner:e})}),R.includeOwner?(0,P.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,P.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,P.jsxs)(d.T,{center:!0,children:["Points: ",'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013']}),(0,P.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,P.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,P.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(ge)]})]}):(0,P.jsx)(r.default,{horizontal:!0,children:(0,P.jsxs)(l.default,{children:[(0,P.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,P.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),ye.map(e=>{const t=B.find(t=>t.id===e.staffId);return(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,P.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),me[e.staffId]?.est&&!le?'*':'']}),(0,P.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,P.jsx)(d.T,{size:13,style:{width:54},children:'points'===R.method||'points'===le?.method?e.points.toFixed(1):'\u2013'}),(0,P.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,P.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,P.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,P.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,P.jsx)(d.T,{size:13,weight:"bold",colour:ge===he?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(ge)})]})]})}),(0,P.jsxs)(d.Muted,{children:[ge===he?`\u2713 Total equals the pot (${(0,p.gbp)(he)}).`:'\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."]}),le?null:(0,P.jsx)(d.Button,{label:"Approve & lock period",disabled:!se||q>=0||be||ge!==he||he<=0,onPress:()=>{const e=`${(0,h.niceDate)(C)} ${C.toTimeString().slice(0,5)}`,t={id:`tp-${ne}`,key:ne,label:re,end:(0,h.ymd)(ie),pot:he,card:ue,cash:pe,method:R.method,rows:ye,lockedAt:e,by:D};u.useOwner.getState().setOwner({troncHistory:[t,...L],troncLog:[{id:`tl-${Date.now()}`,at:C.toISOString(),text:`${D} approved & locked tips for ${re}: ${(0,p.gbp)(he)} split ${$[R.method].toLowerCase()} between ${ye.filter(e=>e.amount>0).length} staff`},...z]})}}),!le&&q>=0?(0,P.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,se||le?null:(0,P.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,P.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),le?(0,P.jsx)(d.Button,{small:!0,kind:"secondary",label:le.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!le.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${re} approved: ${(0,p.gbp)(le.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:L.map(e=>e.id===le.id?{...e,shared:(0,h.niceDate)(C)}:e)}),ee('Posted to All staff chat.')}}):null]}),Z?(0,P.jsx)(d.Banner,{kind:"info",title:Z}):null,(0,P.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,P.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(he)} = allocated ${(0,p.gbp)(ge)}`],[R.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Ce,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(we)} ${we.getFullYear()}`],[!0,'Tip records kept for 3 years',`${L.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,P.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,P.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,P.jsxs)(l.default,{style:{flex:1},children:[(0,P.jsx)(d.T,{size:14,children:t}),(0,P.jsx)(d.Muted,{children:s})]})]},String(t))),(0,P.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{X(R.text),Q(!0)}})]}),(0,P.jsx)(y.SectionHead,{title:"Tip history & audit log"}),L.map(e=>(0,P.jsxs)(d.Card,{children:[(0,P.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(d.T,{weight:"semibold",children:e.label}),(0,P.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,P.jsxs)(d.Muted,{children:[$[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,P.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),L.length||z.length?null:(0,P.jsx)(d.Muted,{children:"No approved periods yet."}),(0,P.jsxs)(d.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,P.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,P.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Se.map((e,t)=>(0,P.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,P.jsxs)(d.Muted,{children:[re," \xb7 ",$[le?.method??R.method]]})]}),(0,P.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tipping policy",children:[(0,P.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:se,value:J,onChangeText:X,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),se?(0,P.jsx)(d.Button,{label:"Save policy",onPress:()=>{ae({text:J}),Q(!1)}}):null,(0,P.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,P.jsx)(A,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||B()||v.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${D(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${D(i)}`;return(0,P.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,P.jsx)(R,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,P.jsx)(R,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=A;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},M=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',I=e=>(e??'').replace(' (example)','');function O(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const D=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function B(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const F={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,k.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||v.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),B()?{pot:F.pot,today:F.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function R({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${D(s)}`;return(0,P.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,P.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,P.jsx)(d.Muted,{center:!0,children:o}):(0,P.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:D(s)})]})}function A(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,P.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,P.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,P.jsx)(R,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,P.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,P.jsx)(R,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1154,[798,796,806,34,402,295,102,426,794,848,865,836,827,840,1135,1147,1100,1050,1119,985,1024,1048,13,1049,2,25]); -__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,D.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,D.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),w=(0,f.useOwner)(e=>e.swaps),[v,$]=(0,l.useState)(0),[M,O]=(0,l.useState)(null),[R,P]=(0,l.useState)(null),[z,A]=(0,l.useState)('week'),[N,F]=(0,l.useState)(''),[K,U]=(0,l.useState)(''),[G,X]=(0,l.useState)(''),J='staff'!==t,Q=(0,y.addMins)(_(e),7*v*1440);Q.setHours(0,0,0,0);const Z=q(Q),ee=Z.sales,te='none'===Z.mode,se=Array.from({length:7},(e,t)=>{const s=new Date(Q);return s.setDate(Q.getDate()+t),(0,y.ymd)(s)}),ne=(0,f.visibleShifts)(i,J).filter(e=>e.date>=se[0]&&e.date<=se[6]),ae=(()=>{const e=new Date(Q);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),oe=ne.filter(e=>!e.published||e.changed).length,ie=i.filter(e=>e.date>=ae&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),re=se.map(e=>ne.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(h[s.staffId]??0);var s},0)),de=re.reduce((e,t)=>e+t,0),ce=ee.reduce((e,t)=>e+t,0),ue=(e,t)=>t?Math.round(e/t*100):0,he=J?o:o.filter(e=>e.id===n),fe=(0,a.useNarrow)(),me=Math.max(0,se.indexOf((0,y.ymd)(e))),[pe,xe]=(0,l.useState)(null),ge=pe??me,je=(e,t)=>!fe||t===ge,be=fe?150:74;return(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(u.Chip,{label:`Swaps & leave (${w.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(u.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(v-1),O(null)}}),(0,H.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(Q)]}),(0,H.jsxs)(u.Muted,{children:[0===v?'This week':1===v?'Next week':-1===v?'Last week':v>0?`In ${v} weeks`:-v+" weeks ago",J?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(v+1),O(null)}})]}),J?(0,H.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ie?` (${ie})`:''),disabled:!ie,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(ae,se[0]);O(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,H.jsx)(u.Button,{small:!0,kind:"success",label:oe?`Publish ${oe} ${1===oe?'change':'changes'}`:'Week published',disabled:!oe,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(se[0]);O(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),oe?(0,H.jsx)(u.Badge,{kind:"amber",label:`${oe} unpublished`}):ne.length?(0,H.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,M?(0,H.jsx)(u.Banner,{kind:"success",title:M}):null,fe?(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(u.Chip,{label:`${e} ${(0,y.parseYmd)(se[t]).getDate()}`,selected:t===ge,onPress:()=>xe(t)},e))}):null,(0,H.jsx)(d.default,{horizontal:!fe,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(c.default,{style:{gap:4},children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsxs)(u.T,{size:12,weight:"semibold",colour:se[s]===(0,y.ymd)(e)?S.colours.gold:S.colours.text,children:[t," ",(0,y.parseYmd)(se[s]).getDate()]})},t)).filter(je)]}),he.map(e=>(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(ne,e.id,se[s]),a=(m[e.id]??[]).includes(s),o=le(e.id,se[s]);return(0,H.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!J,onPress:()=>P({staffId:e.id,date:se[s],shift:n}),style:{width:be,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?S.colours.gold:S.colours.amber:S.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:o?'Leave':a?'Unavail.':J?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(u.T,{size:9,colour:S.colours.red,children:o?'on leave!':'unavailable'}):n&&J&&(!n.published||n.changed)?(0,H.jsx)(u.T,{size:9,colour:S.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(je)]},e.id)),J?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour"})}),re.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:'example'===Z.mode?'Fcst sales (ex.)':'Fcst sales'})}),ee.map((e,t)=>(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,colour:S.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(je)]}),te?null:(0,H.jsxs)(u.Row,{gap:4,children:[(0,H.jsx)(c.default,{style:{width:96},children:(0,H.jsx)(u.Muted,{children:"Labour %"})}),re.map((e,t)=>{const s=ue(e,ee[t]);return(0,H.jsx)(c.default,{style:{width:be,alignItems:'center'},children:(0,H.jsx)(u.T,{size:11,weight:"semibold",colour:ee[t]?s>32?S.colours.red:s>26?S.colours.amber:S.colours.ok:S.colours.muted,children:ee[t]?`${s}%`:'\u2013'})},t)}).filter(je)]})]}):null]})}),!J&&n?(0,H.jsx)(c.default,{testID:"rota-team-on",children:(0,H.jsx)(u.Card,{children:se.map((e,t)=>(0,H.jsx)(x.TeamOnDay,{date:e,meId:n,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(je)})}):null,J&&te?(0,H.jsx)(u.Card,{children:(0,H.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(c.default,{testID:"labour-week-cost",children:(0,H.jsx)(u.T,{weight:"semibold",children:(0,k.gbp)(de)})})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===Z.weeks?'1 week':`${Z.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),Z.booked?(0,H.jsx)(c.default,{testID:"labour-booked",children:(0,H.jsxs)(u.T,{children:["Booked so far: ",Z.booked," Covers this week"]})}):null]})}):null,J&&!te?(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(u.Row,{gap:6,children:['example'===Z.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(u.Badge,{kind:ue(de,ce)>30?'red':'ok',label:`${ue(de,ce)}% this week`})]})]}),(0,H.jsxs)(u.Muted,{children:[(0,k.gbp)(de)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(ce)," forecast sales. Target 25\u201330%. ",'example'===Z.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=ue(re[5],ee[5]);return e&&e<24?(0,H.jsxs)(u.T,{size:14,colour:S.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,J?(0,H.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>J||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,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(e=>L(s,e)).map(t=>(0,H.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,H.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,I.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),J?null:(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(u.Muted,{testID:"swap-dept-note",children:(0,j.isAnchorageVenue)(b.VENUE_RID)?j.ANCHORAGE_SWAP_NOTE:Y(o.find(e=>e.id===n))?j.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ne.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,I.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>L(o.find(e=>e.id===n),e)).map(t=>(0,H.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)}),ne.some(e=>e.staffId===n)?null:(0,H.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(C.SectionHead,{title:"Holiday & leave"}),p.filter(e=>J||e.staffId===n).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,H.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)((0,y.parseYmd)(e.from))," \u2013 ",(0,y.niceDate)((0,y.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&J?(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.T,{weight:"semibold",children:["Request leave",J?' (as yourself)':'']}),(0,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:N,onChangeText:F,style:[u.styles.input,{flex:1}]}),(0,H.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:K,onChangeText:U,style:[u.styles.input,{flex:1}]})]}),(0,H.jsx)(u.Field,{label:"Reason",value:G,onChangeText:X}),(0,H.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(N)||!/^\d{4}-\d{2}-\d{2}$/.test(K)||K{f.useOwner.getState().addLeave({staffId:n,from:N,to:K,reason:G.trim()||'Holiday'}),F(''),U(''),X('')}})]})]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",J?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),he.filter(e=>'owner'!==e.role||!J).map(e=>(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{gap:8,children:[(0,H.jsx)(T.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(u.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,H.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,D.useCtx)(5e3),x=((0,v.useClockArea)(e=>e.areas[m]),(0,v.areaOf)(m));const j=(0,$.privateClockVenue)(m),[b,w]=(0,l.useState)(!1),k=(0,f.useOwner)(e=>e.consent[a]),C=(0,f.useOwner)(e=>e.attendance),I=(0,f.useOwner)(e=>e.shifts),[B,z]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,N]=(0,l.useState)(null),[F,E]=(0,l.useState)(void 0),[W,_]=(0,l.useState)(null),[q,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=C.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)(I,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,M.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),N(null),E(void 0);const l=await(0,O.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(_(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&_(null),!0):(N(l.message),E(l.fix),(0,R.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 k?(0,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(T.StaffAvatar,{id:a,size:48}),(0,H.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,H.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(c.default,{testID:"clock-area-line",children:(0,H.jsx)(u.T,{size:14,colour:S.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,H.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(c.default,{testID:"on-break",children:(0,H.jsxs)(u.T,{size:15,weight:"semibold",colour:S.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.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,H.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,H.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'):(N(null),z(!0))}})]}):(0,H.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(c.default,{testID:"clock-message",children:(0,H.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===F?(0,H.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===F?(0,H.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===F?(0,H.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,M.areaSet)(x)?(0,H.jsx)(c.default,{testID:"clock-area-warning",children:(0,H.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,H.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(u.T,{size:14,colour:S.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsxs)(u.T,{weight:"semibold",colour:S.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(u.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.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,H.jsx)(u.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(c.default,{style:{gap:12},children:[(0,H.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,H.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,H.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:()=>{w(!1),ae('in')}}),(0,H.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:m,today:t,now:e}):null,G?(0,H.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,H.jsx)(u.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,M.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.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,H.jsx)(c.default,{style:{gap:10},children:(0,H.jsxs)(u.Card,{highlight:S.colours.gold,children:[(0,H.jsx)(u.T,{weight:"semibold",colour:S.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.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,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.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,H.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.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,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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]),S=_r(_d[21]),C=_r(_d[22]),I=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),v=_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]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const Y=e=>(0,j.deptKey)(e?.dept),L=(e,t)=>(0,j.canSwapWith)(e,t,b.VENUE_RID),N=2650,F=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,z.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,w.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*N+t.restOfDay.takeaway*F:0})}},[s,a,o,i,r,(0,y.ymd)(e)])}function V({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,H.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,H.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,H.jsx)(u.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{children:"Start"}),(0,H.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:"End"}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:i,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.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,H.jsxs)(u.Row,{gap:6,children:[(0,H.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:D.fmtH,label:"Break time"}),(0,H.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,H.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,H.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,H.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,H.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({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,D.useSignedIn)(),{me:i,meId:r}=(0,D.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),w=s=>{if(!d)return;const a=(0,O.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,R.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(u.Card,{children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,H.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,H.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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,b]=(0,l.useState)(h?Math.round(60*h.start):720),[w,k]=(0,l.useState)(h?Math.round(60*h.end):1200),[C,I]=(0,l.useState)(''),[T,v]=(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&&w<=j,P=(e,t)=>(0,H.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return T?(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.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,H.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,D.fmtH)(h.start)}\u2013${(0,D.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,y.hm)(new Date(c.in))}\u2013${c.out?(0,y.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,O?(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(u.T,{size:13,colour:S.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(u.Field,{label:"Note for your manager (optional)",value:C,onChangeText:I,placeholder:"e.g. phone died",maxLength:200}),(0,H.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,w):void 0,note:C.trim(),at:t.toISOString()}),v(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.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,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(c.default,{children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(u.T,{size:28,weight:"bold",colour:S.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(u.T,{size:12,colour:S.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(u.T,{size:18,weight:"semibold",colour:w?S.colours.amber:S.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.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,H.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(C.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsxs)(u.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.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,H.jsx)(C.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,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.default,{style:{flex:1},children:[(0,H.jsx)(u.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(u.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.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,H.jsxs)(u.T,{size:13,colour:S.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,H.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,D.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,j]=(0,l.useState)(s),[b,w]=(0,l.useState)(null),[I,v]=(0,l.useState)(!1),$=!!(0,D.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.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),B=P.filter(f.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),Y=B.reduce((t,s)=>t+(0,D.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(B.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,D.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,D.fmtH)(a.start)}-${(0,D.fmtH)(a.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.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,H.jsxs)(c.default,{style:{gap:10},children:[(0,H.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,H.jsx)(u.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(u.Card,{children:[(0,H.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(u.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(u.T,{size:13,colour:S.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(u.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(a.WideTable,{children:(0,H.jsxs)(c.default,{style:{gap:2},children:[(0,H.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:S.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(u.T,{size:12,weight:"semibold",colour:S.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,D.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(T.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:l?`${(0,D.fmtH)(l.start)}\u2013${(0,D.fmtH)(l.end)}`:'\u2013'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?S.colours.ok:'open'===(0,f.attStatus)(t)?S.colours.blue:S.colours.amber,children:(0,m.statusLabel)(t)}),(0,H.jsx)(u.T,{size:11,style:{width:140},colour:c.length?S.colours.amber:S.colours.ok,children:c.join(', ')||'OK'}),(0,H.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(u.T,{size:12,colour:S.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(u.T,{size:12,style:{width:86},colour:S.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?S.colours.muted:S.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,H.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>v(!0)}),(0,H.jsx)(C.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(u.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(u.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(m.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(u.Sheet,{visible:I,onClose:()=>v(!1),title:"Payroll export",children:[(0,H.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(u.T,{size:10,colour:t?S.colours.text:S.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,796,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); +__d(function(g,_r,_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=q,_e.Rota=function(){const{now:e,role:t,meId:s}=(0,D.useCtx)(6e4),a=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,h.useOwner)(e=>e.shifts),u=(0,D.useHourly)(),f=(0,h.useOwner)(e=>e.availability),m=(0,h.useOwner)(e=>e.leave),w=(0,h.useOwner)(e=>e.swaps),[T,$]=(0,i.useState)(0),[O,M]=(0,i.useState)(null),[R,P]=(0,i.useState)(null),[z,A]=(0,i.useState)('week'),[F,Y]=(0,i.useState)(!1),K=(0,D.useSignedIn)()?.name??'',U='staff'!==t,G=(0,y.addMins)(_(e),7*T*1440);G.setHours(0,0,0,0);const X=q(G),J=X.sales,Q='none'===X.mode,Z=Array.from({length:7},(e,t)=>{const s=new Date(G);return s.setDate(G.getDate()+t),(0,y.ymd)(s)}),ee=(0,h.visibleShifts)(o,U).filter(e=>e.date>=Z[0]&&e.date<=Z[6]),te=(()=>{const e=new Date(G);return e.setDate(e.getDate()-7),(0,y.ymd)(e)})(),se=ee.filter(e=>!e.published||e.changed).length,ne=o.filter(e=>e.date>=te&&e.date!!(0,h.leaveOn)(m,e,t),oe=Z.map(e=>ee.filter(t=>t.date===e).reduce((e,t)=>{return e+(E(s=t)-W(E(s)))*(u[s.staffId]??0);var s},0)),ie=oe.reduce((e,t)=>e+t,0),le=J.reduce((e,t)=>e+t,0),re=(e,t)=>t?Math.round(e/t*100):0,de=U?a:a.filter(e=>e.id===s),ce=(0,n.useNarrow)(),ue=Math.max(0,Z.indexOf((0,y.ymd)(e))),[he,fe]=(0,i.useState)(null),me=he??ue,pe=(e,t)=>!ce||t===me,xe=ce?150:74;return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Week",selected:'week'===z,onPress:()=>A('week')}),(0,H.jsx)(c.Chip,{label:`Swaps & time off (${w.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===z,onPress:()=>A('requests')}),(0,H.jsx)(c.Chip,{label:"Availability",selected:'availability'===z,onPress:()=>A('availability')})]}),'week'===z?(0,H.jsxs)(H.Fragment,{children:[!U&&s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-time-off"}):null,(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{$(T-1),M(null)}}),(0,H.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,H.jsxs)(c.T,{weight:"semibold",children:["Week of ",(0,y.niceDate)(G)]}),(0,H.jsxs)(c.Muted,{children:[0===T?'This week':1===T?'Next week':-1===T?'Last week':T>0?`In ${T} weeks`:-T+" weeks ago",U?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{$(T+1),M(null)}})]}),U?(0,H.jsxs)(c.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,H.jsx)(c.Button,{small:!0,kind:"secondary",label:"Copy last week"+(ne?` (${ne})`:''),disabled:!ne,testID:"rota-copy",onPress:()=>{const e=h.useOwner.getState().copyWeek(te,Z[0]);M(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,H.jsx)(c.Button,{small:!0,kind:"success",label:se?`Publish ${se} ${1===se?'change':'changes'}`:'Week published',disabled:!se,testID:"rota-publish",onPress:()=>{const e=h.useOwner.getState().publishWeek(Z[0]);M(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),se?(0,H.jsx)(c.Badge,{kind:"amber",label:`${se} unpublished`}):ee.length?(0,H.jsx)(c.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,O?(0,H.jsx)(c.Banner,{kind:"success",title:O}):null,ce?(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:D.DAY3.map((e,t)=>(0,H.jsx)(c.Chip,{label:`${e} ${(0,y.parseYmd)(Z[t]).getDate()}`,selected:t===me,onPress:()=>fe(t)},e))}):null,(0,H.jsx)(r.default,{horizontal:!ce,showsHorizontalScrollIndicator:!0,children:(0,H.jsxs)(d.default,{style:{gap:4},children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:126}}),D.DAY3.map((t,s)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsxs)(c.T,{size:12,weight:"semibold",colour:Z[s]===(0,y.ymd)(e)?I.colours.gold:I.colours.text,children:[t," ",(0,y.parseYmd)(Z[s]).getDate()]})},t)).filter(pe)]}),de.map(e=>(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsxs)(c.Row,{gap:6,style:{width:126},children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:26}),(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,H.jsx)(c.Muted,{numberOfLines:1,children:e.job})]})]}),D.DAY3.map((t,s)=>{const n=(0,h.shiftOf)(ee,e.id,Z[s]),a=(f[e.id]??[]).includes(s),o=ae(e.id,Z[s]);return(0,H.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${D.DAY3[s]} ${n?`${(0,D.fmtH)(n.start)} to ${(0,D.fmtH)(n.end)}`:'no shift'}`,disabled:!U,onPress:()=>P({staffId:e.id,date:Z[s],shift:n}),style:{width:xe,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?I.colours.gold:I.colours.amber:I.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,H.jsxs)(c.T,{size:11,weight:"semibold",children:[(0,D.fmtH)(n.start),"\u2013",(0,D.fmtH)(n.end)]}):(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:o?'Off':a?'Unavail.':U?'Add':'\u2013'}),n&&(a||o)?(0,H.jsx)(c.T,{size:9,colour:I.colours.red,children:o?'on leave!':'unavailable'}):n&&U&&(!n.published||n.changed)?(0,H.jsx)(c.T,{size:9,colour:I.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(pe)]},e.id)),U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour"})}),oe.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,children:(0,k.gbp)(e).replace('.00','')})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:'example'===X.mode?'Fcst sales (ex.)':'Fcst sales'})}),J.map((e,t)=>(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,colour:I.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(pe)]}),Q?null:(0,H.jsxs)(c.Row,{gap:4,children:[(0,H.jsx)(d.default,{style:{width:96},children:(0,H.jsx)(c.Muted,{children:"Labour %"})}),oe.map((e,t)=>{const s=re(e,J[t]);return(0,H.jsx)(d.default,{style:{width:xe,alignItems:'center'},children:(0,H.jsx)(c.T,{size:11,weight:"semibold",colour:J[t]?s>32?I.colours.red:s>26?I.colours.amber:I.colours.ok:I.colours.muted,children:J[t]?`${s}%`:'\u2013'})},t)}).filter(pe)]})]}):null]})}),!U&&s?(0,H.jsx)(d.default,{testID:"rota-team-on",children:(0,H.jsx)(c.Card,{children:Z.map((e,t)=>(0,H.jsx)(p.TeamOnDay,{date:e,meId:s,label:(0,y.niceDate)((0,y.parseYmd)(e))},e)).filter(pe)})}):null,U&&Q?(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour this week"}),(0,H.jsx)(d.default,{testID:"labour-week-cost",children:(0,H.jsx)(c.T,{weight:"semibold",children:(0,k.gbp)(ie)})})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,H.jsx)(c.Muted,{children:`Forecasts start once CoverCharge has ${1===X.weeks?'1 week':`${X.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),X.booked?(0,H.jsx)(d.default,{testID:"labour-booked",children:(0,H.jsxs)(c.T,{children:["Booked so far: ",X.booked," Covers this week"]})}):null]})}):null,U&&!Q?(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,H.jsxs)(c.Row,{gap:6,children:['example'===X.mode?(0,H.jsx)(B.ExampleBadge,{}):null,(0,H.jsx)(c.Badge,{kind:re(ie,le)>30?'red':'ok',label:`${re(ie,le)}% this week`})]})]}),(0,H.jsxs)(c.Muted,{children:[(0,k.gbp)(ie)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,k.gbp)(le)," forecast sales. Target 25\u201330%. ",'example'===X.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=re(oe[5],J[5]);return e&&e<24?(0,H.jsxs)(c.T,{size:14,colour:I.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,U?(0,H.jsx)(c.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'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S.SectionHead,{title:"Shift swaps & cover"}),w.filter(e=>U||e.fromId===s||e.toId===s).map(e=>{const t=o.find(t=>t.id===e.shiftId),s=a.find(t=>t.id===e.fromId),n=a.find(t=>t.id===e.toId);return(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,H.jsxs)(c.Muted,{children:[t?`${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:a.filter(e=>L(s,e)).map(t=>(0,H.jsx)(c.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{h.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,H.jsx)(c.Button,{small:!0,label:"Approve",disabled:!e.toId||!L(s,n),onPress:()=>{h.useOwner.getState().setSwap(e.id,'approved');const s=e=>(a.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,C.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?` (${D.DAY3[t.day]} ${(0,D.fmtH)(t.start)}\u2013${(0,D.fmtH)(t.end)})`:''}`)}}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),U?null:(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,H.jsx)(c.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,H.jsx)(c.Muted,{testID:"swap-dept-note",children:(0,x.isAnchorageVenue)(j.VENUE_RID)?x.ANCHORAGE_SWAP_NOTE:N(a.find(e=>e.id===s))?x.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),ee.filter(e=>e.staffId===s).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=w.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,H.jsxs)(d.default,{style:{gap:4,paddingVertical:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:14,weight:"medium",children:[D.DAY3[e.day]," ",(0,D.fmtH)(e.start),"\u2013",(0,D.fmtH)(e.end)]}),t?(0,H.jsx)(c.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Ask for cover",onPress:()=>{h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,kind:'cover',note:'Can anyone cover?'}),(0,C.autoPost)('all',`Cover needed: ${D.DAY3[e.day]} ${(0,D.fmtH)(e.start)}\u2013${(0,D.fmtH)(e.end)} (${(a.find(e=>e.id===s)?.name??'').replace(' (example)','')})`)}}),a.filter(e=>L(a.find(e=>e.id===s),e)).map(t=>(0,H.jsx)(c.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>h.useOwner.getState().addSwap({shiftId:e.id,fromId:s,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),ee.some(e=>e.staffId===s)?null:(0,H.jsx)(c.Muted,{children:"No shifts on the rota this week."})]}),(0,H.jsx)(S.SectionHead,{title:"Holiday & time off"}),U?(0,H.jsx)(c.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>Y(!0)}):s?(0,H.jsx)(b.RequestTimeOff,{meId:s,me:K,testID:"rota-requests-time-off"}):null,m.filter(e=>U||e.staffId===s).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,H.jsx)(c.Card,{children:(0,H.jsxs)(d.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,H.jsx)(c.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,H.jsxs)(c.Muted,{children:[(0,b.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&U?(0,H.jsxs)(c.Row,{gap:6,style:{justifyContent:'center'},children:[(0,H.jsx)(c.Button,{small:!0,label:"Approve",onPress:()=>h.useOwner.getState().setLeave(e.id,'approved')}),(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>h.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),U&&s?(0,H.jsx)(b.TimeOffSheet,{visible:F,onClose:()=>Y(!1),meId:s,me:K,manager:!0}):null]}):null,'availability'===z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.Muted,{children:["Days each person can\u2019t work. ",U?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),de.filter(e=>'owner'!==e.role||!U).map(e=>(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{gap:8,children:[(0,H.jsx)(v.StaffAvatar,{id:e.id,size:30}),(0,H.jsx)(c.T,{weight:"semibold",children:e.name})]}),(0,H.jsx)(c.Row,{wrap:!0,gap:4,children:D.DAY3.map((t,s)=>{const n=(f[e.id]??[]).includes(s);return(0,H.jsx)(c.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>h.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,R?(0,H.jsx)(V,{init:R,onClose:()=>P(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:n,meId:r,me:u,r:f,rid:p}=(0,D.useCtx)(5e3),x=((0,T.useClockArea)(e=>e.areas[p]),(0,T.areaOf)(p));const j=(0,$.privateClockVenue)(p),[b,w]=(0,i.useState)(!1),k=(0,h.useOwner)(e=>e.consent[r]),S=(0,h.useOwner)(e=>e.attendance),C=(0,h.useOwner)(e=>e.shifts),[B,z]=(0,i.useState)(!1),[A,N]=(0,i.useState)(null),[L,F]=(0,i.useState)(null),[Y,E]=(0,i.useState)(void 0),[W,_]=(0,i.useState)(null),[q,V]=(0,i.useState)(!1),[G,X]=(0,i.useState)(null),J=S.filter(t=>t.staffId===r&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,h.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,h.visibleShifts)(C,'staff'!==n).find(e=>e.staffId===r&&e.date===t),ee='staff'!==n,te=J?(0,D.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,O.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{N(s),F(null),E(void 0);const i=await(0,M.clockAction)(s,{rid:p,staffId:r,date:t,at:new Date(e.getTime()).toISOString(),...n});return N(null),i.ok?('out'===s&&i.att&&(_(i.att),(0,o.hrSettingsOf)(f.settings?.hr).on&&!a.useHr.getState().hasAnswered(p,i.att.id)&&X(i.att)),'in'===s&&_(null),!0):(F(i.message),E(i.fix),(0,R.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:i.message.split('. ')[0]+'.',body:i.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.Row,{gap:10,style:{flex:1},children:[(0,H.jsx)(v.StaffAvatar,{id:r,size:48}),(0,H.jsx)(c.T,{weight:"semibold",style:{flex:1},children:u})]}),(0,H.jsx)(c.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,y.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,H.jsx)(c.Muted,{children:Z?`Today's shift: ${(0,D.fmtH)(Z.start)}\u2013${(0,D.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,H.jsx)(d.default,{testID:"clock-area-line",children:(0,H.jsx)(c.T,{size:14,colour:I.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${f.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${f.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,H.jsxs)(c.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,H.jsx)(c.T,{size:30,weight:"bold",center:!0,children:(0,D.hmDur)(te)}):null,J&&Q?(0,H.jsx)(d.default,{testID:"on-break",children:(0,H.jsxs)(c.T,{size:15,weight:"semibold",colour:I.colours.gold,center:!0,children:["On a break since ",(0,y.hm)(new Date(Q.start))," \xb7 ",(0,h.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,H.jsxs)(H.Fragment,{children:[Q?(0,H.jsx)(c.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,H.jsx)(c.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,H.jsx)(c.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),z(!0))}})]}):(0,H.jsx)(c.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?w(!0):ae('in')}}),J?.breaks?.length?(0,H.jsxs)(c.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,y.hm)(new Date(e.start))}\u2013${e.end?(0,y.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,h.loggedBreakMins)(J,e)," min)"]}):null,L?(0,H.jsx)(d.default,{testID:"clock-message",children:(0,H.jsx)(c.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:P.openAppSettings}):null,L&&'location'===Y?(0,H.jsx)(c.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:P.openLocationSettings}):null,L&&'update'===Y?(0,H.jsx)(c.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:P.checkAppUpdate}):null]}),ee&&!(0,O.areaSet)(x)?(0,H.jsx)(d.default,{testID:"clock-area-warning",children:(0,H.jsx)(c.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,H.jsx)(l.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,H.jsx)(c.T,{size:14,colour:I.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,H.jsx)(U,{onClose:()=>V(!1)}):null,(0,H.jsx)(m.BreakRoomCard,{staffId:r,name:u,now:e}),W?(()=>{const t=(0,D.paidMins)(W,e);return(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsxs)(c.T,{weight:"semibold",colour:I.colours.gold,children:["Clocked out at ",(0,y.hm)(new Date(W.out))]}),(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Clocked ",(0,D.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,D.hmDur)(t.paid)]}),(0,H.jsxs)(c.Muted,{children:["In ",(0,y.hm)(new Date(W.in))," \xb7 out ",(0,y.hm)(new Date(W.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",W.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,H.jsx)(c.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,H.jsx)(c.Sheet,{visible:b,onClose:()=>w(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,H.jsxs)(d.default,{style:{gap:12},children:[(0,H.jsxs)(c.T,{children:["We check once that you are at ",f.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,H.jsx)(c.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,H.jsx)(c.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{w(!1),ae('in')}}),(0,H.jsx)(c.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>w(!1)})]})}),ee?(0,H.jsx)(K,{rid:p,today:t,now:e}):null,G?(0,H.jsx)(s.ShiftCheckout,{rid:p,shiftKey:G.id,day:G.date,meId:r,onClose:()=>X(null)}):null,(0,H.jsx)(c.Sheet,{visible:B,onClose:()=>z(!1),title:"Did you take a break? If so, how long?",children:(0,H.jsxs)(d.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,H.jsx)(c.Chip,{testID:`forgot-break-${e}`,label:(0,O.breakLabel)(e),disabled:e>=te,onPress:()=>{z(!1),ae('out',{addedBreak:e})}},e))}),(0,H.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{z(!1),ae('out',{breakMins:0})}}),te>360?(0,H.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,H.jsx)(c.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,H.jsx)(d.default,{style:{gap:10},children:(0,H.jsxs)(c.Card,{highlight:I.colours.gold,children:[(0,H.jsx)(c.T,{weight:"semibold",colour:I.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(c.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",f.name,", within about ",x.radius," m."]}),(0,H.jsx)(c.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,H.jsxs)(H.Fragment,{children:[" ",(0,H.jsxs)(c.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,H.jsx)(c.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 ",f.name," (within about ",x.radius," m)."]}),(0,H.jsx)(c.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,H.jsx)(c.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,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,H.jsx)(c.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,H.jsx)(c.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,H.jsx)(c.Button,{label:"I understand \u2014 continue",onPress:()=>h.useOwner.getState().giveConsent(r,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,D.useCtx)(3e4);return s!=='staff'?(0,H.jsx)(X,{now:e,today:t,meId:n}):(0,H.jsx)(G,{})};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=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),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]),I=_r(_d[21]),S=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),H=_r(_d[35]);const N=e=>(0,x.deptKey)(e?.dept),L=(e,t)=>(0,x.canSwapWith)(e,t,j.VENUE_RID),F=2650,Y=1900,E=e=>e.end-e.start,W=e=>e>8?.5:e>6?.3333333333333333:0,_=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,D.weekday)(e)),t};function q(e){const{rid:t,r:s,now:n}=(0,D.useCtx)(6e4),a=(0,u.useBookings)(t),o=(0,u.useOrders)(t),l=(0,u.useEvents)(t),r=(0,B.useRealHistory)(t,n);return(0,i.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,y.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,y.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),i=(0,z.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:i,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:i,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:i,booked:n,sales:t.map(e=>{const t=(0,w.forecastToday)(s,a,o,l,e);return t.open?t.restOfDay.covers*F+t.restOfDay.takeaway*Y:0})}},[s,a,o,l,r,(0,y.ymd)(e)])}function V({init:e,onClose:t}){const s=(0,h.useOwner)(e=>e.staff),[n,a]=(0,i.useState)(e.shift?.start??12),[o,l]=(0,i.useState)(e.shift?.end??20),[r,u]=(0,i.useState)(e.shift?.breakAt),f=void 0===r||r>n&&rt.id===e.staffId),p=(0,h.leaveOn)((0,h.useOwner)(e=>e.leave),e.staffId,e.date);return(0,H.jsxs)(c.Sheet,{visible:!0,onClose:t,title:(0,A.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[p?(0,H.jsx)(c.Banner,{kind:"warn",title:`${(m?.name??'').replace(' (example)','')} has time off: ${(0,b.rangeLabel)(p.from,p.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,H.jsx)(c.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,H.jsx)(c.Chip,{label:`${e} ${(0,D.fmtH)(t)}\u2013${(0,D.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),l(s)}},e))}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{children:"Start"}),(0,H.jsx)(c.Stepper,{testID:"shift-start",value:n,step:.5,min:A.SHIFT_MIN_START,max:o-1,onChange:a,format:D.fmtH,label:"Start time"})]}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:"End"}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:A.SHIFT_MAX_END,onChange:l,format:D.fmtH,label:"End time"}),o>=24?(0,H.jsx)(c.Muted,{children:"next day"}):null]})]}),(0,H.jsxs)(c.Muted,{children:[(o-n).toFixed(1),"h scheduled",W(o-n)?`, ${Math.round(60*W(o-n))}m planned break`:'']}),(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,H.jsx)(c.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,H.jsx)(c.Chip,{label:"Set a break time",onPress:()=>u(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,H.jsxs)(c.Row,{gap:6,children:[(0,H.jsx)(c.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:u,format:D.fmtH,label:"Break time"}),(0,H.jsx)(c.Chip,{label:"No set time",onPress:()=>u(void 0)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=h.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:f?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&f?{breakAt:r}:{}}),t()}}),(0,H.jsx)(c.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,H.jsx)(c.Button,{kind:"danger",label:"Remove shift",onPress:()=>{h.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function K({rid:e,today:t,now:s}){const n=(0,h.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,h.useOwner)(e=>e.attendance),o=(0,D.useSignedIn)(),{me:l,meId:r}=(0,D.useCtx)(3e4),[d,u]=(0,i.useState)(null),[f,m]=(0,i.useState)(''),[p,x]=(0,i.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,h.isOnBreak)(j),w=s=>{if(!d)return;const a=(0,M.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??l},f);if(!a.ok)return void x(a.message);const i=n.find(e=>e.id===d)?.name??'them';(0,R.notify)({id:'mgr-clock',title:`Recorded for ${i}`,body:`Reason kept with the record: ${f.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,H.jsxs)(c.Card,{children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Record it for someone"}),(0,H.jsx)(c.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,H.jsx)(c.Row,{wrap:!0,gap:6,children:n.map(e=>(0,H.jsx)(c.Chip,{label:e.name,selected:d===e.id,onPress:()=>u(e.id)},e.id))}),d?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Field,{label:"Reason (kept with the record)",value:f,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:j?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>w(b?'break_end':'break_start')}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Clock them out",onPress:()=>w('out')})]}):(0,H.jsx)(c.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>w('in')})}),p?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:p}):null]}):null]})}function U({onClose:e}){const{now:t,today:s,meId:n}=(0,D.useCtx)(3e4),a=(0,h.useOwner)(e=>e.attendance),o=(0,h.useOwner)(e=>e.shifts),l=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),[r,d]=(0,i.useState)(s),u=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],m=(0,h.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,i.useState)(u&&!u.out?'out':'in'),[j,b]=(0,i.useState)(m?Math.round(60*m.start):720),[w,k]=(0,i.useState)(m?Math.round(60*m.end):1200),[S,C]=(0,i.useState)(''),[v,T]=(0,i.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,O='out'!==p,M='in'!==p,R=O&&M&&w<=j,P=(e,t)=>(0,H.jsx)(c.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,H.jsx)(c.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return v?(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,H.jsx)(c.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,H.jsx)(c.Button,{label:"Done",onPress:e})]}):(0,H.jsxs)(c.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,H.jsx)(c.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,H.jsxs)(c.Muted,{children:[m?`Your rota that day: ${(0,D.fmtH)(m.start)}\u2013${(0,D.fmtH)(m.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,y.hm)(new Date(u.in))}\u2013${u.out?(0,y.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,H.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(c.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,H.jsx)(c.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,H.jsx)(c.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),O?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(b,j)]}):null,M?(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(c.T,{size:18,weight:"bold",children:["Out ",$(w),w>=1440?' (next day)':'']}),P(k,w)]}):null,R?(0,H.jsx)(c.T,{size:13,colour:I.colours.red,children:"Clock-out must be after clock-in."}):null,(0,H.jsx)(c.Field,{label:"Note for your manager (optional)",value:S,onChangeText:C,placeholder:"e.g. phone died",maxLength:200}),(0,H.jsx)(c.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{h.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:u?.id,kind:p,suggestedIn:O?(0,f.isoAt)(r,j):void 0,suggestedOut:M?(0,f.isoAt)(r,w):void 0,note:S.trim(),at:t.toISOString()}),T(!0)}})]})}function G(){const{now:e,today:t,meId:s}=(0,D.useCtx)(3e4),n=(0,h.useOwner)(e=>e.attendance),a=(0,h.useOwner)(e=>e.shifts),o=(0,h.useOwner)(e=>e.timeRequests),[l,r]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),p=(0,y.ymd)(_(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),b=j.filter(h.isConfirmed).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),w=j.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),k=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,H.jsxs)(d.default,{style:{gap:10},testID:"my-timesheet",children:[(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,H.jsxs)(d.default,{children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,H.jsx)(c.T,{size:28,weight:"bold",colour:I.colours.ok,children:(0,D.hmDur)(b)})]}),(0,H.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,H.jsx)(c.T,{size:12,colour:I.colours.muted,children:"PENDING SIGN-OFF"}),(0,H.jsx)(c.T,{size:18,weight:"semibold",colour:w?I.colours.amber:I.colours.muted,children:(0,D.hmDur)(w)})]})]}),(0,H.jsx)(c.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,H.jsx)(c.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),k.length?(0,H.jsx)(S.SectionHead,{title:"My correction requests"}):null,k.map(e=>(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsxs)(c.T,{size:14,children:[(0,y.niceDate)((0,y.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,H.jsxs)(c.Muted,{children:[e.suggestedIn?`in ${(0,y.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,y.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,H.jsx)(c.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,H.jsx)(S.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,h.shiftOf)((0,h.visibleShifts)(a,!1),t.staffId,t.date),n=(0,D.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,H.jsxs)(c.Card,{onPress:()=>m(u===t.id?null:t.id),children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(d.default,{style:{flex:1},children:[(0,H.jsx)(c.T,{weight:"semibold",children:(0,y.niceDate)((0,y.parseYmd)(t.date))}),(0,H.jsxs)(c.Muted,{children:[(0,y.hm)(new Date(t.in)),"\u2013",t.out?(0,y.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,D.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,D.fmtH)(s.start)}\u2013${(0,D.fmtH)(s.end)}`:'']})]}),(0,H.jsx)(c.Badge,{kind:(0,f.statusKind)(t),label:'awaiting'===(0,h.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,f.statusLabel)(t)})]}),o?(0,H.jsxs)(c.T,{size:13,colour:I.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,H.jsxs)(c.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,u===t.id?(0,H.jsx)(f.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,H.jsx)(c.Muted,{children:"No clocked shifts yet."}),l?(0,H.jsx)(U,{onClose:()=>r(!1)}):null]})}function X({now:e,today:s}){const a=(0,h.useOwner)(e=>e.staff),o=(0,h.useOwner)(e=>e.shifts),r=(0,D.useHourly)(),u=(0,h.useOwner)(e=>e.attendance),m=(0,h.useOwner)(e=>e.timeRequests),p=(0,h.useOwner)(e=>e.attLog),[x,j]=(0,i.useState)(s),[b,w]=(0,i.useState)(null),[C,T]=(0,i.useState)(!1),$=!!(0,D.useSignedIn)(),O=Array.from({length:7},(e,t)=>(0,y.ymd)((0,y.addMins)((0,y.parseYmd)(s),1440*-t))),M=u.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!M.some(t=>t.staffId===e.staffId)),P=u.filter(e=>O.includes(e.date)&&e.out),B=P.filter(h.isConfirmed),z=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,h.isConfirmed)(e)).reduce((t,s)=>t+(0,D.paidMins)(s,e).paid,0),N=B.reduce((t,s)=>t+(0,D.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(B.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=a.find(e=>e.id===t.staffId),n=(0,h.shiftOf)(o,t.staffId,t.date),i=(0,D.paidMins)(t,e),l=r[t.staffId]??0;return`${s?.name},${t.date},${n?`${(0,D.fmtH)(n.start)}-${(0,D.fmtH)(n.end)}`:'-'},${(0,y.hm)(new Date(t.in))},${(0,y.hm)(new Date(t.out))},${i.brk},${(i.paid/60).toFixed(2)},${(l/100).toFixed(2)},${(i.paid/60*l/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,H.jsxs)(d.default,{style:{gap:10},children:[(0,H.jsx)(c.Row,{wrap:!0,gap:6,children:O.map(e=>(0,H.jsx)(c.Chip,{label:e===s?'Today':(0,y.niceDate)((0,y.parseYmd)(e)).slice(0,6).trim(),selected:x===e,onPress:()=>j(e)},e))}),(0,H.jsxs)(c.Card,{children:[(0,H.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(c.T,{weight:"semibold",children:"Last 7 days"}),(0,H.jsx)(c.Badge,{kind:"ok",label:`${(0,D.hmDur)(z)} confirmed`})]}),A?(0,H.jsxs)(c.T,{size:13,colour:I.colours.amber,children:[(0,D.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,H.jsxs)(c.Muted,{children:["Labour cost ",(0,k.gbp)(Math.round(N))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,H.jsx)(n.WideTable,{children:(0,H.jsxs)(d.default,{style:{gap:2},children:[(0,H.jsx)(n.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:I.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,H.jsx)(c.T,{size:12,weight:"semibold",colour:I.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),M.map(t=>{const i=a.find(e=>e.id===t.staffId),r=(0,h.shiftOf)(o,t.staffId,x),d=(0,D.paidMins)(t,e),u=(0,f.flagsFor)(t,r,e,s,m).map(e=>e.label);return(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,H.jsxs)(c.Row,{gap:4,style:{width:110},children:[(0,H.jsx)(v.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,H.jsx)(c.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,H.jsx)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:r?`${(0,D.fmtH)(r.start)}\u2013${(0,D.fmtH)(r.end)}`:'\u2013'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:(0,y.hm)(new Date(t.in))}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?(0,y.hm)(new Date(t.out)):'on'}),(0,H.jsx)(c.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,H.jsx)(c.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,D.hmDur)(d.paid):`${(0,D.hmDur)(d.worked)}\u2026`}),(0,H.jsx)(c.T,{size:11,style:{width:120},colour:'confirmed'===(0,h.attStatus)(t)?I.colours.ok:'open'===(0,h.attStatus)(t)?I.colours.blue:I.colours.amber,children:(0,f.statusLabel)(t)}),(0,H.jsx)(c.T,{size:11,style:{width:140},colour:u.length?I.colours.amber:I.colours.ok,children:u.join(', ')||'OK'}),(0,H.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>w(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,H.jsx)(c.T,{size:12,colour:I.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,H.jsxs)(n.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,H.jsx)(c.T,{size:12,style:{width:110},children:a.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,H.jsxs)(c.T,{size:12,style:{width:86},colour:I.colours.muted,children:[(0,D.fmtH)(t.start),"\u2013",(0,D.fmtH)(t.end)]}),(0,H.jsx)(c.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?I.colours.muted:I.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),M.length||R.length?null:(0,H.jsx)(c.Muted,{children:"No shifts or clock records for this day."}),(0,H.jsx)(c.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,H.jsx)(c.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,H.jsx)(S.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,H.jsxs)(c.Muted,{children:[(0,y.niceDate)(new Date(e.at))," ",(0,y.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(c.Muted,{children:"No manual changes yet."}),b?(0,H.jsx)(f.OverrideSheet,{a:b,staffId:b.staffId,date:b.date,onClose:()=>w(null)}):null,(0,H.jsxs)(c.Sheet,{visible:C,onClose:()=>T(!1),title:"Payroll export",children:[(0,H.jsxs)(c.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,D.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,H.jsxs)(d.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,H.jsx)(c.T,{size:10,colour:t?I.colours.text:I.colours.gold,children:e},t)),L.length>14?(0,H.jsxs)(c.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,H.jsxs)(c.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1155,[798,1156,1146,998,999,34,402,295,102,794,848,865,1157,1137,1158,1102,5,1159,1120,836,827,840,1147,1135,1100,899,1027,991,992,1071,994,1072,1125,1123,1103,25]); __d(function(g,_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)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1156,[796,34,402,102,794,840,865,800,850,998,999,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),H=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),N=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(N.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),N.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(N.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:H.length?`Confirm all unflagged (${H.length})`:'Nothing unflagged to confirm',disabled:!H.length,onPress:()=>Y(H.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[H,N]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[H,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:H===e,onPress:()=>N(H===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:H?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),N=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),H=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(H.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),H.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(H.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:N.length?`Confirm all unflagged (${N.length})`:'Nothing unflagged to confirm',disabled:!N.length,onPress:()=>Y(N.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[N,H]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[N,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:N===e,onPress:()=>H(N===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:N?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},1157,[796,34,402,102,794,899,865,827,840,1147,1100,25]); __d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TeamOnDay=function({date:e,meId:t,label:p}){const b=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.staff),f=(0,s.useMemo)(()=>(0,c.teamOnDay)(b,j,e,t),[b,j,e,t]);return(0,h.jsxs)(l.default,{testID:`team-on-${e}`,accessible:!0,accessibilityLabel:(0,c.teamOnDaySpoken)(p,f),style:{gap:6,alignItems:'center',paddingVertical:4},children:[(0,h.jsxs)(n.T,{size:14,weight:"semibold",colour:u.colours.gold,center:!0,children:["Also on ",p]}),f.length?f.map(e=>(0,h.jsxs)(l.default,{testID:"team-on-dept",style:{gap:2,alignItems:'center'},children:[(0,h.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:e.dept}),e.people.map(e=>(0,h.jsxs)(n.T,{size:13,center:!0,children:[e.name,e.job?(0,h.jsxs)(n.T,{size:13,colour:u.colours.muted,children:[" \xb7 ",e.job]}):null," \xb7 ",e.times]},e.id))]},e.dept)):(0,h.jsx)(n.Muted,{center:!0,size:13,children:"Nobody else is on the rota."})]})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6])},1158,[34,102,794,865,1102,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1159,[34,102,794,865,840,1100,1103,1158,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1160,[34,102,1100,840,794,25]); -__d(function(g,r,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]})}},1161,[796,34,402,102,794,1019,840,928,25]); -__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1162,[796,1163,804,865,34,336,402,102,794,1019,1020,840,899,928,1164,1167,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1163,[34,1019,865,804]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1164,[798,796,1163,804,865,34,336,402,102,900,794,899,1019,1020,1165,840,928,1166,25]); -__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1165,[]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1166,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1167,[34,379,236,102,794,865,1019,1166,1020,1168,840,928,1163,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1168,[1020]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1169,[]); -__d(function(g,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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1170,[829,34,236,402,102,900,848,840,794,1171,1099,1172,25]); -__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1171,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); -__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1172,[1173,1174,1176,1175,1177,1033,1178]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1173,[]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1174,[808,5,815,818,846,1033,1175]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1175,[829,236,846,1173]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1176,[34,848,830,838,836,1174,1173]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1177,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1178,[34,1174,985,931]); -__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1179,[34,402,102,426,848,830,840,794,1170,1099,1180,25]); -__d(function(g,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}},1180,[34,102,426,848,830,1172,1033,840,794,1099,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1181,[34,236,402,102,853,794,840,994,1182,1183,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1182,[846,6,931,974,994,1172,1183]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1183,[808,1184,815,818]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1184,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1185,[34,846,1182]); -__d(function(g,_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,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1186,[796,1163,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1187,[34,402,346,102,426,840,1153,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1188,[30,34,792,846,25]); -__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1189,[829,1097,851,30,34,1190,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); -__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])},1190,[796,34,236,102,25]); -__d(function(_g,_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"})]})]})}},1191,[30,34,336,102,1192,1194,794,830,836,848,856,840,25]); -__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1192,[34,1193,102,830,840,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1193,[2,985]); -__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])},1194,[30,34,402,848,840,794,25]); -__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1195,[30,34,794,1196,848,1181,25]); -__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])},1196,[34,402,840,794,25]); -__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1197,[806,30,34,1198,794,836,848,840,1199,1203,25]); -__d(function(_g,r,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])},1198,[34,385,102,848,836,840,794,25]); -__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}},1199,[34,102,794,836,1200,1201,1202,840,25]); -__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})},1200,[]); -__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})},1201,[]); -__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()})},1202,[931,985,1201]); -__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}},1203,[815,931,974,985,2,1200]); -__d(function(g,_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 H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1204,[1205,1214,5,1215,1216,1217,1220,829,30,34,236,402,102,1192,1194,794,830,836,852,848,840,1221,1181,846,865,1222,989,990,997,1224,1203,25]); -__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1205,[34,379,794,847,1206,1207,1213,848,5,6,25]); -__d(function(g,r,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])},1206,[34,379,102,794,991,992,1044,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1207,[6,34,931,794,1208,25]); -__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]})]})}},1208,[6,1209,1210,1211,34,102,796,794,840,11,1212,25]); -__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1210,[4,11]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1211,[11]); -__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.'}},1212,[6,931]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1213,[34,794,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1214,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1215,[34,102,794,1208,25]); -__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1216,[34,379,931,794,847,1206,1208,4,25]); -__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1217,[34,379,794,1206,847,1207,8,1218,25]); -__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1218,[34,102,794,1219,25]); -__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1219,[]); -__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1220,[34,794,847,1206,1207,848,9,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1221,[34,402,102,426,794,840,1153,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1222,[798,34,336,395,402,295,102,1192,794,989,830,990,827,840,1034,25,1223]); -__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1223,[]); -__d(function(g,_r,_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)})]})}},1224,[34,102,1225,794,848,997,1200,1203,840,25]); -__d(function(g,r,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])},1225,[34,102,1226,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1226,[1227]); -__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1227,[34,900,1228,1257,1258,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1228,[1229]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1229,[1230,1231,1254,1256]); -__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1230,[]); -__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1231,[1232,1233,1234,1235,1236,1237,1238,1239,1240,1243,1247,1244,1248]); -__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1232,[]); -__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1233,[]); -__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1234,[]); -__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1235,[]); -__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1240,[1241]); -__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1244,[1245,1246]); -__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1245,[]); -__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1246,[]); -__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1249,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1250,[1244]); -__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1252,[1244,1232]); -__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1253,[]); -__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1254,[1255]); -__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1256,[1255]); -__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1257,[]); -__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1258,[34,900,1259,25]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1259,[]); -__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1260,[30,34,794,848,865,25]); -__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1261,[806,30,34,102,1225,794,836,848,840,1224,1203,25]); -__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1262,[806,30,34,102,1198,794,848,865,836,827,840,1199,1203,25]); -__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1263,[806,30,34,794,848,865,827,840,1224,1203,25]); -__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1264,[806,30,34,794,848,865,840,1224,1203,25]); -__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1265,[30,34,794,827,1120,1266,848,840,25]); -__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}},1266,[]); -__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1267,[30,1075,34,402,102,794,827,848,840,25]); -__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1268,[829,30,34,1190,995,102,1198,794,830,836,1104,827,848,800,840,833,25]); -__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1269,[30,34,102,1194,794,830,852,848,840,1221,5,25]); -__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)}})]})}},1270,[829,30,34,102,1198,1196,794,830,836,827,848,840,25]); -__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1271,[829,1203,30,34,102,794,830,836,827,848,853,25]); -__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]})}},1272,[30,34,846,25]); -__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}},1273,[806,30,34,794,848,5,1203,25]); -__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."})})}},1274,[30,34,794,1275,1131,1203,25]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1275,[796,829,34,102,794,830,836,1131,1276,848,840,25]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1276,[931,985,1131]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1277,[30,34,846,1278,1333,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"})]}),qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1278,[1121,5,6,1279,798,822,1094,829,1120,1280,1281,1282,1091,1115,1283,1284,1286,1287,1288,1130,977,1099,1289,34,1073,1148,1033,1087,1116,1290,380,402,295,102,426,36,794,1181,1185,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1291,1107,1292,1295,1297,1300,1303,1299,1304,1306,1307,1112,1093,1095,852,1309,1170,1310,1180,1172,1011,1315,1323,1325,1076,1114,1327,1328,1329,1143,1330,1142,1136,838,1331,1332,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1280,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1281,[1012,1100]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1282,[34,102,1079,794,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1283,[829,34,102,794,848,1131,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1284,[34,395,402,426,102,1225,794,1143,1014,1285,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1285,[]); -__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}))},1286,[815]); -__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1287,[798,34,379,395,402,102,794,1143,840,25]); -__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return v}}),_e.SoldOutStrip=function({rid:e,now:k,by:w,onOpen:F}){const I=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[C,_]=(0,n.useState)(0),[A,H]=(0,n.useState)(!1),L=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{O()},[]);const D=k??(0,p.nowFrom)(z),W=(0,S.activeSoldOut)(I,e,D);if(!W.length)return null;const E=W.map(e=>(0,x.withReason)(e.name,L.reason(e.itemId))),M=(0,S.stripText)(E),P=C>0&&(0,S.stripNeedsTicker)(E,C,v),R=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=R);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>F?F():H(!0),onLayout:e=>_(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:b.colours.accentBorder},children:[(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:b.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,j.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,j.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&T?{whiteSpace:'nowrap'}:{},fontFamily:b.fonts.medium,fontSize:v,lineHeight:20,color:b.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!T?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:12,color:b.colours.muted},children:"Tap for all"}):null]}),F?null:(0,j.jsxs)(c.Sheet,{visible:A,onClose:()=>H(!1),title:(0,S.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[w?(0,j.jsx)(u.SoldOutList,{rid:e,by:w,hideLinks:!0}):(0,j.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,j.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:b.colours.border},children:[(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.semibold,fontSize:17,color:b.colours.text},children:e.name}),L.reason(e.itemId)?(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.medium,fontSize:14,color:b.colours.amber},children:L.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,j.jsxs)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted},children:["Since ",$(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${$(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,j.jsx)(o.Text,{style:{fontFamily:b.fonts.regular,fontSize:13,color:b.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const T='undefined'!=typeof document,k=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let w=!1;function O(){if(!T||w)return;w=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=k,document.head.appendChild(e)}const $=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},v=15},1288,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,978,840,25]); -__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])},1289,[798,34,102,840,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1290,[34,102,900,840,25]); -__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1291,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1292,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1293,1294,1014,865,1107,25]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1293,[798,829,34,1294,102,828,840,794,1108,25]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1294,[828]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1295,[34,236,402,102,840,794,1143,1296,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1296,[]); -__d(function(_g,_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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1297,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1298,840,794,1299,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1298,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1299,[]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1300,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1286,1301,2,1302,1303,848,827,25]); -__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1301,[236]); -__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1303,[34,815,931,985,1302]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1304,[829,14,1014,1305]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1305,[830]); -__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1306,[34,102,900,840,25]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1307,[829,1014,34,102,794,1096,848,1308,1304,1095,1093,1112,1113,1114,840,1281,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1308,[1014,1079]); -__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1309,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1299,848,1014,830,1089,1079,1266,840,1281,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1310,[796,34,236,402,102,794,848,1014,1311,840,1312,1314,25]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1311,[]); -__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1312,[815,848,1014,1311,1313,1314]); -__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1313,[829]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1314,[236,1313]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1315,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1316,1319,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1316,[1317,839,829,34,281,395,402,295,102,848,1011,1014,1318,827,840,1041,794,1319,1320,985,1281,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1317,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1318,[852,827,851]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1319,[5,1014,931,985]); -__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})},1320,[815,931,985,1321,2,1322]); -__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1321,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1322,[15]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1323,[34,102,900,794,1143,827,840,798,1324,1325,1326,25]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1324,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1325,[]); -__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1326,[1079]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1327,[829,1305]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1328,[34,402,102,794,1327,840,1290,25]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1329,[34,102,899,794,1143,827,840,25]); -__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1330,[34,1143,402,102,426,794,25]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1331,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1320,985,25]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1332,[34,1021,865,1001,800,1022,994,1320,1070]); -__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1333,[5,798,847,34,236,402,102,426,985,840,794,1286,1334,25]); -__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}})()},1334,[]); -__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]})}},1335,[30,34,846,25]); +__d(function(g,_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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1159,[34,402,102,794,865,827,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!c)return null;const x=(0,o.openShiftOf)(y,c.id,t),p=!!x?.breaks?.some(e=>!e.end),b=j.filter(e=>e.staffId===c.id&&e.date===l),k=b.length?b.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,h.jsx)(s.default,{testID:"my-shift-card",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:k}),(0,h.jsx)(f,{staffId:c.id}),(0,h.jsx)(n.T,{center:!0,children:x?p?'On a break':`Clocked in since ${u(x.in)}`:'Not clocked in'}),(0,h.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,h.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,h.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,h.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=f,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const u=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function f({staffId:e,team:t}){const{today:u}=(0,d.useCtx)(6e4),f=(0,o.useOwner)(e=>e.shifts).filter(t=>t.staffId===e&&!1!==t.published&&t.date>=u).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,h.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,h.jsxs)(n.Card,{children:[(0,h.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),f.length?f.map(o=>(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:y(o.date)}),(0,h.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t?(0,h.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:y(o.date)}):null]},o.id)):(0,h.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1160,[34,102,794,865,840,1100,1103,1158,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1161,[34,102,1100,840,794,25]); +__d(function(g,r,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]})}},1162,[796,34,402,102,794,1019,840,928,25]); +__d(function(g,_r,_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=k,_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},p=(0,y.useMaySendInspectorLog)(h);p&&u.splice(u.findIndex(e=>'report'===e.id)+1,0,r('inspector','Inspector'));return(0,f.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,f.jsx)(k,{mode:s,now:n,onPress:()=>l('today')}):null,(0,f.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,f.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,f.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(S,{who:h}),(0,f.jsx)(T,{who:h})]}):null,'diary'===o?(0,f.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,f.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,f.jsx)(b.ReportView,{who:h}):null,'inspector'===o&&p?(0,f.jsx)(y.InspectorView,{who:h}):null,'history'===o?(0,f.jsx)(I,{who:h}):null,'limits'===o?(0,f.jsx)(P,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,f.jsx)(L,{mode:s,me:e,now:n}):null,(0,f.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]),f=_r(_d[16]);const j=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),w=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),v=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function k({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,f.jsx)(d.default,{testID:"haccp-uptodate",children:(0,f.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,f.jsx)(d.default,{testID:"haccp-missed",children:(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function C(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 S({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,y]=(0,i.useState)(null),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(!1),[T,I]=(0,i.useState)(!1),D=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return y(null),void w('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);I(n),w(''),y(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)=>y(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=v(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,f.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,f.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void D.current?.stop();const t=new e;D.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=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>S(!1);try{t.start(),S(!0)}catch{w("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:k?p.colours.gold:'transparent'},children:(0,f.jsx)(c.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,f.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,f.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,f.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,f.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,f.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,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,f.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>y(t=>t.filter(t=>t.key!==e.key)),children:(0,f.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,f.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,f.jsxs)(d.default,{style:{gap:6},children:[(0,f.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,f.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,f.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,f.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,f.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,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{C(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:T?'voice':'typed'}))),w(`Saved ${B.length} reading${1===B.length?'':'s'}.`),y(null),m('')},style:{flex:1}}),(0,f.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{y(null),w('Nothing saved.')}})]}),(0,f.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,y]=(0,i.useState)(''),[j,w]=(0,i.useState)(''),[k,S]=(0,i.useState)(''),T=s.find(e=>e.id===o),I=!!T&&(0,h.isTempKind)(T.kind),D=v(r),P=T?I?null==D?null:(0,h.inRange)(T,D):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,f.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),y(''),S('')}},e.id))}),T?(0,f.jsxs)(c.Muted,{children:[h.KIND_LABEL[T.kind]," \xb7 safe: ",(0,h.limitText)(T)]}):null,I?(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.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,f.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,f.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,f.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c.Banner,{kind:"danger",title:I?'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,f.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,f.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:w,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{C(e,[{point:T,value:I?D:void 0,done:I?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),y(''),w(''),S(`Saved: ${T.name}.`)}}),k?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:k}):null]})}function I({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),[y,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,f.jsxs)(x.Box,{testID:"haccp-history",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,f.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,f.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,f.jsx)(d.default,{testID:"haccp-count",children:(0,f.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,f.jsx)(D,{e:e},e.id)):(0,f.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,f.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,f.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.')})]}),y?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:y}):null]})}function D({e:e}){return(0,f.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,f.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,f.jsxs)(c.Row,{gap:6,children:[(0,f.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,f.jsxs)(c.Muted,{style:{flex:1},children:[w(e.at)," ",j(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,f.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,f.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,f.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function P({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,f.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,f.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,f.jsx)(R,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,f.jsx)(B,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,f.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function R({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(', ')),y=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),w=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=v(o))&&(''===r||null!=v(r));return n?(0,f.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,f.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,f.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:8,children:[y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,f.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,f.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}]}),w?(0,f.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:v(o),max:''===r?void 0:v(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,f.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,f.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,f.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function B({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,f.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,f.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,f.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,f.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 L({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,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,S]=(0,i.useState)(null),[T,I]=(0,i.useState)(''),D=m.find(e=>e.id===v);return(0,f.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,f.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,f.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,f.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,f.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,f.jsx)(c.T,{weight:"semibold",children:e.name}),(0,f.jsx)(c.Muted,{children:e.location})]}),(0,f.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,f.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,f.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,f.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,f.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,f.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,f.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,f.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,f.jsx)(d.default,{testID:"probes-empty",children:(0,f.jsx)(c.Muted,{children:"No probes yet."})}),T?(0,f.jsx)(d.default,{testID:"probe-msg",children:(0,f.jsx)(c.Banner,{kind:"info",children:T})}):null,b?(0,f.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,f.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,f.jsx)(c.Muted,{children:"Where is it?"}),(0,f.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,f.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,f.jsxs)(c.Row,{gap:8,children:[(0,f.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!D,onPress:()=>{j.trim()&&D&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,D))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),I(`Added \u201c${j.trim()}\u201d for ${D.name}. Next: connect your probe.`),w(''),k(''),y(!1))}}),(0,f.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,f.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,f.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1163,[796,1164,804,865,34,336,402,102,794,1019,1020,840,899,928,1165,1168,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSafetyView=function(o){const c=(0,n.useSafety)(),u=(0,f.useOwner)(t=>t.site);return(0,t.useMemo)(()=>{if('chef'!==o)return c;const t=c.points.filter(t=>(0,s.chefCanSee)(u,t)),n=new Set(c.points.filter(t=>!(0,s.chefCanSee)(u,t)).map(t=>t.id)),f=t=>(0,s.chefCanSee)(u,t)&&!n.has(t.pointId||'');return{...c,points:t,entries:c.entries.filter(f),probes:c.probes.filter(f),diary:c.diary.filter(t=>f(t)&&(0,s.chefCanSee)(u,t.text)),weekly:c.weekly.filter(t=>(0,s.chefCanSee)(u,t.note))}},[c,u,o])};var t=r(d[0]),n=r(d[1]),f=r(d[2]),s=r(d[3])},1164,[34,1019,865,804]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveEntry=B,_e.ProgressRing=L,_e.Keypad=R,_e.RecordPanel=z,_e.TodayView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points,o=(0,s.useSafetyView)(e.mode).entries,[n,i]=(0,r.useState)('all'),[l,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(''),f=(0,r.useMemo)(()=>(0,p.todayTasks)(t,o,e.now),[t,o,e.now.getTime()]).filter(e=>'all'===n||(0,p.sectionOf)(e.point)===n),j=e=>f.filter(t=>t.status===e).length;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-today",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.Row,{gap:16,children:[(0,w.jsx)(L,{done:j('done'),total:f.length}),(0,w.jsxs)(d.default,{style:{flex:1,gap:6},children:[(0,w.jsx)(h.T,{weight:"semibold",size:18,children:"Today\u2019s checks"}),(0,w.jsx)(h.Muted,{children:e.now.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(d.default,{testID:"today-overdue",children:(0,w.jsx)(h.Badge,{kind:j('overdue')?'red':'neutral',label:`${j('overdue')} overdue`})}),(0,w.jsx)(d.default,{testID:"today-due",children:(0,w.jsx)(h.Badge,{kind:j('due')?'amber':'neutral',label:`${j('due')} due now`})}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${j('upcoming')} later`})]}),(0,w.jsx)(h.Muted,{children:"Tap a check to record it. Each one is signed with your initials and the time."})]})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"All",selected:'all'===n,onPress:()=>i('all')}),p.SECTIONS.map(e=>(0,w.jsx)(h.Chip,{label:p.SECTION_LABEL[e],selected:n===e,onPress:()=>i(e)},e))]})]}),u?(0,w.jsx)(d.default,{testID:"today-msg",children:(0,w.jsx)(h.Banner,{kind:"success",children:u})}):null,p.SLOTS.map(t=>{const o=f.filter(e=>e.slot===t);return o.length?(0,w.jsxs)(b.Box,{testID:`slot-${t}`,children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:[p.SLOT_LABEL[t]," ",(0,w.jsxs)(h.Muted,{children:["\xb7 ",p.SLOT_HINT[t]]})]}),(0,w.jsx)(h.Badge,{kind:o.every(e=>'done'===e.status)?'ok':'gold',label:`${o.filter(e=>'done'===e.status).length}/${o.length}`})]}),o.map(t=>(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${t.point.name}, due ${t.due}, ${E[t.status]}`,testID:`task-${t.point.id}-${t.due.replace(':','')}`,onPress:()=>{x(''),c(l===t.key?null:t.key)},style:({pressed:e})=>({minHeight:64,flexDirection:'column',alignItems:'center',gap:12,paddingHorizontal:12,paddingVertical:10,borderRadius:14,borderWidth:1,borderColor:'overdue'===t.status?m.colours.red:'due'===t.status?m.colours.amber:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2}),children:[(0,w.jsx)(d.default,{style:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:_[t.status],backgroundColor:'done'===t.status?t.entry?.ok?m.colours.ok:m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{weight:"bold",colour:'done'===t.status?'#0B0B0B':_[t.status],children:'done'===t.status?t.entry?.ok?'\u2713':'!':'overdue'===t.status?'!':'\u25cb'})}),(0,w.jsxs)(d.default,{style:{width:'100%',gap:2},children:[(0,w.jsx)(h.T,{weight:"medium",children:t.point.name}),(0,w.jsxs)(h.Muted,{children:[t.due," \xb7 ",p.SECTION_LABEL[(0,p.sectionOf)(t.point)],(0,p.isTempKind)(t.point.kind)?` \xb7 ${(0,p.limitText)(t.point)}`:'']}),t.entry?(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(y.StaffAvatar,{id:t.entry.byId,name:t.entry.by,size:18,ring:!1}),(0,w.jsxs)(h.Muted,{children:[(0,p.fmtEntryValue)(t.entry)," \xb7 ",t.entry.initials??(0,p.initialsOf)(t.entry.by)," ",k(t.entry.at),t.entry.ok?'':` \xb7 action: ${t.entry.corrective}`]})]}):null]}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:_[t.status],children:E[t.status]})]}),l===t.key?(0,w.jsx)(z,{who:e,point:t.point,onCancel:()=>c(null),onDone:e=>{c(null),x(e)}}):null]},t.key))]},t):null}),f.length?null:(0,w.jsxs)(h.Muted,{children:["No scheduled checks",'all'===n?'':` in ${p.SECTION_LABEL[n]}`,". Add due times in Safe limits."]})]})},_e.UnitsView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).points.filter(e=>['fridge','freezer','hothold'].includes(e.kind)),o=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).probes??[],[i,l]=(0,r.useState)(null),[a,c]=(0,r.useState)('');return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-units",children:[a?(0,w.jsx)(h.Banner,{kind:"success",children:a}):null,(0,w.jsx)(h.Row,{wrap:!0,gap:10,style:{alignItems:'stretch'},children:t.map(t=>{const s=(0,p.unitStatus)(t,o,e.now),r=n.find(e=>e.pointId===t.id);return(0,w.jsxs)(d.default,{testID:`unit-${t.id}`,style:{flexGrow:1,flexBasis:260,gap:8,padding:14,borderRadius:16,borderWidth:1.5,borderColor:'none'===s.rag?m.colours.border:D[s.rag],backgroundColor:m.colours.surface},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",children:t.name}),(0,w.jsxs)(h.Muted,{children:[p.KIND_LABEL[t.kind]," \xb7 safe ",(0,p.limitText)(t)]})]}),(0,w.jsxs)(d.default,{testID:`unit-rag-${t.id}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,w.jsx)(d.default,{style:{width:12,height:12,borderRadius:6,backgroundColor:D[s.rag]}}),(0,w.jsx)(h.T,{size:13,weight:"semibold",colour:D[s.rag],children:'amber'===s.rag?s.why:$[s.rag]})]})]}),s.latest?(0,w.jsxs)(h.Row,{style:{alignItems:'flex-end',gap:8},children:[(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:D[s.rag],children:[s.latest.value,"\xb0C"]}),(0,w.jsxs)(h.Muted,{style:{paddingBottom:8},children:[S(s.latest.at)," ",k(s.latest.at)," \xb7 ",s.latest.initials??(0,p.initialsOf)(s.latest.by)]})]}):(0,w.jsx)(h.T,{size:20,colour:m.colours.muted,children:"\u2014 \xb0C"}),(0,w.jsx)(P,{p:t,history:s.history}),r?(0,w.jsxs)(h.Muted,{children:["Wireless probe: ",r.name," \xb7 ",'connected'===r.status?'Connected':'Not connected']}):null,(0,w.jsx)(h.Button,{small:!0,label:"Record reading",testID:`unit-record-${t.id}`,onPress:()=>{c(''),l(i===t.id?null:t.id)}}),i===t.id?(0,w.jsx)(z,{who:e,point:t,onCancel:()=>l(null),onDone:e=>{l(null),c(e)}}):null]},t.id)})}),(0,w.jsx)(h.Muted,{children:"Gold: in range \xb7 Amber: near the limit (within 1 \xb0C) or no reading yet today \xb7 Red: last reading out of range. Only readings people entered are shown."})]})},_e.DiaryView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).diary??[],n=(0,s.useSafetyView)(e.mode).daySigns??[],i=(0,s.useSafetyView)(e.mode).entries,l=(0,p.ymdLocal)(e.now),[a,c]=(0,r.useState)(l),[u,f]=(0,r.useState)('Note'),[j,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),C=Array.from({length:7},(t,o)=>(0,p.ymdLocal)(v(e.now,-o))),B=t.filter(e=>e.date===a),L=n.find(e=>e.date===a),R=i.filter(e=>(0,p.ymdLocal)(new Date(e.at))===a),O='staff'!==e.mode;return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-diary",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:C.map(e=>(0,w.jsx)(h.Chip,{label:e===l?'Today':I(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric'}),selected:e===a,onPress:()=>c(e)},e))}),(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:I(a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}),(0,w.jsxs)(h.Muted,{children:[R.length," check",1===R.length?'':'s'," recorded",R.filter(e=>!e.ok).length?` \xb7 ${R.filter(e=>!e.ok).length} out of range or not done`:'']}),B.length?B.map(e=>(0,w.jsxs)(d.default,{testID:"diary-note",style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:m.colours.border},children:[(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:22,ring:!1}),(0,w.jsx)(h.Badge,{kind:'Problem'===e.kind?'red':'Extra check'===e.kind?'blue':'neutral',label:e.kind}),(0,w.jsxs)(h.Muted,{children:[k(e.at)," \xb7 ",e.by]})]}),(0,w.jsx)(h.T,{size:14,children:e.text}),e.action?(0,w.jsxs)(h.T,{size:13,colour:m.colours.amber,children:["What we did: ",e.action]}):null]},e.id)):(0,w.jsx)(h.Muted,{children:"Nothing written for this day yet."})]}),(0,w.jsxs)(b.Box,{testID:"diary-add",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Add to the diary"}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:u===e,onPress:()=>f(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Diary note",testID:"diary-text",value:j,onChangeText:S,multiline:!0,placeholder:"What happened? e.g. chilled delivery arrived at 9\xb0C, rejected",placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:70}]}),'Problem'===u?(0,w.jsx)(o.TextInput,{accessibilityLabel:"What did you do about it",value:D,onChangeText:$,placeholder:"What did you do about it?",placeholderTextColor:"#7D776C",style:h.styles.input}):null,(0,w.jsx)(h.Button,{label:"Save note",testID:"diary-save",disabled:j.trim().length<3||'Problem'===u&&D.trim().length<3,onPress:()=>{x.useSafety.getState().addNote({date:a,at:e.now.toISOString(),by:T(e.me),byId:e.meId,kind:u,text:j.trim(),action:D.trim()||void 0}),S(''),$('')}})]}),(0,w.jsxs)(b.Box,{testID:"diary-daysign",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Daily sign-off"}),L?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:L.byId,name:L.by,size:30}),(0,w.jsxs)(h.T,{size:14,colour:m.colours.ok,style:{flex:1},children:["Safe methods followed: signed by ",L.by," at ",k(L.at)]})]}):O?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Muted,{children:"Sign to confirm the opening and closing checks were done and the safe methods were followed today."}),(0,w.jsx)(h.Button,{label:"Sign: safe methods followed",testID:"diary-sign",disabled:a!==l,onPress:()=>x.useSafety.getState().signDay({date:a,by:T(e.me),byId:e.meId,at:e.now.toISOString()})}),a!==l?(0,w.jsx)(h.Muted,{children:"Only today can be signed."}):null]}):(0,w.jsx)(h.Muted,{children:"Not signed yet. The Head Chef or a manager signs the diary each day."})]})]})},_e.WeeklyView=function({who:e}){const t=(0,s.useSafetyView)(e.mode).weekly??[],n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).daySigns??[],l=(0,p.weekStart)(e.now),a=(0,p.weekStart)(v(I(l),-7)),[c,u]=(0,r.useState)(l),[f,j]=(0,r.useState)(p.WEEKLY_QUESTIONS.map(()=>{})),[D,$]=(0,r.useState)(''),[C,B]=(0,r.useState)(''),L=I(c).getTime(),R=v(I(c),7).getTime(),O=n.filter(e=>{const t=new Date(e.at).getTime();return t>=L&&t!e.ok).length,actions:O.filter(e=>!e.ok&&e.corrective).length,daysSigned:i.filter(e=>{const t=I(e.date).getTime();return t>=L&&te.week===c),E='staff'!==e.mode,P=f.every(e=>void 0!==e),M=f.some(e=>!1===e);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-weekly",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Chip,{label:"This week",selected:c===l,onPress:()=>u(l)}),(0,w.jsx)(h.Chip,{label:"Last week",selected:c===a,onPress:()=>u(a)})]}),(0,w.jsxs)(b.Box,{children:[(0,w.jsxs)(h.T,{weight:"semibold",size:17,children:["Week of ",I(c).toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${z.entries} checks`}),(0,w.jsx)(h.Badge,{kind:z.outOfRange?'red':'ok',label:`${z.outOfRange} out of range`}),(0,w.jsx)(h.Badge,{kind:z.actions(0,w.jsxs)(h.Muted,{children:[_.answers[t]?'\u2713':'\u2715'," ",e]},e)),_.note?(0,w.jsxs)(h.T,{size:14,children:["Note: ",_.note]}):null]}):E?(0,w.jsxs)(b.Box,{testID:"weekly-form",children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Weekly review"}),p.WEEKLY_QUESTIONS.map((e,t)=>(0,w.jsxs)(d.default,{style:{gap:6,paddingVertical:6,borderTopWidth:t?1:0,borderColor:m.colours.border},children:[(0,w.jsx)(h.T,{size:14,children:e}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Yes",selected:!0===f[t],onPress:()=>j(f.map((e,o)=>o===t||e))}),(0,w.jsx)(h.Chip,{label:"No",selected:!1===f[t],onPress:()=>j(f.map((e,o)=>o!==t&&e))})]})]},e)),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Weekly note",value:D,onChangeText:$,multiline:!0,placeholder:M?'What went wrong and what you are doing about it (needed)':'Note (optional)',placeholderTextColor:"#7D776C",style:[h.styles.input,{minHeight:60},M&&!D.trim()&&{borderColor:m.colours.red}]}),(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signing as ",T(e.me)," (",'chef'===e.mode?'Head Chef':'Manager',")"]})]}),(0,w.jsx)(h.Button,{label:"Sign off this week",testID:"weekly-sign",disabled:!P||M&&D.trim().length<3,onPress:()=>{x.useSafety.getState().signWeek({week:c,by:T(e.me),byId:e.meId,role:'chef'===e.mode?'Head Chef':'Manager',at:e.now.toISOString(),answers:f.map(Boolean),note:D.trim(),summary:z}),B('Week signed off.')}}),C?(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:C}):null]}):(0,w.jsx)(b.Box,{children:(0,w.jsx)(h.Muted,{children:"Not signed off yet. The Head Chef or a manager signs off each week."})}),t.filter(e=>e.week!==c).length?(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Earlier sign-offs"}),t.filter(e=>e.week!==c).slice(0,8).map(e=>(0,w.jsxs)(h.Muted,{children:["Week of ",I(e.week).toLocaleDateString('en-GB',{day:'numeric',month:'short'}),": ",e.by," (",e.role,"), ",S(e.at)]},e.id))]}):null]})},_e.ReportView=function({who:e,venue:t=(0,j.venueInfo)().address}){const n=(0,s.useSafetyView)(e.mode).entries,i=(0,s.useSafetyView)(e.mode).points,l=(0,s.useSafetyView)(e.mode).diary??[],a=(0,s.useSafetyView)(e.mode).daySigns??[],c=(0,s.useSafetyView)(e.mode).weekly??[],[u,y]=(0,r.useState)('week'),x=(0,p.ymdLocal)(e.now),[D,$]=(0,r.useState)((0,p.ymdLocal)(v(e.now,-13))),[C,B]=(0,r.useState)(x),[L,R]=(0,r.useState)(''),O=(0,p.weekStart)(e.now),[z,_]='week'===u?[O,x]:'lastweek'===u?[(0,p.ymdLocal)(v(I(O),-7)),(0,p.ymdLocal)(v(I(O),-1))]:'7'===u?[(0,p.ymdLocal)(v(e.now,-6)),x]:'28'===u?[(0,p.ymdLocal)(v(e.now,-27)),x]:[D,C],E=/^\d{4}-\d{2}-\d{2}$/.test(z)&&/^\d{4}-\d{2}-\d{2}$/.test(_)&&z<=_,P=e=>E&&e>=z&&e<=_,M=n.filter(e=>P((0,p.ymdLocal)(new Date(e.at)))).sort((e,t)=>e.at.localeCompare(t.at)),N=l.filter(e=>P(e.date)),W=a.filter(e=>P(e.date)),V=c.filter(e=>P(e.week)||P((0,p.ymdLocal)(v(I(e.week),6)))),A=M.filter(e=>!e.ok),G=e=>i.find(t=>t.id===e.pointId),F=p.SECTIONS.map(e=>{const t=M.filter(t=>{const o=G(t);return!!o&&(0,p.sectionOf)(o)===e});return{s:e,n:t.length,bad:t.filter(e=>!e.ok).length}}),H=`${I(z).toLocaleDateString('en-GB')} to ${I(_).toLocaleDateString('en-GB')}`,Y=['Date','Time','Section','Check','Reading','Safe limit','Result','Corrective action','Signed'],U=M.map(e=>[new Date(e.at).toLocaleDateString('en-GB'),k(e.at),G(e)?p.SECTION_LABEL[(0,p.sectionOf)(G(e))]:'',e.name,(0,p.fmtEntryValue)(e),G(e)?(0,p.limitText)(G(e)):'',e.ok?'OK':'OUT OF RANGE',e.corrective??'',`${e.initials??(0,p.initialsOf)(e.by)} ${e.by}`]),K=[Y,...U].map(e=>e.map(e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e).join(',')).join('\r\n')+'\r\n';return(0,w.jsxs)(d.default,{style:{gap:12},testID:"haccp-report",children:[(0,w.jsxs)(b.Box,{children:[(0,w.jsx)(h.T,{weight:"semibold",size:17,children:"EHO report"}),(0,w.jsx)(h.Muted,{children:"Pick the dates an inspector asks for, then download a PDF, print it or export the readings."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:[['week','This week'],['lastweek','Last week'],['7','Last 7 days'],['28','Last 28 days'],['custom','Choose dates']].map(([e,t])=>(0,w.jsx)(h.Chip,{label:t,selected:u===e,onPress:()=>y(e)},e))}),'custom'===u?(0,w.jsxs)(h.Row,{gap:8,children:[(0,w.jsx)(o.TextInput,{accessibilityLabel:"From date",testID:"report-from",value:D,onChangeText:$,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"To date",testID:"report-to",value:C,onChangeText:B,placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:0,width:40}]})]}):null,E?(0,w.jsx)(d.default,{testID:"report-period",children:(0,w.jsx)(h.Muted,{children:H})}):(0,w.jsx)(h.T,{size:13,colour:m.colours.red,children:"Use dates like 2026-10-01, with the first date before the second."})]}),(0,w.jsxs)(b.Box,{testID:"report-summary",children:[(0,w.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(h.Badge,{kind:"gold",label:`${M.length} checks`}),(0,w.jsx)(h.Badge,{kind:A.length?'red':'ok',label:`${A.length} out of range`}),(0,w.jsx)(h.Badge,{kind:"blue",label:`${W.length} diary days signed`}),(0,w.jsx)(h.Badge,{kind:"neutral",label:`${V.length} weekly sign-offs`})]}),F.map(e=>(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{size:14,children:p.SECTION_LABEL[e.s]}),(0,w.jsxs)(h.Muted,{children:[e.n," check",1===e.n?'':'s',e.bad?` \xb7 ${e.bad} out of range`:'']})]},e.s)),A.length?(0,w.jsxs)(d.default,{style:{gap:4},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:m.colours.red,children:"Out of range"}),A.slice(0,10).map(e=>(0,w.jsxs)(h.Muted,{children:[S(e.at)," ",k(e.at)," \xb7 ",e.name," ",(0,p.fmtEntryValue)(e)," \xb7 action: ",e.corrective]},e.id))]}):null]}),(0,w.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,w.jsx)(h.Button,{label:"Download PDF",testID:"report-pdf",disabled:!E,onPress:()=>{const o=[{text:'Food safety report (HACCP)',bold:!0,size:18},{text:t,size:11},{text:`Period: ${H}. Produced ${e.now.toLocaleString('en-GB')} by ${T(e.me)}.`,size:9,colour:[.35,.35,.35]},{text:'Every reading in this report was entered and signed by a member of staff. The app never fills in or estimates a reading.',size:9,colour:[.35,.35,.35]},{text:'Summary',bold:!0,size:13,gap:10},{text:`${M.length} checks recorded \xb7 ${A.length} out of range or not done \xb7 ${A.filter(e=>e.corrective).length} with a corrective action \xb7 diary signed on ${W.length} day(s) \xb7 ${V.length} weekly sign-off(s).`},{text:'By Safer Food, Better Business section',bold:!0,size:13,gap:10},...F.map(e=>({text:`${p.SECTION_LABEL[e.s]}: ${e.n} check${1===e.n?'':'s'}, ${e.bad} out of range / not done`})),{text:'Out of range and corrective actions',bold:!0,size:13,gap:10},...A.length?A.map(e=>({text:`${new Date(e.at).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.name}: ${(0,p.fmtEntryValue)(e)} (safe ${G(e)?(0,p.limitText)(G(e)):'-'}) \xb7 Action: ${e.corrective??'none recorded'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} ${e.by}${e.photo?' \xb7 photo kept on device':''}`,colour:[.65,.12,.1]})):[{text:'None in this period.'}],{text:'All checks by day',bold:!0,size:13,gap:10}];let s='';for(const e of M){const t=new Date(e.at).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'});t!==s&&(s=t,o.push({text:t,bold:!0,gap:6})),o.push({text:`${k(e.at)} ${e.name}: ${(0,p.fmtEntryValue)(e)} ${e.ok?'OK':'OUT OF RANGE'} \xb7 ${e.initials??(0,p.initialsOf)(e.by)} (${e.by})${'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 wireless probe':''}${e.note?` \xb7 note: ${e.note}`:''}`,indent:10,size:9})}M.length||o.push({text:'No checks recorded in this period.'}),o.push({text:'Diary',bold:!0,size:13,gap:10}),N.length?N.slice().sort((e,t)=>e.at.localeCompare(t.at)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')} ${k(e.at)} \xb7 ${e.kind}: ${e.text}${e.action?` \xb7 What we did: ${e.action}`:''} \xb7 ${e.by}`,size:9})):o.push({text:'No diary notes in this period.'}),o.push({text:'Daily sign-offs (safe methods followed)',bold:!0,size:13,gap:10}),W.length?W.slice().sort((e,t)=>e.date.localeCompare(t.date)).forEach(e=>o.push({text:`${I(e.date).toLocaleDateString('en-GB')}: ${e.by} at ${k(e.at)}`,size:9})):o.push({text:'None in this period.'}),o.push({text:'Weekly sign-offs',bold:!0,size:13,gap:10}),V.length?V.forEach(e=>{o.push({text:`Week of ${I(e.week).toLocaleDateString('en-GB')}: ${e.by} (${e.role}), ${new Date(e.at).toLocaleString('en-GB')}`,size:9}),p.WEEKLY_QUESTIONS.forEach((t,s)=>o.push({text:`${e.answers[s]?'Yes':'No'}: ${t}`,size:9,indent:10})),e.note&&o.push({text:`Note: ${e.note}`,size:9,indent:10})}):o.push({text:'None in this period.'}),o.push({text:'Signed (manager): ____________________ Date: ____________',gap:24});const n=(0,b.downloadBytes)(`food-safety-report-${z}-to-${_}.pdf`,(0,f.buildPdf)(o,`${t} \xb7 Food safety report \xb7 ${H}`),'application/pdf');R(n?`PDF downloaded: ${M.length} checks, ${H}.`:'Downloads work in the web app.')}}),(0,w.jsx)(h.Button,{kind:"secondary",label:"Print",testID:"report-print",disabled:!E||!M.length,onPress:()=>R((0,b.printTable)(`Food safety report: ${t}`,`${H} \xb7 ${M.length} checks \xb7 all readings entered by staff`,Y,U)?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')}),(0,w.jsx)(h.Button,{kind:"secondary",label:"CSV",testID:"report-csv",disabled:!E||!M.length,onPress:()=>R((0,b.downloadText)(`food-safety-${z}-to-${_}.csv`,K)?`CSV downloaded: ${M.length} checks.`:'Downloads work in the web app.')})]}),L?(0,w.jsx)(d.default,{testID:"report-msg",children:(0,w.jsx)(h.T,{size:14,colour:m.colours.ok,children:L})}):null]})};var t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),l=e(_r(_d[6])),a=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=e(c),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),p=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),S=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),T=e=>e.replace(' (example)',''),D={ok:m.colours.ok,amber:m.colours.amber,red:m.colours.red,none:m.colours.muted},$={ok:'In range',amber:'Check',red:'Out of range',none:'No readings yet'},C=e=>{const t=e.trim().replace(',','.');return/^-?\d+(\.\d+)?$/.test(t)?Number(t):null},I=e=>{const[t,o,s]=e.split('-').map(Number);return new Date(t,o-1,s)},v=(e,t)=>{const o=new Date(e);return o.setDate(o.getDate()+t),o};function B(e,t,o){if('chef'===e.mode&&!(0,n.chefCanSee)(i.useOwner.getState().site,t))return;const s=(0,p.isTempKind)(t.kind)?(0,p.inRange)(t,o.value):!!o.done;x.useSafety.getState().addEntries([{pointId:t.id,name:t.name,kind:t.kind,at:e.now.toISOString(),by:T(e.me),byId:e.meId,app:e.mode,value:o.value,done:o.done,ok:s,corrective:o.corrective?.trim()||void 0,note:o.note?.trim()||void 0,source:o.source,photo:o.photo,initials:(0,p.initialsOf)(e.me)}])}function L({done:e,total:t,size:o=132}){const s=o/2-10,n=2*Math.PI*s,i=t?e/t:0;return(0,w.jsxs)(d.default,{testID:"today-ring",accessibilityLabel:`${e} of ${t} checks done`,style:{width:o,height:o,alignItems:'center',justifyContent:'center'},children:[(0,w.jsxs)(u.default,{width:o,height:o,style:{position:'absolute'},children:[(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:"#2A2722",strokeWidth:12,fill:"none"}),i>0?(0,w.jsx)(c.Circle,{cx:o/2,cy:o/2,r:s,stroke:i>=1?m.colours.ok:m.colours.gold,strokeWidth:12,fill:"none",strokeDasharray:`${n*i} ${n}`,strokeLinecap:"round",transform:`rotate(-90 ${o/2} ${o/2})`}):null]}),(0,w.jsxs)(h.T,{size:o/4.2,weight:"bold",children:[Math.round(100*i),"%"]}),(0,w.jsxs)(h.Muted,{children:[e," of ",t]})]})}function R({value:e,onChange:t}){const o=o=>'back'===o?t(e.slice(0,-1)):'\xb1'===o?t(e.startsWith('-')?e.slice(1):`-${e}`):'.'===o?t(e.includes('.')?e:`${e||'0'}.`):void(e.replace('-','').replace('.','').length>=4||t(e+o));return(0,w.jsxs)(d.default,{style:{gap:8},testID:"keypad",children:[(0,w.jsx)(h.Row,{wrap:!0,gap:8,children:['1','2','3','4','5','6','7','8','9','\xb1','0','.'].map(e=>(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:'\xb1'===e?'Minus':'.'===e?'Point':e,testID:`key-${'\xb1'===e?'minus':'.'===e?'dot':e}`,onPress:()=>o(e),style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,height:58,borderRadius:14,borderWidth:1,borderColor:m.colours.border,backgroundColor:e?m.colours.goldTint:m.colours.surface2,alignItems:'center',justifyContent:'center'}),children:(0,w.jsx)(h.T,{size:24,weight:"semibold",children:'\xb1'===e?'\u2212/+':e})},e))}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Delete",testID:"key-back",onPress:()=>o('back'),style:{height:48,borderRadius:14,borderWidth:1,borderColor:m.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,children:"\u232b Delete"})})]})}const O=['Moved food to another fridge','Re-checked in 30 minutes','Adjusted the thermostat','Called the engineer','Thrown away','Cooked for longer and re-probed'];function z({who:e,point:s,onDone:n,onCancel:i}){const c=(0,p.isTempKind)(s.kind),[u,x]=(0,r.useState)(''),[f,j]=(0,r.useState)(),[k,S]=(0,r.useState)(''),[D,$]=(0,r.useState)(''),[I,v]=(0,r.useState)(),[L,z]=(0,r.useState)(!1),[_,E]=(0,r.useState)(''),[P,M]=(0,r.useState)(!1),N=(0,r.useRef)(null),W=C(u),V=c?null==W?null:(0,p.inRange)(s,W):void 0===f?null:f,A=null!==V&&(V||k.trim().length>2);return(0,w.jsxs)(d.default,{testID:`record-${s.id}`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1.5,borderColor:!1===V?m.colours.red:m.colours.gold,backgroundColor:(0,t.soutersSurface)('#14120F')},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(d.default,{style:{flex:1},children:[(0,w.jsx)(h.T,{weight:"semibold",size:16,children:s.name}),(0,w.jsxs)(h.Muted,{children:[p.SECTION_LABEL[(0,p.sectionOf)(s)]," \xb7 safe: ",(0,p.limitText)(s)]})]}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:i,hitSlop:10,children:(0,w.jsx)(h.T,{size:18,colour:m.colours.muted,children:"\u2715"})})]}),c?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'center',gap:12},children:[(0,w.jsx)(d.default,{testID:"reading-display",style:{minWidth:150,paddingVertical:8,paddingHorizontal:16,borderRadius:14,borderWidth:2,borderColor:null==V?m.colours.border:V?m.colours.ok:m.colours.red,alignItems:'center'},children:(0,w.jsxs)(h.T,{size:40,weight:"bold",colour:null==V?m.colours.text:V?m.colours.ok:m.colours.red,children:[u||'\u2014',(0,w.jsx)(h.T,{size:22,children:" \xb0C"})]})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Say the reading",testID:"record-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void E("Voice isn't available in this browser. Use the keypad.");if(P)return void N.current?.stop();const t=new e;N.current=t,t.lang='en-GB',t.interimResults=!1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'',o=(0,p.spokenNumber)(t);E(null==o?`Heard \u201c${t}\u201d but no number. Use the keypad.`:`Heard \u201c${t}\u201d. Check it, then save.`),null!=o&&(x(String(o)),z(!0))},t.onerror=()=>E("Didn't catch that. Try again or use the keypad."),t.onend=()=>M(!1);try{t.start(),M(!0)}catch{E("Voice couldn't start. Use the keypad.")}},style:{width:64,height:64,borderRadius:32,borderWidth:2,borderColor:m.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:P?m.colours.gold:'transparent'},children:(0,w.jsx)(h.T,{size:26,children:P?'\u25a0':'\ud83c\udfa4'})})]}),null!=V?(0,w.jsx)(h.Row,{style:{justifyContent:'center'},children:(0,w.jsx)(h.Badge,{kind:V?'ok':'red',label:V?'OK':'OUT OF RANGE'})}):null,_?(0,w.jsx)(h.Muted,{center:!0,children:_}):null,(0,w.jsx)(R,{value:u,onChange:e=>{x(e),z(!1)}})]}):(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Done",testID:"check-done",onPress:()=>j(!0),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.gold,backgroundColor:!0===f?m.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!0===f?'#0B0B0B':m.colours.gold,children:"\u2713 Done"})}),(0,w.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:"Not done",testID:"check-notdone",onPress:()=>j(!1),style:{flex:1,height:64,borderRadius:14,borderWidth:2,borderColor:m.colours.red,backgroundColor:!1===f?m.colours.red:'transparent',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(h.T,{size:18,weight:"bold",colour:!1===f?'#0B0B0B':m.colours.red,children:"\u2715 Not done"})})]}),!1===V?(0,w.jsxs)(d.default,{testID:"corrective",style:{gap:8},children:[(0,w.jsx)(h.Banner,{kind:"danger",title:c?'Out of range: corrective action needed':'Not done: say what happened',children:"Write what you did before you can save."}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:O.map(e=>(0,w.jsx)(h.Chip,{label:e,selected:k===e,onPress:()=>S(e)},e))}),(0,w.jsx)(o.TextInput,{accessibilityLabel:"Corrective action",testID:"corrective-input",value:k,onChangeText:S,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:[h.styles.input,!k.trim()&&{borderColor:m.colours.red}]}),(0,w.jsx)(h.Row,{gap:8,children:I?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(l.default,{source:{uri:I},style:{width:64,height:64,borderRadius:10},accessibilityLabel:"Photo added"}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(void 0)})]}):(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Add photo (optional)",testID:"add-photo",onPress:async()=>{const e=await(0,b.pickImageDataUrl)(480,!0);e&&v(e)}})})]}):null,(0,w.jsx)(o.TextInput,{accessibilityLabel:"Note (optional)",value:D,onChangeText:$,placeholder:"Note (optional)",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,w.jsxs)(h.Row,{gap:8,style:{alignItems:'center'},children:[(0,w.jsx)(y.StaffAvatar,{id:e.meId,size:30}),(0,w.jsxs)(h.Muted,{style:{flex:1},children:["Signed ",(0,p.initialsOf)(e.me)," \xb7 ",T(e.me)," \xb7 ",e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]}),(0,w.jsx)(h.Button,{label:"Sign and save",testID:"record-save",disabled:!A,onPress:()=>{B(e,s,{value:c?W:void 0,done:c?void 0:f,corrective:V?void 0:k,note:D,photo:V?void 0:I,source:L?'voice':'typed'}),n(`Saved: ${s.name}${c?` ${W}\xb0C`:f?' done':' not done'}, signed ${(0,p.initialsOf)(e.me)} at ${e.now.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`)}})]})}const _={done:m.colours.ok,overdue:m.colours.red,due:m.colours.amber,upcoming:m.colours.muted},E={done:'Done',overdue:'Overdue',due:'Due now',upcoming:'Later'};function P({p:e,history:t,w:o=220,h:s=54}){const n=t.slice(-14);if(n.length<2)return(0,w.jsx)(h.Muted,{children:"The trend line appears after two readings."});const i=n.map(e=>e.value),r=[e.min,e.max].filter(e=>null!=e),l=Math.min(...i,...r)-1,a=Math.max(...i,...r)+1,d=e=>6+e*(o-12)/(n.length-1),y=e=>s-6-(e-l)*(s-12)/(a-l||1);return(0,w.jsxs)(u.default,{width:o,height:s,testID:`spark-${e.id}`,children:[r.map(e=>(0,w.jsx)(c.Line,{x1:0,x2:o,y1:y(e),y2:y(e),stroke:m.colours.red,strokeOpacity:.6,strokeDasharray:"4 4",strokeWidth:1},e)),(0,w.jsx)(c.Polyline,{points:n.map((e,t)=>`${d(t)},${y(e.value)}`).join(' '),fill:"none",stroke:m.colours.gold,strokeWidth:2}),n.map((e,t)=>(0,w.jsx)(c.Circle,{cx:d(t),cy:y(e.value),r:3,fill:e.ok?m.colours.ok:m.colours.red},e.id))]})}const M=['Note','Problem','Extra check','Delivery']},1165,[798,796,1164,804,865,34,336,402,102,900,794,899,1019,1020,1166,840,928,1167,25]); +__d(function(_g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildPdf=function(n,c){const u=[];let i=[],f=794;const p=()=>{i.length&&u.push(i),i=[],f=794};for(const c of n){const n=c.size??10,u=1.35*n,l=c.indent??0;f-=c.gap??0;for(const $ of r(c.text,n,499-l,c.bold)){f-u<68&&p(),f-=u;const[r,g,h]=c.colour??[.07,.07,.07];for(const u of t(o(`BT /${c.bold?'F2':'F1'} ${n} Tf ${r} ${g} ${h} rg ${48+l} ${f.toFixed(1)} Td (`),s($),o(') Tj ET\n')))i.push(u)}}p();const l=[],$=n=>(l.push('string'==typeof n?o(n):n),l.length),g=$(''),h=$(''),T=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>'),F=$('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>'),y=[];u.forEach((n,r)=>{const i=t(o("BT /F1 8 Tf 0.4 0.4 0.4 rg 48 28 Td ("),s(`${c} \xb7 Page ${r+1} of ${u.length}`),o(') Tj ET')),f=t(n,i),p=$(t(o(`<< /Length ${f.length} >>\nstream\n`),f,o('\nendstream')));y.push($(`<< /Type /Page /Parent ${h} 0 R /MediaBox [0 0 595 842] /Resources << /Font << /F1 ${T} 0 R /F2 ${F} 0 R >> >> /Contents ${p} 0 R >>`))}),l[g-1]=o(`<< /Type /Catalog /Pages ${h} 0 R >>`),l[h-1]=o(`<< /Type /Pages /Kids [${y.map(n=>`${n} 0 R`).join(' ')}] /Count ${y.length} >>`);let E=t(o('%PDF-1.4\n'),[37,226,227,207,211,10]);const P=[];l.forEach((n,s)=>{P.push(E.length),E=t(E,o(`${s+1} 0 obj\n`),n,o('\nendobj\n'))});const R=E.length;return E=t(E,o(`xref\n0 ${l.length+1}\n0000000000 65535 f \n${P.map(n=>`${String(n).padStart(10,'0')} 00000 n \n`).join('')}trailer\n<< /Size ${l.length+1} /Root ${g} 0 R >>\nstartxref\n${R}\n%%EOF\n`)),new Uint8Array(E)};const n={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159},t=(...n)=>{const t=[];for(const o of n)for(const n of o)t.push(n);return t},o=n=>[...n].map(n=>255&n.charCodeAt(0));function s(t){const o=[];for(const s of t.replace(/\u2212/g,'-').replace(/[\u2190-\u21ff]/g,'>').replace(/[\u2713\u2714]/g,'Y')){const t=s.codePointAt(0),c=t<128||t>=160&&t<=255?t:n[t]??63;40!==c&&41!==c&&92!==c||o.push(92),o.push(c)}return o}const c=(n,t)=>[...n].reduce((n,t)=>n+(/[il.,:;'|!]/.test(t)?.28:/[mwMW@]/.test(t)?.86:/[A-Z0-9\xb0]/.test(t)?.66:' '===t?.28:.53),0)*(t?1.06:1);function r(n,t,o,s){const r=n.split(/\s+/),u=[];let i='';for(const n of r){const r=i?`${i} ${n}`:n;c(r,s)*t>o&&i?(u.push(i),i=n):i=r}return u.push(i),u}},1166,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1167,[800,865,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.useMaySendInspectorLog=function(e){const t=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId));return(0,p.maySendInspectorLog)(e.mode,t)},_e.InspectorView=function({who:e}){const j=(0,b.useSafetyView)(e.mode),S=(0,c.useSafety)(e=>e.inspectorSends)??w,D=(0,l.useOwner)(t=>t.staff.find(t=>t.id===e.meId)),C=(0,h.useVenueInfo)(),v=(0,p.maySendInspectorLog)(e.mode,D),T=(0,u.ymdLocal)(e.now),L=(0,t.useMemo)(()=>(0,p.firstLogDay)(j,e.now),[j,e.now]),[R,k]=(0,t.useState)(''),[$,M]=(0,t.useState)(''),[P,B]=(0,t.useState)(!0),[E,Y]=(0,t.useState)(''),[N,O]=(0,t.useState)(''),[A,W]=(0,t.useState)(!1),[F,_]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null);if(!v)return(0,x.jsx)(s.default,{testID:"inspector-locked",children:(0,x.jsx)(o.Banner,{kind:"info",title:"Owner, managers and Head Chef only",children:"Only the owner, a manager or the Head Chef can send the food-safety log to an inspector."})});const H=P?L:(0,p.parseDmy)(E)??'',V=P?T:(0,p.parseDmy)(N)??'',Q=!!H&&!!V&&H<=V,G=(0,p.inspectorNameProblem)(R),q=(0,p.inspectorEmailProblem)($),J=Q?(0,p.logInRange)(j,H,V):null,K=!G&&!q&&Q&&!!J&&J.records>0,X=(0,p.senderRoleWords)(e.mode,D),Z=e.me.replace(' (example)',''),ee=async()=>{_(!1);const t=(0,p.buildInspectorCsv)({log:{...j,inspectorSends:S},from:H,to:V,venue:C.address||C.name,by:Z,now:e.now,inspectorName:R,inspectorEmail:$}),n=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`,s=await I(t.fileName,t.csv,n);if(!s)return void U({kind:'warn',text:'Nothing was sent. Sharing and downloads work in the app on your phone or in the web app.'});const o=(0,p.prepareInspectorSend)({allowed:v,confirmed:!0,method:s,at:(new Date).toISOString(),by:Z,byId:e.meId,role:X,inspectorName:R,inspectorEmail:$,from:H,to:V,records:t.records});o.ok?(c.useSafety.getState().logInspectorSend(o.send),U({kind:'success',text:'shared'===s?`Shared: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Pick your email and send it to ${$.trim()}. This is recorded in the log.`:`Downloaded: ${t.records} records, ${(0,p.rangeWords)(H,V)}. Attach the file to an email to ${$.trim()}. This is recorded in the log.`})):U({kind:'warn',text:o.why})};return(0,x.jsxs)(s.default,{style:{gap:12,alignItems:'stretch'},testID:"inspector-view",children:[(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:"Inspector"}),(0,x.jsx)(o.Muted,{center:!0,children:"An environmental health inspector can have the full food-safety log: every temperature, delivery, cleaning and allergen check, diary notes and sign-offs."}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(s.default,{testID:"inspector-email-not-set-up",style:{alignSelf:'stretch'},children:(0,x.jsx)(o.Banner,{kind:"info",title:"Email isn\u2019t set up yet \u2014 share the file instead",children:"When you press Send logs and confirm, your phone\u2019s share sheet opens with the file, so you can email it yourself. If sharing isn\u2019t available, the file downloads."})}),(0,x.jsx)(o.Field,{label:"Inspector\u2019s name",testID:"inspector-name",value:R,onChangeText:e=>{k(e),_(!1)},autoCapitalize:"words",maxLength:80,textContentType:"name"}),A&&G?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:G})}):null,(0,x.jsx)(o.Field,{label:"Inspector\u2019s email",testID:"inspector-email",value:$,onChangeText:e=>{M(e),_(!1)},autoCapitalize:"none",autoCorrect:!1,keyboardType:"email-address",textContentType:"emailAddress",placeholder:"name@council.gov.uk",maxLength:254}),A&&q?(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:"inspector-email-problem",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:q})}):null]}),(0,x.jsxs)(f.Box,{style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Dates"}),(0,x.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,x.jsx)(o.Chip,{label:"All history",testID:"inspector-all",selected:P,accessibilityLabel:"All history",onPress:()=>{B(!0),_(!1)}}),(0,x.jsx)(o.Chip,{label:"Choose dates",testID:"inspector-choose",selected:!P,accessibilityLabel:"Choose dates",onPress:()=>{B(!1),_(!1),E||Y((0,p.dmy)(L)),N||O((0,p.dmy)(T))}})]}),P?null:(0,x.jsxs)(s.default,{style:{gap:8,alignSelf:'stretch'},children:[(0,x.jsx)(o.Field,{label:"From (DD/MM/YYYY)",testID:"inspector-from",value:E,onChangeText:e=>{Y(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10}),(0,x.jsx)(o.Field,{label:"To (DD/MM/YYYY)",testID:"inspector-to",value:N,onChangeText:e=>{O(e),_(!1)},keyboardType:"numbers-and-punctuation",maxLength:10})]}),Q?(0,x.jsxs)(o.Muted,{center:!0,testID:"inspector-range",children:[(0,p.rangeWords)(H,V)," \xb7 ",J.records," record",1===J.records?'':'s']}):(0,x.jsx)(s.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.T,{size:14,colour:y.colours.red,center:!0,children:"Use dates like 01/10/2026, with the first date on or before the second."})}),Q&&0===J.records?(0,x.jsx)(o.Muted,{center:!0,children:"Nothing is logged in these dates yet."}):null]}),F?(0,x.jsxs)(s.default,{testID:"inspector-confirm",accessibilityLiveRegion:"polite",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint,alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:(0,p.confirmQuestion)($,H,V)}),p.INSPECTOR_EMAIL.ready?null:(0,x.jsx)(o.Muted,{center:!0,children:"Email isn\u2019t set up yet, so the file opens in your share sheet to send it yourself."}),(0,x.jsx)(o.Button,{label:"Yes, send",testID:"inspector-confirm-yes",accessibilityLabel:`Yes, ${(0,p.confirmQuestion)($,H,V).replace(/\?$/,'')}`,onPress:()=>{ee()},style:{alignSelf:'stretch'}}),(0,x.jsx)(o.Button,{kind:"secondary",label:"Cancel",testID:"inspector-confirm-no",accessibilityLabel:"Cancel, nothing is sent",onPress:()=>_(!1),style:{alignSelf:'stretch'}})]}):(0,x.jsx)(o.Button,{label:"Send logs",testID:"inspector-send",accessibilityLabel:"Send logs to the inspector. You confirm before anything is sent.",onPress:()=>{W(!0),U(null),K&&_(!0)},style:{alignSelf:'stretch',minHeight:56}}),z?(0,x.jsx)(s.default,{testID:"inspector-msg",accessibilityLiveRegion:"polite",children:(0,x.jsx)(o.Banner,{kind:z.kind,children:z.text})}):null,'success'===z?.kind?(0,x.jsx)(o.Button,{kind:"secondary",label:"Open my email",testID:"inspector-open-email",accessibilityLabel:`Open your email app with a message to ${$.trim()}. Attach the file, then send.`,onPress:()=>{const e=`Food safety log, ${C.name}, ${(0,p.rangeWords)(H,V)}`;n.default.openURL(`mailto:${encodeURIComponent($.trim())}?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`Dear ${R.trim()},\n\nPlease find our food safety log attached.\n\n${Z}, ${C.name}`)}`).catch(()=>{})},style:{alignSelf:'stretch'}}):null,(0,x.jsxs)(f.Box,{testID:"inspector-sends",style:{alignItems:'center'},children:[(0,x.jsx)(o.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Sent to inspectors"}),S.length?S.slice(0,20).map(e=>(0,x.jsxs)(o.Muted,{center:!0,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,") ",'emailed'===e.method?'emailed':'shared'===e.method?'shared':'downloaded'," ",(0,p.rangeWords)(e.from,e.to)," for ",e.inspectorName,", ",e.inspectorEmail]},e.id)):(0,x.jsx)(o.Muted,{center:!0,children:"Nothing sent yet."})]})]})};var t=r(d[0]),n=e(r(d[1]));r(d[2]);var s=e(r(d[3])),o=r(d[4]),l=r(d[5]),c=r(d[6]),h=r(d[7]),u=r(d[8]),p=r(d[9]),y=r(d[10]),f=r(d[11]),b=r(d[12]),x=r(d[13]);async function I(e,t,n){if('undefined'==typeof window)return null;const s=globalThis.navigator;try{const o=globalThis.File;if(o&&s?.canShare){const l=new o(['\ufeff'+t],e,{type:'text/csv'});if(s.canShare({files:[l]}))return await s.share({files:[l],title:n,text:n}),'shared'}}catch(e){if(e&&'AbortError'===e.name)return null}return(0,f.downloadText)(e,t)?'downloaded':null}const w=[]},1168,[34,379,236,102,794,865,1019,1167,1020,1169,840,928,1164,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return t}}),_e.inspectorEmailProblem=n,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return r}}),_e.inspectorNameProblem=a,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return i}}),_e.rangeWords=c,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${c(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',u(t.at),f(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,i(e.date),f(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',i(e.date),f(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${i(t.week)})`,u(t.at),f(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${i(t.week)})`,u(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',u(e.at),f(e.at),'Management','','',`${i(e.from)} to ${i(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${c(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,y,...r].map(e=>e.map(m).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const o=a(e.inspectorName);if(o)return{ok:!1,why:o};const r=n(e.inspectorEmail);return r?{ok:!1,why:r}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||t.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:t.why}};var e=_r(_d[0]);const t={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},o=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function n(e){const t=(e??'').trim();return t?t.length>254||!o.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const r=e=>''===n(e);function a(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const s=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},i=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function c(e,t){const o=s(e),n=s(t),r=e=>`${e.getDate()} ${l[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${l[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function d(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),i=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(s(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:i,daySigns:l,weekly:c,records:a.length+i.length+l.length+c.length}}const m=e=>{const t=null==e?'':String(e);return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),u=e=>new Date(e).toLocaleDateString('en-GB'),y=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1169,[1020]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1170,[]); +__d(function(g,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.KindChip=function({kind:e,size:t=34}){return(0,b.jsx)(s.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,b.jsx)(w,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=w,_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&&'review'!==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:C(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:I(t,e),content:({close:n})=>(0,b.jsx)(T,{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({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??m.KIND_META[e]?.colour??'#CFA45F',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",...s}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,b.jsx)(o.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):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",...s}):null,a?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,b.jsx)(o.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function j({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 S({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 I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,C=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function T({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),w=e=>{y(e),setTimeout(m,1800)},I='managers'===a,C=l??'Manager',T='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,T.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:T.map(([e,t])=>(0,b.jsx)(j,{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:[I&&!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)(S,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',C),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(S,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',C),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(S,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(S,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,C,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(S,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(S,{kind:"ghost",label:!I||'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])}},1171,[829,34,236,402,102,900,848,840,794,1172,1099,1173,25]); +__d(function(_g,r,i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"BANNER_MS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return x}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:u}){const p=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!f||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=h,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,x),j=e.length-y.length,C=(0,g.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:f?'fixed':'absolute',left:10,right:n?10:76,top:8+p.top,zIndex:2147483001,gap:8,alignItems:'center',...f?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,g.jsx)(I,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>u(e)},e.id+':'+e.at)),j>0?(0,g.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:b.SLIDER.border},children:(0,g.jsxs)(c.T,{size:13,colour:b.SLIDER.quiet,children:[j," more new ",1===j?'booking':'bookings']})}):null]});if(f)try{const e=r(_d[12],"react-dom");if(e?.createPortal)return e.createPortal(C,document.body)}catch{}return C};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]);const f='undefined'!=typeof document,h="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",p=e=>f?{dataSet:{ccbn:e}}:{},y=7e3,x=3;function I({a:e,big:a,managers:h,me:x,onOpen:I,onClose:j}){const C='pending'===e.kind,[R,k]=(0,o.useState)(null),L=C&&h&&!R;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(j,R?1800:y);return()=>clearTimeout(e)},[L,R]);const D=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&j()}})).current,S=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',E=[e.when,S,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),z=C?'Booking request':'New booking',w=[e.when,S,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),v=`${z}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${I?' Tap to open bookings.':''}`,T=n=>{e.refId&&!e.test&&u.repo.bookings.decide(e.refId,n,x??'Manager'),k('confirmed'===n?'Confirmed.':'Declined.')};return(0,g.jsxs)(s.default,{...D.panHandlers,...p('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:b.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':b.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:C?d.colours.amber:d.colours.gold,...f?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,g.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:v,disabled:!I,onPress:()=>{j(),I?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,g.jsx)(c.T,{size:a?14:12,weight:"bold",colour:C?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:R??z.toUpperCase()}),(0,g.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:b.SLIDER.text,numberOfLines:1,children:e.name}),E?(0,g.jsx)(c.T,{size:a?18:15,colour:b.SLIDER.quiet,numberOfLines:1,children:E}):null,e.allergy?(0,g.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,g.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,g.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>T('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:b.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,weight:"bold",colour:b.SLIDER.ink,children:"Confirm"})}),(0,g.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>T('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,g.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,g.jsx)(l.default,{testID:"booking-banner-close",accessibilityRole:"button",accessibilityLabel:`Close ${z.toLowerCase()} for ${e.name}`,onPress:j,style:{minWidth:56,minHeight:56,alignItems:'center',justifyContent:'center',paddingHorizontal:8},children:(0,g.jsx)(c.T,{size:a?16:14,weight:"medium",colour:b.SLIDER.quiet,children:"Close"})})]})}},1172,[829,34,380,236,402,102,36,840,794,1099,848,25,277]); +__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.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...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]}})})},1173,[1174,1175,1177,1176,1178,1033,1179]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1174,[]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isUnread",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"isCleared",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"DEFAULT_PREFS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useAlerts",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),a=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);const f=(e,t)=>!e.read[t.id]&&t.at>(e.readAllAt?.[t.rid]??0),A=(e,t)=>{const s=e.cleared?.[t.rid];return!!s&&(t.at<=s.all||void 0!==s.ids[t.id]&&t.at<=s.ids[t.id])},p=(e,t)=>Object.fromEntries(Object.entries(e).filter(([,e])=>e>t).sort((e,t)=>t[1]-e[1]).slice(0,1e3)),y={muted:!1,types:{booking:!0,pending:!0,takeaway:!0,email:!0,review:!0,test:!0},system:!0},u=(0,n.create)()((0,a.persist)((e,t)=>({history:[],read:{},seen:{},seenAt:{},todoSeen:{},readAllAt:{},prefs:y,askedSystem:!1,live:[],cleared:{},clearAlerts:(t,s,i)=>e(e=>{const n=e.cleared[t]??{all:0,ids:{}},a=Math.max(n.all,i??0),l={...n.ids};for(const[e,t]of Object.entries(s))l[e]=Math.max(l[e]??0,t);const o={...e.cleared,[t]:{all:a,ids:p(l,a)}};return{cleared:o,live:e.live.filter(e=>!A({cleared:o},e))}}),raise:(s,i)=>{const n=t().history.find(e=>e.id===s.id),a=!!n&&(s.nag??0)>(n.nag??0);e(e=>{const t={...e.read};return n&&!a||delete t[s.id],{history:[s,...e.history.filter(e=>e.id!==s.id)].slice(0,150),read:t}});const f=t().prefs;!1!==f.types[s.kind]&&(e(e=>({live:[s,...e.live.filter(e=>e.id!==s.id)].slice(0,12)})),f.muted||i?.quiet||'chef'===l.APP_VARIANT||'display'===l.APP_VARIANT||(0,o.chime)(a?'soft':'bright'),f.system&&'owner'===l.APP_VARIANT&&(0,c.showSystemNotification)(s))},dismiss:t=>e(e=>({live:e.live.filter(e=>e.id!==t)})),dropLive:s=>{t().live.some(s)&&e(e=>({live:e.live.filter(e=>!s(e))}))},markRead:t=>e(e=>({read:{...e.read,...Object.fromEntries(t.map(e=>[e,!0]))}})),setPrefs:t=>e(e=>({prefs:{...e.prefs,...t}})),setType:(t,s)=>e(e=>({prefs:{...e.prefs,types:{...e.prefs.types,[t]:s}}})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:[...new Set([...e.seen[t]??[],...s])].slice(-2e4)}})),markAllRead:(t,s,i)=>e(e=>({readAllAt:{...e.readAllAt,[t]:Math.max(e.readAllAt[t]??0,s)},read:{...e.read,...Object.fromEntries(e.history.filter(e=>e.rid===t&&(i||e.at<=s)).map(e=>[e.id,!0]))},live:i?e.live.filter(e=>e.rid!==t):e.live})),markAllSeen:(t,s,i)=>e(e=>({seenAt:{...e.seenAt,[t]:Math.max(e.seenAt[t]??0,s)},todoSeen:i?{...e.todoSeen,[t]:[...new Set(i)].slice(-400)}:e.todoSeen})),setAsked:()=>e({askedSystem:!0}),clearHistory:()=>e({history:[],read:{}})}),{name:`covercharge-alerts-${l.APP_VARIANT}-v1`,version:2,storage:(0,a.createJSONStorage)(()=>s.default),partialize:e=>({history:e.history,read:e.read,seen:e.seen,seenAt:e.seenAt,todoSeen:e.todoSeen,readAllAt:e.readAllAt,prefs:e.prefs,askedSystem:e.askedSystem,cleared:e.cleared}),migrate:(e,t)=>{if(e&&t<2){const t={...e.read??{}};for(const s of e.history??[])'booking'!==s.kind&&'pending'!==s.kind||(t[s.id]=!0);return{...e,read:t,seenAt:{},todoSeen:{},readAllAt:{}}}return e},merge:(e,t)=>({...t,...e,cleared:e?.cleared??{},prefs:{...y,...e?.prefs??{},types:{...y.types,...e?.prefs?.types??{}}}})}));'undefined'!=typeof window&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,i.venueKey)(u.persist.getOptions().name??'')&&u.persist.rehydrate()})},1175,[808,5,815,818,846,1033,1176]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.systemSupport=s,e.requestSystemPermission=async function(){if('unsupported'===s())return'unsupported';try{return await window.Notification.requestPermission()}catch{return s()}},Object.defineProperty(e,"isInstalled",{enumerable:!0,get:function(){return c}}),e.alertText=l,e.showSystemNotification=async function(t,o=!1){if('granted'!==s())return!1;if(!o&&'visible'===document.visibilityState)return!1;const{title:a,body:c}=l(t),u={body:c,tag:t.id,renotify:!0,icon:`/${n.APP_VARIANT}-app/icon-192.png`,data:{url:location.href}};try{const t=await(navigator.serviceWorker?.getRegistration?.());return t?.showNotification?(await t.showNotification(a,u),!0):(new window.Notification(a,u),!0)}catch{return!1}},Object.defineProperty(e,"PUSH_BACKEND",{enumerable:!0,get:function(){return u}}),e.subscribeToPush=async function(t,n){return{ok:!1,why:'Locked-phone alerts are not available through this connection. Alerts show while the app is open.'}};var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]);const a='undefined'!=typeof window;function s(){return a&&'Notification'in window?window.Notification.permission:'unsupported'}const c=()=>a&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);function l(n){const a=o.KIND_META[n.kind].kicker,s=('takeaway'===n.kind?[n.orderNo,null!=n.items?`${n.items} items`:'',n.total,n.collect?`collect ${n.collect}`:'']:'email'===n.kind?[n.subject??'']:[n.when,null!=n.covers?`${n.covers} covers`:'',n.table?`${(0,t.tableNumbers)(n.table)}`:'',n.source??'']).filter(Boolean).join(' \xb7 ')+(n.allergy?`\nAllergy: ${n.allergy}`:'');return{title:`${a[0]}${a.slice(1).toLowerCase()}: ${n.name}`,body:s}}const u=null},1176,[829,236,846,1174]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSource=p,e.bookingAlert=k,e.orderAlert=S,Object.defineProperty(e,"FRESH_MS",{enumerable:!0,get:function(){return y}}),e.isFreshBooking=m,e.useAlertWatcher=function(a,r={}){const i=r.kinds??['booking','pending','takeaway'];(0,t.useEffect)(()=>{if(!1===r.enabled)return;const t=()=>{const t=n.useStore.getState(),r=o.useAlerts.getState();if(!t.restaurants.find(t=>t.id===a))return;const s=w(new Date('live'===t.clock.mode?Date.now():t.clock.simStartMs+(Date.now()-t.clock.anchorRealMs))),d=t.bookings.filter(t=>t.restaurantId===a),l=t.orders.filter(t=>t.restaurantId===a&&'takeaway'===t.type),c=[...d.map(t=>t.id),...l.map(t=>t.id)],u=r.seen[a];if(!u)return void r.markSeen(a,c);const f=new Set(u),p=c.filter(t=>!f.has(t));if(p.length){r.markSeen(a,p);const t=new Set(p);for(const n of d.filter(n=>t.has(n.id)&&m(n,Date.now(),s))){const t=k(n,s);i.includes(t.kind)&&r.raise(t)}if(i.includes('takeaway'))for(const n of l.filter(n=>t.has(n.id)&&'new'===n.status))r.raise(S(n,d))}r.dropLive(t=>t.rid===a&&('pending'===t.kind&&'pending'!==d.find(n=>n.id===t.refId)?.status||'takeaway'===t.kind&&!!l.find(n=>n.id===t.refId&&(n.accepted||'new'!==n.status))))};t();const d=n.useStore.subscribe(t),l=r.nag?setInterval(()=>{const t=o.useAlerts.getState();if(!1===t.prefs.types.pending)return;const r=n.useStore.getState();for(const n of r.bookings.filter(t=>t.restaurantId===a&&'pending'===t.status)){const a=t.history.find(t=>t.id===`pending:${n.id}`);a&&(Date.now()-a.at>=s.NAG_MS&&t.raise({...a,at:Date.now(),nag:(a.nag??0)+1}))}},2e4):null;return()=>{d(),l&&clearInterval(l)}},[a,r.enabled,r.nag,i.join(',')])};var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]);const d=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||t,l=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`},c=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],f=t=>t.map(t=>`${(0,a.allergenLabel)(t.allergen)} (${(0,a.severityLabel)(t.severity).toLowerCase()})`).join(', ');function p(t){return t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source||t.customerId?'Online':'Phone'}function k(t,n){const[a,r,i]=t.date.split('-').map(Number),o=t.date===n?`Today ${t.time}`:`${c[new Date(a,r-1,i,12).getDay()]} ${i} ${u[r-1]}, ${t.time}`;return{id:`${'pending'===t.status?'pending':'booking'}:${t.id}`,kind:'pending'===t.status?'pending':'booking',rid:t.restaurantId,at:Date.now(),refId:t.id,name:t.walkIn?'Walk-in':d(t.name),when:o,covers:t.partySize,table:t.table,source:p(t),allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:t.allergies.length?t.allergyAck?`Step 1 of 5, Booked, signed by ${t.allergyAck.by}`:'Step 1 of 5 (Booked) needs signing off':void 0}}function S(t,n){const a=(0,r.nextStep)(t,(0,r.linkedBooking)(t,n));return{id:`takeaway:${t.id}`,kind:'takeaway',rid:t.restaurantId,at:Date.now(),refId:t.id,name:d(t.customerName),orderNo:t.ref,items:t.lines.reduce((t,n)=>t+n.qty,0),total:(0,i.gbp)(t.total),collect:t.readyBy?l(t.readyBy):t.slotTime?l(t.slotTime):'As soon as ready',source:'phone'===t.channel?'Phone':'walk-in'===t.channel?'In person':'Online',allergy:t.allergies.length?f(t.allergies):void 0,allergyStep:a?`Step ${(0,r.stepInfo)(a).n} of 5 (${(0,r.stepInfo)(a).label}) needs signing off`:void 0}}const y=18e5;function m(t,n,a){const r=Date.parse(t.createdAt??'');return!(!Number.isFinite(r)||n-r>y||r-n>3e5)&&(t.date>=a&&['confirmed','pending','seated'].includes(t.status))}const w=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1177,[34,848,830,838,836,1175,1174]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CONNECTED_INBOX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"INBOX_EMPTY",{enumerable:!0,get:function(){return n}});const t=null,n='Connect your venue email to get alerts'},1178,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAlertSeenSync=function(c){const u=(0,l.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null);(0,t.useEffect)(()=>{if(!u)return;let t=!1;return(async()=>{try{const{data:l}=await(0,s.getSupabase)().from('alert_seen').select('seen_at, todo_seen, read_all_at').eq('venue_id',u).maybeSingle();!t&&l&&(n.useAlerts.getState().markAllSeen(c,Date.parse(l.seen_at)||0,l.todo_seen??[]),l.read_all_at&&n.useAlerts.getState().markAllRead(c,Date.parse(l.read_all_at)||0))}catch{}try{const s=await(0,l.rpc)('alert_clears_get',{p_venue:u});!t&&s&&n.useAlerts.getState().clearAlerts(c,s.ids??{},s.allAt&&Date.parse(s.allAt)||0)}catch{}})(),()=>{t=!0}},[u,c])},e.markNotificationsSeen=async function(t,s){const u=Date.now();n.useAlerts.getState().markAllSeen(t,u,s);const _=c();if(!_)return;try{await(0,l.rpc)('alert_seen_mark',{p_venue:_,p_at:new Date(u).toISOString(),p_todo:s.slice(-400)})}catch{}},e.markAllAlertsRead=async function(t,s,u){const _=Date.now();n.useAlerts.getState().markAllRead(t,_,!0),u&&(0,l.markChatRead)(u,'*');n.useAlerts.getState().markAllSeen(t,_,s);const o=c();if(!o)return!0;try{return await(0,l.rpc)('alert_seen_mark',{p_venue:o,p_at:new Date(_).toISOString(),p_todo:s.slice(-400),p_read_all:!0}),!0}catch{return!1}},e.clearAlertsSynced=async function(t,s,u){n.useAlerts.getState().clearAlerts(t,s,u);const _=c();if(!_)return!0;try{return await(0,l.rpc)('alert_clear',{p_venue:_,p_ids:s,p_all_before:u?new Date(u).toISOString():null}),!0}catch{return!1}};var t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]);const c=()=>{const t=l.useSync.getState();return t.venueId&&'staff'===t.kind?t.venueId:null}},1179,[34,1175,985,931]); +__d(function(g,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,"needsConfirm",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"untickedAllergies",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"kitchenAlarms",{enumerable:!0,get:function(){return x}}),_e.KitchenFlash=function({rid:e,me:l}){const n=(0,c.useOrders)(e),s=x(n),o=s[0];(0,b.useBuildingChime)(!!o,4e3,6e4);const a=t.default.useRef(l);return a.current=l,t.default.useEffect(()=>{o?(0,f.notify)({id:'kitchen-flash',tone:'urgent',modal:!0,testID:'kitchen-flash',icon:'\u26a0\ufe0f',kicker:'TAKEAWAY \xb7 KITCHEN CHECK',title:`Order ${o.ref}: confirm it and tick each allergy`,body:"This stays up, with a low chime that builds, until both are done."+(s.length>1?` ${s.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,y.jsx)(T,{rid:e,id:o.id,me:a.current})}):(0,f.dismissNotice)('kitchen-flash')},[o?.id,s.length,e]),t.default.useEffect(()=>()=>(0,f.dismissNotice)('kitchen-flash'),[]),null};var t=e(r(d[0])),l=e(r(d[1])),n=e(r(d[2])),s=e(r(d[3])),c=r(d[4]),o=r(d[5]),a=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),b=r(d[10]),y=r(d[11]);const k=e=>!['cancelled','collected','closed'].includes(e.status),j=e=>'new'===e.status&&!e.accepted,p=e=>e.allergyAck?[]:e.allergies.filter(t=>!e.allergyTicks?.[t.allergen]),x=e=>e.filter(e=>'takeaway'===e.type&&k(e)&&(j(e)||p(e).length>0)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function T({rid:e,id:t,me:f}){const k=(0,c.useOrders)(e).find(e=>e.id===t),p=(0,c.useStore)(e=>e.tickOrderAllergy),{width:x}=(0,s.default)();if(!k)return null;const T=j(k);return(0,y.jsxs)(n.default,{style:{gap:12},children:[(0,y.jsx)(n.default,{style:{alignSelf:'flex-end'},children:(0,y.jsx)(h.SoundToggle,{})}),(0,y.jsx)(b.TakeawayFacts,{o:k,big:x>=700,personal:!1}),k.allergies.length&&!k.allergyAck?(0,y.jsxs)(n.default,{style:{gap:8},children:[(0,y.jsx)(u.T,{size:16,weight:"semibold",colour:"#FFB3AB",children:"Tick each allergy once you\u2019ve checked it:"}),k.allergies.map(e=>{const t=!!k.allergyTicks?.[e.allergen];return(0,y.jsxs)(l.default,{testID:`kitchen-tick-${e.allergen}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},accessibilityLabel:`Allergy confirmed: ${(0,o.allergenLabel)(e.allergen)}`,onPress:()=>p(k.id,e.allergen,f,!t),style:{flexDirection:'row',alignItems:'center',gap:12,borderWidth:1.5,borderColor:t?a.colours.gold:a.colours.red,backgroundColor:'rgba(255,255,255,0.03)',borderRadius:12,padding:12,minHeight:60},children:[(0,y.jsx)(n.default,{style:{width:34,height:34,borderRadius:8,borderWidth:2.5,borderColor:t?a.colours.gold:'#FFFFFF',alignItems:'center',justifyContent:'center'},children:t?(0,y.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,children:"\u2713"}):null}),(0,y.jsxs)(u.T,{size:18,weight:"semibold",style:{flex:1},children:[(0,o.allergenLabel)(e.allergen)," (",(0,o.severityLabel)(e.severity),") ",t?'\xb7 confirmed':'\xb7 not checked yet']})]},e.allergen)})]}):null,T?(0,y.jsx)(u.Button,{label:`Confirm order ${k.ref}`,testID:"kitchen-confirm",onPress:()=>{c.repo.orders.accept(k.id,f)},style:{minHeight:64,borderRadius:14}}):(0,y.jsxs)(u.T,{size:16,colour:a.colours.goldLight,center:!0,children:["Order confirmed",k.accepted?` by ${k.accepted.by}`:'',". Tick the allergies above to finish."]})]})}},1180,[34,402,102,426,848,830,840,794,1171,1099,1181,25]); +__d(function(g,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}},1181,[34,102,426,848,830,1173,1033,840,794,1099,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},1182,[34,236,402,102,853,794,840,994,1183,1184,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1183,[846,6,931,974,994,1173,1184]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1184,[808,1185,815,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reviewRequestText=function(o,n,s,u){const c=o.trim()||'the restaurant';let v=`Thank you for visiting ${c}. We'd love to hear about your experience. Leave your review: ${n}. Your rating, comments and chosen public name may appear on our website and app after moderation under our review policy. We welcome honest feedback, positive or negative.`;const l=s.trim();t.test(l)&&(v+=` You can also review us on Google: ${l}`);u.trim()&&(v+=` If you would rather not get these emails, opt out: ${u.trim()}`);return{subject:`How was your visit to ${c}?`,body:v}},e.reviewRequestMaySend=function(t,o){const n=(o??'').trim();return'finished'===String(t??'').toLowerCase()&&/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/.test(n)};const t=/^https:\/\/\S+$/i},1185,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1186,[34,846,1183]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useChefAssistant",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"CHEF_PROMPTS",{enumerable:!0,get:function(){return R}}),_e.ChefAssistantButton=function({compact:e}){return e?(0,k.jsx)(c.default,{testID:"chef-assistant-open",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{borderRadius:12,backgroundColor:v.colours.accentBg,borderWidth:1,borderColor:v.colours.accentBorder,paddingVertical:6,paddingHorizontal:12,minHeight:36,justifyContent:'center'},children:(0,k.jsx)(f.T,{weight:"semibold",colour:v.colours.goldLight,size:13,children:"\u2726 Assistant"})}):(0,k.jsx)(l.ActionTile,{primary:!0,testID:"chef-assistant-open",icon:"sparkle",label:"Assistant",sub:"Recipe card, order, allergens, GP, temps",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0)})},_e.ChefAssistantSheet=function({go:e}){const o=S(e=>e.open),l=()=>S.getState().setOpen(!1),{rid:p,me:A,menu:z,k:L,c:B}=(0,w.useChef)(3e4),F=(0,C.useSuggestions)(),G=(0,n.useSafetyView)('chef').points,[E,M]=(0,a.useState)([]),[H,N]=(0,a.useState)(''),[_,V]=(0,a.useState)(!1),[K,Y]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>q.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!o)return null;const U=(e,t=!1)=>M(n=>[...n,{id:I(),from:'bot',text:e,demo:t}]),J=e=>M(t=>[...t,{id:I(),from:'bot',plan:e,state:'open'}]),X=z.filter(e=>!e.name.includes('(example)')||!0),Z=(t,n)=>{const a=O(t);if(!(0,r.chefCanSee)(p,t))return void U('That check is managed in the Managers app.');if(/\b(send|email|text|pay|delete|remove|order now|place the order)\b/.test(a)&&!/\b(build|draft|make|prepare)\b/.test(a))return void U('I can\u2019t send, pay for or delete anything. I can prepare it for you to check and do yourself, for example \u201cbuild the fish order\u201d.');const o=(0,b.parseQuick)(t,G).filter(e=>e.point&&(0,b.isTempKind)(e.point.kind));if(o.length&&(/\b(fridge|freezer|walk ?in|core|probe|cool|hot|deliver|degree|temp)/.test(a)||o.some(e=>null!=e.value))){const t=o.filter(e=>null!=e.value),r=o.filter(e=>null==e.value);if(r.length&&U(`I didn\u2019t hear a temperature for ${r.map(e=>e.point.name).join(', ')}. Say or type the reading, for example \u201c${r[0].point.name} 4 degrees\u201d. I never fill one in.`),!t.length)return;const s=t.filter(e=>!(0,b.inRange)(e.point,e.value));return void J({title:`Log ${1===t.length?'a reading':`${t.length} readings`} in the food safety log`,detail:t.map(e=>`${e.point.name}: ${e.value}\xb0C (${(0,b.limitText)(e.point)})${(0,b.inRange)(e.point,e.value)?'':' \xb7 OUT OF RANGE'}`).join('\n')+`\nSigned ${(0,b.initialsOf)(A)} \xb7 ${n?'voice':'typed'}`,warn:s.length?`${s.map(e=>e.point.name).join(', ')} out of range: you\u2019ll need to add the corrective action in the food safety log.`:void 0,confirm:'Log it',run:()=>{const r=(new Date).toISOString();return j.useSafety.getState().addEntries(t.map(e=>({pointId:e.point.id,name:e.point.name,kind:e.point.kind,at:r,by:A.replace(' (example)',''),byId:w.CHEF_ID,app:'chef',value:e.value,ok:(0,b.inRange)(e.point,e.value),source:n?'voice':'typed',initials:(0,b.initialsOf)(A)}))),s.length&&setTimeout(()=>e('haccp'),600),`Logged ${t.map(e=>`${e.point.name} ${e.value}\xb0C`).join(', ')}.${s.length?' Opening the food safety log for the corrective action.':''}`}})}if(/\b(fridge|freezer|temp|temperature|degrees)\b/.test(a))return void U('Which unit, and what does it read? For example \u201cprep fridge 4 degrees\u201d or \u201cfreezer minus 19\u201d. I only log the number you give me.');if(/allergen|allerg|contain|gluten|nut|dairy|milk|shellfish|crustacean|coeliac/.test(a)){const e=W(t,X,e=>e.name);if(!e)return void U('Which dish? For example \u201callergens in the fish and chips\u201d.');const n=(0,x.recipeCards)().byMenuItem(e.id),r=e=>m.ALLERGENS.find(t=>t.id===e)?.label??e,s=Object.entries(e.allergens??{}).filter(([,e])=>'contains'===e).map(([e])=>r(e)),a=Object.entries(e.allergens??{}).filter(([,e])=>'may'===e).map(([e])=>r(e));return void U(`${e.name}: ${s.length?`contains ${s.join(', ')}`:'no allergens recorded as \u201ccontains\u201d'}${a.length?`; may contain ${a.join(', ')}`:''}. ${n?n.signOff?`From the signed-off recipe card (${n.signOff.by}).`:'The recipe card is awaiting your sign-off, so check it before telling a guest.':'There\u2019s no recipe card for it yet.'} Always check the card and the ingredients with the guest.`)}if(/\bgp\b|gross profit|margin|price for|what price|cost of|costing/.test(a)){const e=W(t,B,e=>e.item.name),n=Number((t.toLowerCase().match(/(\d{2})\s*(?:%|percent|per cent)/)??[])[1])||L.targetGp;if(!e)return void U(`Which dish? I can cost the dishes that have a recipe in GP & costing (${B.length} do). For example \u201cGP on the haddock\u201d.`);const r=(0,$.priceForTarget)(e.cost,n);return void U(`${e.item.name}: food cost ${(0,y.gbp)(e.cost)}, sells at ${(0,y.gbp)(e.priceInc)} (inc VAT) = ${e.gp.toFixed(1)}% GP. For ${n}% GP it would need ${(0,y.gbp)(r)} inc VAT. Prices are changed by a manager; I haven\u2019t changed anything.`)}if(/\border|supplier|delivery|par\b|restock/.test(a)){const n=W(t,F,e=>`${e.s.name} ${e.s.category??''}`)??(1===F.length?F[0]:void 0);return n?void J({title:`Build an order for ${n.s.name}`,detail:(n.lines.length?n.lines.map(e=>`${e.i.name}: ${(0,s.fishQtyText)(p,e.i,e.qty)}`).join('\n')+`\nAbout ${(0,y.gbp)(n.total)} at the latest prices.`:'Nothing is below par for this supplier yet.')+'\nI\u2019ll open it in Ordering for you to check, change and place yourself. Nothing is sent.',confirm:'Open the order',run:()=>(setTimeout(()=>{l(),e('orders',n.s.id)},400),`Opening the ${n.s.name} order. You check it and place it yourself.`)}):void U(F.length?`Which supplier? ${F.map(e=>e.s.name).join(', ')}.`:'Nothing is below par and no supplier orders today.')}if(/recipe|card|new dish|write up|spec/.test(a)){const n=t.replace(/^.*?(?:recipe card|card|recipe|dish|spec)\s*(?:for|of)?\s*/i,'').replace(/[.?!]+$/,'').trim();if(!n||n.length<3)return void U('What\u2019s the dish called? For example \u201cdraft a recipe card for crab linguine\u201d.');const r=n.replace(/^the\s+/i,'').replace(/^./,e=>e.toUpperCase()).slice(0,60),s=(0,x.recipeCards)().list(p).find(e=>O(e.dish)===O(r));return s?(U(`There\u2019s already a card for ${s.dish}. Opening Recipe cards.`),void setTimeout(()=>{l(),e('recipes')},600)):void J({title:`Draft a recipe card: ${r}`,detail:'A new card, awaiting your sign-off, with the dish name and section filled in. You add the ingredients, method, allergens, photo and price, then sign it off. It isn\u2019t shown to guests until you do.',confirm:'Make the draft',run:async()=>(await(0,x.recipeCards)().create(p,{dish:r,section:'Specials',price:null,ingredients:[],steps:[]},{name:A,role:'head-chef'}),setTimeout(()=>{l(),e('recipes')},500),`Draft card for ${r} saved, awaiting sign-off. Opening Recipe cards.`)})}const d='I can help with: drafting a recipe card, building a supplier order, a dish\u2019s allergens, GP pricing, and logging a temperature you read out. Try one of the suggestions.';(0,T.askServer)('chef',t,[]).then(e=>U('text'===e.kind?e.text:d)).catch(()=>U(d))},ee=(e,t=!1)=>{const n=e.trim();if(n){N(''),M(e=>[...e,{id:I(),from:'you',text:n}]);try{Z(n,t)}catch(e){U(`Sorry, that didn\u2019t work: ${e.message}`)}}},te=async e=>{if(e.plan){M(t=>t.map(t=>t.id===e.id?{...t,state:'done'}:t));try{U(String(await e.plan.run()))}catch(e){U(`Couldn\u2019t do that: ${e.message}`)}}},ne=e=>{M(t=>t.map(t=>t.id===e.id?{...t,state:'cancelled'}:t)),U('Cancelled. Nothing was changed.')},ie=()=>{ee(H,K),Y(!1)};return(0,k.jsx)(d.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsx)(h.default,{style:[f.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(h.default,{testID:"chef-assistant",style:{backgroundColor:v.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:v.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(f.T,{size:20,weight:"semibold",children:"\u2726 Kitchen Assistant"}),(0,k.jsx)(c.default,{accessibilityLabel:"Close",onPress:l,hitSlop:10,children:(0,k.jsx)(f.T,{size:22,colour:v.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(h.default,{testID:"chef-assistant-demo",children:(0,k.jsx)(f.Badge,{kind:"amber",label:P})}),(0,k.jsxs)(u.default,{ref:q,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,k.jsxs)(h.default,{style:{gap:8},children:[(0,k.jsxs)(f.T,{children:["Hi ",A.split(' ')[0],". Type or tap \ud83c\udfa4 and say what you need. I\u2019ll show you what I\u2019m about to do and wait for you to confirm. I never send, pay or delete."]}),R.map(e=>(0,k.jsx)(c.default,{accessibilityRole:"button",onPress:()=>ee(e),style:{borderWidth:1,borderColor:v.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:v.colours.surface2},children:(0,k.jsx)(f.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,k.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id):e.plan?(0,k.jsxs)(h.default,{testID:"chef-confirm-card",style:{borderWidth:1.5,borderColor:'open'===e.state?v.colours.gold:v.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:v.colours.surface2},children:[(0,k.jsx)(f.T,{weight:"semibold",children:e.plan.title}),(0,k.jsx)(f.T,{size:14,colour:v.colours.muted,children:e.plan.detail}),e.plan.warn?(0,k.jsxs)(f.T,{size:13,colour:v.colours.amber,children:["\u26a0 ",e.plan.warn]}):null,'open'===e.state?(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(f.Button,{small:!0,testID:"chef-confirm",label:e.plan.confirm,onPress:()=>te(e)}),(0,k.jsx)(f.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ne(e)})]}):(0,k.jsx)(f.Badge,{kind:'done'===e.state?'ok':'neutral',label:'done'===e.state?'Confirmed':'Cancelled: nothing done'}),'open'===e.state?(0,k.jsxs)(f.Muted,{children:["Nothing happens until you tap ",e.plan.confirm,"."]}):null]},e.id):(0,k.jsx)(h.default,{testID:"chef-assistant-reply",style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:v.colours.surface2,borderRadius:14,padding:10},children:(0,k.jsx)(f.T,{children:e.text})},e.id))]}),(0,k.jsxs)(f.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{testID:"chef-assistant-input",accessibilityLabel:"Ask the Assistant",placeholder:"Type a kitchen task\u2026",placeholderTextColor:"#7D776C",value:H,onChangeText:e=>{N(e),e||Y(!1)},onSubmitEditing:ie,returnKeyType:"send",style:[f.styles.input,{flex:1,minWidth:0,width:40}]}),(0,k.jsx)(c.default,{testID:"chef-assistant-mic",accessibilityRole:"button",accessibilityLabel:_?'Stop listening':'Speak',onPress:()=>{const e=D();if(e)if(_)Q.current?.stop?.();else try{const t=new e;Q.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&(N(t),Y(!0))},t.onend=()=>V(!1),t.onerror=()=>{V(!1),U('Sorry, I didn\u2019t catch that. You can type instead.')},V(!0),t.start()}catch{V(!1),U('Voice input isn\u2019t available here. Please type instead.')}else U('Voice input isn\u2019t available in this browser. Please type instead.')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:v.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:_?v.colours.gold:'transparent'},children:(0,k.jsx)(f.T,{size:20,children:"\ud83c\udfa4"})}),(0,k.jsx)(f.Button,{label:"Send",disabled:!H.trim(),onPress:ie})]}),(0,k.jsx)(f.Muted,{center:!0,children:"Every action waits for your Confirm \xb7 nothing is sent, paid or deleted"})]})})})};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),d=e(_r(_d[7]));_r(_d[8]);var c=e(_r(_d[9])),u=e(_r(_d[10])),h=e(_r(_d[11])),p=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),v=_r(_d[19]),w=_r(_d[20]),$=_r(_d[21]),C=_r(_d[22]),T=_r(_d[23]),k=_r(_d[24]);const S=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),I=()=>Math.random().toString(36).slice(2,9),R=['Draft a recipe card for crab linguine','Build the fish order','What allergens are in the fish and chips?','What price gives 70% GP on the lobster?','Walk-in fridge 3.5 degrees'],P='The secure AI server: not set up yet',O=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim(),A=new Set(['the','and','with','for','our','house','served','side','of','in','on','from']);function W(e,t,n){const r=` ${O(e)} `;let s,a=0;for(const e of t){const t=O(n(e).replace(/\(example\)/i,'')).split(' ').filter(e=>e.length>2&&!A.has(e)),o=t.filter(e=>r.includes(` ${e} `)||r.includes(` ${e}s `)).length,l=t.length?o/t.length+.01*o:0;o&&l>a&&(s=e,a=l)}return s}function D(){return'undefined'==typeof window?null:(0,o.speechRecognizer)()}},1187,[796,1164,804,982,34,929,1152,395,236,402,295,102,815,794,830,1020,836,856,1019,840,1124,1118,1140,930,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1188,[34,402,346,102,426,840,1153,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},1189,[30,34,792,846,25]); +__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 B}});var e,t=_r(_d[0]),o=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),l=_r(_d[4]),i=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=(e=r)&&e.__esModule?e:{default:e},u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),v=_r(_d[18]),S=_r(_d[19]),w=_r(_d[20]),T=_r(_d[21]),D=_r(_d[22]),C=_r(_d[23]),$=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);function B(){const{rid:e,date:r}=(0,n.useLocalSearchParams)(),B=(0,j.useRestaurant)(e),A=(0,j.useCustomer)(),O=(0,j.useBookings)(e),N=(0,j.useEvents)(e),z=(0,j.useNow)(6e4),[R]=(0,l.useState)(()=>(0,a.startForm)()),[F,q]=(0,l.useState)(''),[I,E]=(0,l.useState)(2),[H,W]=(0,l.useState)(r??(0,x.ymd)(z)),[L,_]=(0,l.useState)(null),[Y,U]=(0,l.useState)(A.name),[G,Q]=(0,l.useState)(A.phone??''),[V,J]=(0,l.useState)(A.email??''),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(''),[te,oe]=(0,l.useState)(!1),[se,ne]=(0,l.useState)([]),[le,ie]=(0,l.useState)(!1),ae=[...A.allergies,...se.filter(e=>!A.allergies.some(t=>t.allergen===e)).map(e=>({allergen:e,severity:'allergy'}))],[re,de]=(0,l.useState)(null),ue=(0,T.useBlocks)(e=>e.blocks);(0,k.usePublicDayStore)(e=>e.n);const ce=e?(0,k.publicDay)(e,H):null,he=ce?[...ce.bookings,...O.filter(e=>e.date!==H)]:O,me=ce?[...ue.filter(t=>t.rid!==e||t.date!==H),...ce.blocks]:ue,ge=(0,D.usePlan)(e),[pe,be]=(0,l.useState)((0,$.emptyNeeds)()),fe=!0===pe.dog,ye=fe?pe.dogs:0,xe=(0,l.useMemo)(()=>{const e=[],t=new Date(z);t.setHours(12,0,0,0);for(let o=0;o<21;o++){const s=new Date(t);s.setDate(t.getDate()+o),e.push(s)}return r&&!e.some(e=>(0,x.ymd)(e)===r)&&e.push((0,x.parseYmd)(r)),e},[z.toDateString(),r]);if(!B)return(0,M.jsx)(h.Screen,{title:"Not found",children:(0,M.jsx)(h.T,{children:"Restaurant not found."})});const je=B.settings,ke=(0,x.parseYmd)(H),ve=(0,T.blocksOn)(me,B.id,H),Se=he.filter(e=>e.date===H),we=ge.areas.filter(e=>e.dogs),Te=(0,P.dogSetUp)(ge),De=e=>(0,C.freeTablesAt)(ge,Se,I,new Date(`${H}${(0,t.tableNumbers)(e)}:00`),(0,C.turnFor)(I,je.turnMins),je.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(me,B.id,H,e)}),Ce=(0,y.bookingSlots)(B,ke,e=>he.filter(t=>t.date===H&&t.time===e&&!['cancelled','noshow'].includes(t.status)).reduce((e,t)=>e+t.partySize,0),I,z).map(e=>{const t=(0,T.blockAt)(me,B.id,H,e.time),o=fe&&Te&&e.available&&!t&&(!De(e.time).length||!(0,$.dogTimeOk)(B,he,H,e.time,ye));return{...e,blocked:!!t,noDog:o,available:e.available&&!t&&!o}}),$e=Ce.some(e=>e.available),Pe=(0,u.depositOf)(je),Me=(0,u.depositDue)(Pe,I),Be=Me>0?'deposit':'none',Ae=(0,u.depositWords)(Pe,I,B.name),Oe=N.filter(e=>e.date===H),Ne=(0,w.ukPhone)(G),ze=(0,w.emailOk)(V),Re=(0,$.needsMissing)(pe,A.allergies),Fe=!!L&&te&&!Re.length&&Y.trim().length>1&&Ne.ok&&ze,qe=async()=>{const e=(0,$.needsPatch)(pe,A.allergies),t=fe&&Te?De(L).map(e=>e.table):[],o=fe?pe.tableReq.find(e=>t.includes(e))??t[0]:void 0,s=await j.repo.bookings.create({restaurantId:B.id,customerId:A.id,name:Y,partySize:I,date:H,time:L,notes:Z.trim(),security:Be,depositPaid:0,...Me?{depositDue:Me,depositPolicy:Ae.join(' '),depositRefundable:Pe.refundable,depositCutoffHours:Pe.cutoffHours}:{},phone:Ne.pretty,email:V.trim()||void 0,source:'online',...e,...Ce.find(e=>e.time===L)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??ae,...o?{table:o}:{}});(0,a.rememberGuard)(s.id,(0,a.guardFor)({...R,hp:F})),de(s)},Ie=(0,j.useStore)(e=>re?e.bookings.find(e=>e.id===re.id)?.ref:void 0),Ee=e=>(0,S.waMeLink)(B.settings.whatsapp,(0,S.guestWhatsAppText)({name:e.name,ref:Ie??e.ref,date:e.date,time:e.time,partySize:e.partySize},B.name));if(re){const e='pending'===re.status;return(0,M.jsxs)(h.Screen,{title:e?'Booking request received':'Booking confirmed',subtitle:B.name,children:[(0,M.jsx)(h.Banner,{kind:e?'info':'success',title:`Reference ${Ie??re.ref}`,children:`${re.partySize} people \xb7 ${(0,x.niceDateYear)((0,x.parseYmd)(re.date))} at ${re.time}`}),e?(0,M.jsx)(h.Banner,{kind:"warn",title:"The team will confirm shortly",children:"For larger parties and special requests, a member of the team checks your booking first. Contact the venue if you need an update."}):null,(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.T,{children:["Name: ",re.name]}),(0,M.jsxs)(h.T,{children:["Mobile: ",re.phone]}),re.email?(0,M.jsxs)(h.T,{children:["Email: ",re.email]}):null,(0,M.jsxs)(h.T,{children:["Allergies shared with the restaurant: ",re.allergies.length?re.allergies.map(e=>`${(0,p.allergenLabel)(e.allergen)} (${(0,p.severityLabel)(e.severity)})`).join(', '):'none']}),re.notes?(0,M.jsxs)(h.T,{children:["Notes: ",re.notes]}):null,re.dog?(0,M.jsxs)(h.T,{children:["\ud83d\udc15 Dog coming too",re.table?` \xb7 dog-friendly table ${re.table}`:'']}):null,re.holds?.length?(0,M.jsxs)(h.T,{children:["Reserved: ",re.holds.map(e=>`${e.qty} \xd7 ${'item'===e.kind?(B.settings.reservables??P.ANCHORAGE_RESERVABLES).find(t=>t.id===e.id)?.name??'item':e.id}`).join(', ')," (the kitchen confirms it)"]}):null,re.tableReq?.length?(0,M.jsxs)(h.T,{children:["Table requested: ",re.tableReq.map(e=>`${(0,t.tableNumbers)(e)}`).join(' or ')," (not guaranteed, but we\u2019ll do our best)"]}):null,'deposit'===re.security&&re.depositDue?(0,M.jsxs)(h.T,{weight:"semibold",children:["Deposit due: ",(0,f.gbp)(re.depositDue),". ",B.name," will tell you how to pay it."]}):null,'deposit'===re.security&&re.depositPolicy?(0,M.jsx)(h.Muted,{children:re.depositPolicy}):null,(0,M.jsx)(h.Muted,{children:"Your booking details are shown above. If you need confirmation, contact the venue and quote your reference."}),(0,M.jsxs)(h.Muted,{children:["Need to change or cancel? Call ",B.phone," and quote ",Ie??re.ref,"."]})]}),Ee(re)?(0,M.jsxs)(d.default,{style:{gap:4},children:[(0,M.jsx)(h.Button,{kind:"secondary",label:"\ud83d\udcac Message us on WhatsApp",testID:"guest-whatsapp",onPress:()=>{const e=Ee(re);e&&(0,S.openWhatsApp)(e)}}),(0,M.jsx)(h.Muted,{size:13,children:"Opens WhatsApp with your booking details typed in. You can change the message before you send it."})]}):null,(0,M.jsx)(h.Button,{label:"Back to restaurant",onPress:()=>n.router.replace(`/customer/${B.id}`)})]})}return(0,M.jsxs)(h.Screen,{title:"Book a table",subtitle:B.name,footer:(0,M.jsx)(h.Button,{label:Re.length?Re[0]:I>(je.autoAcceptUpTo??7)?'Send booking request':'Confirm booking',disabled:!Fe,onPress:()=>qe(),testID:"confirm-booking"}),children:[(0,M.jsx)($.FirstQuestions,{rid:B.id,value:pe,onChange:e=>{e.dog===pe.dog&&e.dogs===pe.dogs||_(null),be(e)},party:I,audience:"guest",profile:A.allergies}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(d.default,{style:{gap:6,alignItems:'center'},children:[(0,M.jsx)(h.H2,{children:"Party size"}),(0,M.jsx)(o.PartySizeInput,{value:I,onChange:e=>{E(e),_(null)},label:"Party size",testID:"party-size"})]}),Me?(0,M.jsx)(h.Banner,{kind:"info",title:`Deposit: ${(0,f.gbp)(Me)} for ${I} guests`,children:(0,M.jsx)(d.default,{style:{gap:4},children:Ae.map(e=>(0,M.jsx)(h.T,{size:13,children:e},e))})}):Pe.on&&Pe.perPersonPence>0?(0,M.jsxs)(h.Muted,{children:["No deposit for fewer than ",Pe.fromParty," guests."]}):null,I>(je.autoAcceptUpTo??7)?(0,M.jsxs)(h.Muted,{children:["For ",I," people the team checks the booking first, then texts you to confirm."]}):null,fe&&Te?(0,M.jsxs)(h.Muted,{children:["Dogs are welcome in the ",we.map(e=>`${e.name}${e.outdoor?' (outdoors, weather permitting)':''}`).join(' and ')||'dog-friendly tables',". We\u2019ll only show times with a dog-friendly table",B.settings.maxDogsPerSlot?' and room for your dog':'',"."]}):null]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Date"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:xe.map(e=>{const t=!!(0,b.hoursFor)(B,e),o=N.some(t=>t.date===(0,x.ymd)(e));return(0,M.jsx)(h.Chip,{label:(0,x.niceDate)(e),sub:t?o?'\u2605 event':void 0:'Closed',disabled:!t,selected:H===(0,x.ymd)(e),onPress:()=>{W((0,x.ymd)(e)),_(null)}},(0,x.ymd)(e))})}),Oe.map(e=>(0,M.jsx)(h.Banner,{kind:"demo",title:e.title,children:e.description},e.id))]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Time"}),0===Ce.length?(0,M.jsx)(h.Muted,{children:"Closed on this day (per listed kitchen hours)."}):(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:Ce.map(e=>(0,M.jsx)(h.Chip,{label:e.time,sub:e.available?e.drinksOnly?'Drinks only':void 0:e.blocked?'Unavailable':e.noDog?'No dog table':e.left_(e.time)},e.time))}),ve.length>0&&Ce.some(e=>e.blocked)?(0,M.jsx)(h.Banner,{kind:"info",title:$e?'Some times aren\u2019t available online':'Online booking isn\u2019t available for this time',children:`We\u2019re not taking online bookings ${ve.map(e=>`${e.from}\u2013${e.to}`).join(', ')} on ${(0,x.niceDate)(ke)}. Please give us a ring on ${B.phone??"the restaurant"} and we\u2019ll do our best to fit you in.`}):null,(()=>{const e=(0,s.lastFoodOn)(B,H);return e&&Ce.some(e=>e.drinksOnly)?(0,M.jsx)(h.Banner,{kind:"info",title:`Last food orders ${(0,s.fmt12)(e.time)}${'kitchen closes'!==e.reason?` (${e.reason})`:''}`,children:"Times marked \u201cDrinks only\u201d are after the kitchen\u2019s last food orders that day: you\u2019re welcome for drinks, but we can\u2019t serve food."}):null})(),fe&&Ce.some(e=>e.noDog)?(0,M.jsx)(h.Banner,{kind:"info",title:"Some times are full for dogs",children:`Times marked "No dog table" are full in the ${we.map(e=>e.name).join(' and ')}${B.settings.maxDogsPerSlot?' or already have the most dogs we can look after':''}${(0,T.closedAreasAt)(me,B.id,H,L??'12:00').size?', or the garden is closed for weather':''}. We\u2019d love to see you both, so please try one of the other times shown.`}):null,(0,M.jsxs)(h.Muted,{children:["Times come from Covers per slot (",je.bookingCoversPerSlot," per half hour) and table rules."]})]}),(0,M.jsx)($.MoreQuestions,{rid:B.id,r:B,value:pe,onChange:be,party:I,date:H,time:L,today:(0,x.ymd)(z),bookings:he,audience:"guest",showTables:!0}),(0,M.jsxs)(h.Card,{highlight:te?void 0:v.colours.amber,children:[(0,M.jsx)(h.Field,{label:"Notes (optional)",value:Z,onChangeText:ee,placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"book-notes"}),(0,M.jsx)(h.Toggle,{label:"I confirm the allergy information for this booking",value:te,onChange:oe}),(0,M.jsx)(h.Muted,{children:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best. Nothing here is charged now; reserved dishes are paid on the night."})]}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.H2,{children:"Your details"}),(0,M.jsx)(h.Field,{label:"Name for the booking",value:Y,onChangeText:U}),(0,M.jsx)(h.Field,{testID:"book-phone",label:"Mobile number (needed to book)",value:G,onChangeText:Q,onBlur:()=>X(!0),keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),Ne.ok||!K&&!G?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:Ne.error}),(0,M.jsx)(h.Field,{testID:"book-email",label:"Email (optional)",value:V,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",placeholder:"you@example.com"}),ze?null:(0,M.jsx)(h.T,{size:13,colour:v.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,M.jsxs)(h.Muted,{children:["We\u2019ll text you a confirmation",V.trim()?' and email it too':'',", with how to change or cancel. We only use your number for this booking."]})]}),(0,M.jsx)(i.Honeypot,{value:F,onChange:q})]})}},1190,[829,1097,851,30,34,1191,995,102,14,1111,794,830,852,836,1104,827,848,985,840,1150,833,1011,1014,1079,1106,1075,25]); +__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])},1191,[796,34,236,102,25]); +__d(function(_g,_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"})]})]})}},1192,[30,34,336,102,1193,1195,794,830,836,848,856,840,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:n,declared:u}){return(0,d.jsxs)(s.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,d.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,d.jsx)(o.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,l.isLiveVenue)()?null:(0,d.jsx)(o.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,d.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>{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'})}},1193,[34,1194,102,830,840,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1194,[2,985]); +__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])},1195,[30,34,402,848,840,794,25]); +__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]),a=_r(d[1]),s=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]);const u=['Food','Service','Takeaway','Booking','Allergens','Something else'];function c(){const{rid:c,token:h,optout:p}=(0,t.useLocalSearchParams)(),b=(0,r.useRestaurant)(c),v=(0,r.useCustomer)(),[j,x]=(0,a.useState)(0),[y,w]=(0,a.useState)('Food'),[f,S]=(0,a.useState)(''),[k,C]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1);return b?'string'==typeof p&&p?(0,l.jsx)(s.Screen,{title:"Review emails",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewOptOut,{token:p})})}):'string'==typeof h&&h?(0,l.jsx)(s.Screen,{title:"Your review",subtitle:b.name,children:(0,l.jsx)(s.Card,{children:(0,l.jsx)(o.ReviewForm,{rid:b.id,venueName:b.name,token:h})})}):(0,l.jsxs)(s.Screen,{title:"Private feedback",subtitle:`Straight to the team at ${b.name}`,children:[P?(0,l.jsxs)(s.Banner,{kind:"success",title:"Thank you",children:["Your feedback went privately to ",b.name,". It is never published.",k?' They may reply by email (demo: nothing is sent).':'']}):null,P?(0,l.jsx)(s.Button,{kind:"secondary",label:"Send more feedback",onPress:()=>{R(!1),x(0),S('')}}):(0,l.jsxs)(s.Card,{children:[(0,l.jsx)(s.H2,{children:"How did we do?"}),(0,l.jsx)(n.Stars,{value:j,onChange:x}),(0,l.jsx)(s.T,{size:14,children:"What's it about?"}),(0,l.jsx)(s.Row,{wrap:!0,gap:6,children:u.map(t=>(0,l.jsx)(s.Chip,{label:t,selected:y===t,onPress:()=>w(t)},t))}),(0,l.jsx)(s.Field,{label:"Tell us more (optional)",value:f,onChangeText:S,multiline:!0,placeholder:"What went well, what could be better?"}),(0,l.jsx)(s.Chip,{label:k?'\u2713 Happy to be contacted':'Happy to be contacted?',selected:k,onPress:()=>C(!k)}),(0,l.jsx)(s.Button,{label:"Send privately",disabled:!j,onPress:()=>{r.repo.feedback.add({restaurantId:b.id,customerId:v.id,customerName:v.name,stars:j,comment:`${y}: ${f.trim()}${k?` (happy to be contacted: ${v.email})`:''}`,context:`App feedback \xb7 ${y}`}),R(!0)}})]}),(0,l.jsx)(s.Muted,{children:"Every rating, from 1 to 5 stars, goes the same way: privately to the restaurant. We never ask only happy guests to post a public review, and stamps or rewards are never given for reviews. A public review uses the link from your visit."}),(0,l.jsx)(o.ReviewsSection,{rid:b.id,mode:"read",venueName:b.name})]}):(0,l.jsx)(s.Screen,{title:"Not found",children:(0,l.jsx)(s.T,{children:"Restaurant not found."})})}},1196,[30,34,794,1197,848,1182,25]); +__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])},1197,[34,402,840,794,25]); +__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 x}});var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);function x(){const{rid:n}=(0,a.useLocalSearchParams)(),s=(0,o.useRestaurant)(n);(0,o.useCustomer)();return t.LIVE_VENUE_BUILD||(0,h.guestServer)()?s?(0,b.jsx)(c.GiftLive,{slug:n,venue:s.name}):(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})}):(0,b.jsx)(f,{})}function f(){const{rid:t}=(0,a.useLocalSearchParams)(),c=(0,o.useRestaurant)(t),h=(0,o.useGiftCards)(t),[x,f]=(0,n.useState)(5e3),[j,p]=(0,n.useState)(''),[g,y]=(0,n.useState)(''),[C,S]=(0,n.useState)(''),[v,w]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null);if(!c)return(0,b.jsx)(r.Screen,{title:"Not found",children:(0,b.jsx)(r.T,{children:"Restaurant not found."})});const B=j?Math.round(100*Number(j))||0:x;return(0,b.jsxs)(r.Screen,{title:"Gift cards",subtitle:`${c.name} \u2014 redeemable only at ${c.name}`,children:[P?(0,b.jsx)(r.Banner,{kind:"success",title:`Gift card created \u2014 ${(0,l.gbp)(P.initial)}`,children:`Code ${P.code}. In production it would be emailed or sent in-app to ${P.recipientName||'the recipient'} (nothing sent in this demo).`}):null,(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Your gift cards"}),h.length?h.map(t=>(0,b.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(r.T,{style:{flex:1},children:t.code}),(0,b.jsxs)(r.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balance)," of ",(0,l.gbp)(t.initial)]})]},t.id)):(0,b.jsx)(r.Muted,{children:"None yet."}),(0,b.jsx)(r.Muted,{children:"Balances can be used at checkout on takeaway orders and table bills. Part-use leaves a balance."})]}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Buy a gift card"}),(0,b.jsx)(r.Row,{wrap:!0,children:[1e3,2500,5e3,15e3].map(t=>(0,b.jsx)(r.Chip,{label:(0,l.gbp)(t),selected:!j&&x===t,onPress:()=>{p(''),f(t)}},t))}),(0,b.jsx)(r.Field,{label:"Or another amount (\xa3)",keyboardType:"decimal-pad",value:j,onChangeText:p,placeholder:"e.g. 40"}),(0,b.jsx)(r.Field,{label:"Recipient\u2019s name",value:g,onChangeText:y}),(0,b.jsx)(r.Field,{label:"Message",value:C,onChangeText:S,multiline:!0,placeholder:"Happy birthday!"}),(0,b.jsx)(r.Muted,{children:"Valid for 24 months from purchase (suggested terms \u2014 to be confirmed by the restaurant)."}),(0,b.jsx)(r.Button,{label:`Buy ${(0,l.gbp)(B)} gift card`,disabled:B<500||B>5e4,onPress:()=>w(!0)})]}),(0,b.jsx)(s.MockPay,{visible:v,onClose:()=>w(!1),amount:B,restaurantId:c.id,allowGiftCard:!1,title:"Buy gift card",onPaid:async()=>{const t=await o.repo.giftCards.purchase(c.id,B,g,C);w(!1),T(t)}})]})}},1198,[806,30,34,1199,794,836,848,840,1200,1204,25]); +__d(function(_g,r,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])},1199,[34,385,102,848,836,840,794,25]); +__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}},1200,[34,102,794,836,1201,1202,1203,840,25]); +__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})},1201,[]); +__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})},1202,[]); +__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()})},1203,[931,985,1202]); +__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}},1204,[815,931,974,985,2,1201]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return H}});var t=e(_r(_d[0])),l=_r(_d[1]),s=_r(_d[2]),n=_r(_d[3]),r=e(_r(_d[4])),o=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),b=e(c);_r(_d[10]);var h=e(_r(_d[11])),f=e(_r(_d[12])),p=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),I=_r(_d[22]),O=_r(_d[23]),R=_r(_d[24]),A=_r(_d[25]),B=_r(_d[26]),P=_r(_d[27]),C=_r(_d[28]),_=_r(_d[29]),v=_r(_d[30]),N=_r(_d[31]);const $=['book','takeaway'].includes(C.START_GO??'')?C.START_GO:null;let E=!1,M=!1,L=!1;const D=[{id:'main',label:'Main menu'},{id:'specials',label:'Specials'},{id:'takeaway',label:'Takeaway'}];function H(){const{rid:e}=(0,u.useLocalSearchParams)(),d=(0,w.useRestaurant)(e),c=s.IS_QUEUED_VENUE?(0,N.jsx)(t.default,{}):s.IS_ABBOTSFORD?(0,N.jsx)(o.default,{}):s.IS_KIRKTON?(0,N.jsx)(i.default,{}):s.IS_GREENSIDE?(0,N.jsx)(r.default,{}):l.IsolatedCustomerHome&&(s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS)?(0,N.jsx)(l.IsolatedCustomerHome,{}):(0,N.jsx)(K,{});return s.IS_ABBOTSFORD||s.IS_KIRKTON||s.IS_WILDINGS||!d?.settings.hotel?.enabled?c:(0,N.jsx)(n.HotelRequestGate,{rid:e,hotel:d.settings.hotel,children:c})}function K(){const{rid:e}=(0,u.useLocalSearchParams)(),t=(0,w.useRestaurant)(e),l=(0,w.useMenu)(e),s=(0,w.useCustomer)(),n=(0,w.useBasket)(),r=(0,w.useStore)(e=>e.startBasket),o=(0,w.useNow)(3e4),[i,H]=(0,c.useState)('All'),[K,W]=(0,c.useState)(null),[G,F]=(0,c.useState)(!1),[U,Q]=(0,c.useState)(!1),[V,Y]=(0,c.useState)('takeaway'===$?'takeaway':'main');b.default.useEffect(()=>{$&&!E&&(E=!0,'book'===$?setTimeout(()=>u.router.push(`/customer/${e}/book`),0):setTimeout(()=>{try{document.querySelector('[data-testid="menu-tabs"]')?.scrollIntoView({block:'start'})}catch{}},400))},[e]);const q=(0,B.useSpecials)(t=>t.current[e]??null),z=!!q&&(0,P.isToday)(q.postedAt,o),J=(0,R.useOwner)(e=>e.offers.filter(e=>e.live).length),X=(0,w.useStore)(t=>t.stampCards.find(l=>l.restaurantId===e&&l.customerId===t.customer.id)),Z=(0,_.useLiveTile)(e),ee=(0,v.guestServer)();b.default.useEffect(()=>{C.START_TABLE_TOKEN&&!L&&(L=!0,setTimeout(()=>u.router.push(`/table/live/${C.START_TABLE_TOKEN}`),0))},[e]),b.default.useEffect(()=>{C.START_LOYALTY_CODE&&!M&&(M=!0,setTimeout(()=>u.router.push(`/customer/${e}/loyalty`),0))},[e]);const te=(0,w.useOrderAtTable)(e);if(b.default.useEffect(()=>{te||n.restaurantId!==e||'table'!==n.mode||w.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[te,n.mode,n.restaurantId,e]),!t)return(0,N.jsx)(x.Screen,{title:"Not found",children:(0,N.jsx)(x.T,{children:"Restaurant not found."})});const le=te&&n.restaurantId===t.id&&'table'===n.mode,se=t.sections.length?t.sections:Array.from(new Set(l.map(e=>e.section))),ae=e=>!(e.soldOut||!e.signOff||null===e.price),ne=l.filter(e=>('All'===i||e.section===i)&&('takeaway'!==V||ae(e))),re=(0,k.hoursFor)(t,o),oe=e=>()=>u.router.push(`/customer/${t.id}${e}`),ie=[{icon:'box',label:'Takeaway',sub:'Order to collect',on:()=>{H('All'),Y('takeaway'),le&&r(t.id,'takeaway')}},...te?[{icon:'phone',label:'Order at table',sub:'Scan the QR',on:()=>Q(!0)}]:[],{icon:'calendarPlus',label:'Book a table',on:oe('/book')},{icon:'clock',label:'Waitlist',sub:'Walk in',on:oe('/waitlist')},{icon:'star',label:'Stamp card',sub:ee?Z.stamps:`${X?.stamps??0} of ${t.settings.stampTarget}`,on:oe('/loyalty')},{icon:'userPlus',label:'Bring a friend',on:oe('/refer')},{icon:'gift',label:'Gift cards',on:oe('/gift')},{icon:'alert',label:'My allergens',sub:s.allergies.length?`${s.allergies.length} declared`:'None declared',on:()=>u.router.push('/customer/profile')},{icon:'tag',label:'Offers',sub:ee?void 0:s.marketingOptIn[t.id]?'Opted in':'Opt in',on:oe('/offers'),badge:(ee?Z.offers:J)?String(ee?Z.offers:J):void 0},{icon:'sparkle',label:"What's on",on:oe('/whatson')},{icon:'chat',label:'Feedback',sub:'Private',on:oe('/feedback')},{icon:'star',label:'Reviews',sub:'Published',on:oe('/feedback')},{icon:'hanger',label:'Lost property',on:oe('/lost')},{icon:'bag',label:'Shop',sub:'Merch',on:oe('/merch')}];return(0,N.jsxs)(x.Screen,{title:t.name,subtitle:`${t.location}${t.phone?` \xb7 ${t.phone}`:''}`,back:'customer'!==O.APP_VARIANT,right:(0,N.jsxs)(x.Row,{children:[(0,N.jsx)(m.BasketButton,{}),(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:"Account",onPress:()=>u.router.push('/customer/profile')})]}),children:[t.fictional?(0,N.jsx)(x.Banner,{kind:"warn",title:"Fictional demo restaurant",children:"Shown only to demonstrate multi-restaurant support."}):null,le?(0,N.jsx)(x.Banner,{kind:"success",title:`Ordering at ${(0,d.tableNumbers)(n.tableNo)}`,children:"Your order goes straight to the kitchen. Pay and split the bill from your order page. A member of staff is always available \u2014 tap \u201cCall staff\u201d any time."}):(0,N.jsx)(x.Card,{children:(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(f.default,{style:{flex:1},children:[(0,N.jsx)(x.T,{weight:"semibold",children:"Takeaway \u2014 collection"}),(0,N.jsxs)(x.Muted,{children:[re?`Kitchen today ${(0,k.kitchenHoursOn)(t,o)[0]}\u2013${(0,k.kitchenHoursOn)(t,o)[1]}`:'Kitchen closed today',t.settings.takeawayPaused?' \xb7 slots paused by the restaurant':'']})]}),(0,N.jsx)(x.Badge,{kind:t.settings.takeawayPaused||!re?'amber':'ok',label:t.settings.takeawayPaused?'Paused':re?'Taking orders':'Closed'})]})}),t.fictional?(0,N.jsx)(x.Row,{wrap:!0,gap:8,children:ie.slice(2,7).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:e.label,onPress:e.on},e.label))}):(0,N.jsx)(f.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:ie.map(e=>(0,N.jsx)(T.HubTile,{icon:e.icon,label:e.label,sub:e.sub,badge:e.badge,onPress:e.on},e.label))}),le?(0,N.jsx)(x.Button,{small:!0,kind:"danger",label:"Call staff",onPress:()=>F(!0)}):null,G?(0,N.jsx)(x.Banner,{kind:"success",children:"We've told the staff on this device. Calling staff: not set up yet."}):null,t.hoursNote?(0,N.jsx)(x.Muted,{children:t.hoursNote}):null,t.fictional?null:(0,N.jsx)(x.ExampleAllergenNotice,{}),(0,N.jsxs)(x.Muted,{children:["Menu dishes and prices from ",t.name,"\u2019s menu. Items marked \u26a0 conflict with your declared allergies."]}),(0,N.jsx)(f.default,{accessibilityRole:"tablist",testID:"menu-tabs",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6,backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:4},children:D.map(e=>{const t=V===e.id;return(0,N.jsxs)(h.default,{testID:`menu-tab-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},"aria-selected":t,accessibilityLabel:'specials'===e.id&&z?'Specials, updated today':e.label,onPress:()=>Y(e.id),style:{flex:1,minWidth:120,flexBasis:120,minHeight:44,borderRadius:10,alignItems:'center',justifyContent:'center',paddingHorizontal:4,backgroundColor:t?S.colours.gold:'transparent'},children:[(0,N.jsx)(x.T,{size:14,weight:"semibold",colour:t?S.colours.onGold:S.colours.text,center:!0,children:e.label}),'specials'===e.id&&z&&!t?(0,N.jsx)(f.default,{style:{position:'absolute',top:6,right:8,width:7,height:7,borderRadius:4,backgroundColor:S.colours.gold}}):null]},e.id)})}),'specials'===V?(0,N.jsx)(A.SpecialsTab,{rid:t.id,declared:s.allergies,now:o}):null,'takeaway'===V?(0,N.jsx)(x.Muted,{children:"Order to collect. Only dishes available to order online are shown; pick a collection slot at checkout."}):null,'specials'!==V?(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,N.jsx)(x.Chip,{label:"All",selected:'All'===i,onPress:()=>H('All')}),se.map(e=>(0,N.jsx)(x.Chip,{label:e,selected:i===e,onPress:()=>H(e)},e))]}):null,'specials'!==V?se.filter(e=>('All'===i||e===i)&&ne.some(t=>t.section===e)).map(e=>(0,N.jsxs)(f.default,{style:{gap:10},children:[(0,N.jsx)(x.H2,{style:{color:S.colours.gold,marginTop:6},children:e}),ne.filter(t=>t.section===e).map(e=>{const l=(0,y.conflictsFor)(e.allergens,s.allergies),o=e.soldOut||!e.signOff||null===e.price;return(0,N.jsxs)(x.Card,{highlight:l.contains.length?S.colours.red:l.may.length?S.colours.amber:void 0,children:[(0,N.jsxs)(h.default,{accessibilityRole:"button",onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)},children:[(0,N.jsxs)(x.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,N.jsx)(x.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%',paddingRight:8},children:e.name}),(0,N.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:null===e.price?e.priceNote??'\u2014':(0,j.gbp)(e.price)})]}),(0,N.jsx)(x.Muted,{numberOfLines:2,children:e.description})]}),(0,N.jsxs)(x.Row,{wrap:!0,gap:6,children:[e.dietary.map(e=>(0,N.jsx)(x.Badge,{kind:"ok",label:e},e)),e.special?(0,N.jsx)(x.Badge,{kind:"gold",label:"Special"}):null,e.soldOut?(0,N.jsx)(x.Badge,{kind:"neutral",label:"Sold out"}):null,e.signOff?null:(0,N.jsx)(x.Badge,{kind:"amber",label:"Awaiting allergen sign-off"}),l.contains.length?(0,N.jsx)(x.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,N.jsx)(x.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null]}),(0,N.jsx)(p.AllergenChips,{map:e.allergens,declared:s.allergies}),K===e.id?(0,N.jsx)(p.AllergenPanel,{item:e,map:e.allergens,declared:s.allergies}):null,(0,N.jsxs)(x.Row,{gap:8,children:[(0,N.jsx)(x.Button,{small:!0,kind:"ghost",label:K===e.id?'Hide allergen panel':'Allergen panel',onPress:()=>W(K===e.id?null:e.id)}),(0,N.jsx)(f.default,{style:{flex:1}}),(0,N.jsx)(x.Button,{small:!0,label:o?e.soldOut?'Sold out':'Not available online':'Choose',disabled:o,onPress:()=>{n.restaurantId&&n.restaurantId===t.id||r(t.id,'takeaway'),u.router.push(`/customer/${t.id}/dish/${e.id}`)}})]})]},e.id)})]},e)):null,(0,N.jsx)(I.ReviewsSection,{rid:t.id,mode:"read",venueName:t.name}),(0,N.jsx)(x.Muted,{children:"Drinks list coming soon. Ask your server for today\u2019s drinks."}),(0,N.jsx)(x.Muted,{children:"Card payments: not set up yet. Pay at the till as usual."}),(0,N.jsx)(T.LauncherLine,{}),te?(0,N.jsxs)(x.Sheet,{visible:U,onClose:()=>Q(!1),title:"Order at your table",children:[(0,N.jsx)(x.Muted,{children:"Scan the QR code on your table with your phone camera, or pick your table number."}),(0,N.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:12},(e,t)=>String(t+1)).map(e=>(0,N.jsx)(x.Button,{small:!0,kind:"secondary",label:`${(0,d.tableNumbers)(e)}`,onPress:()=>{Q(!1),r(t.id,'table',e)}},e))}),(0,N.jsx)(x.Muted,{children:"Orders go straight to the kitchen. Card payments: not set up yet. Pay at the till as usual."})]}):null]})}},1205,[1206,1215,5,1216,1217,1218,1221,829,30,34,236,402,102,1193,1195,794,830,836,852,848,840,1222,1182,846,865,1223,989,990,997,1225,1204,25]); +__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,n=_r(d[0]),t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},r=_r(d[2]),o=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),j=_r(d[8]),x=_r(d[9]),b=_r(d[10]);function f(){const e=j.VENUE_RID,t=x.queuedVenues[e],f=(0,h.useRestaurant)(e)??(0,x.queuedRestaurant)(e),[p,k]=(0,n.useState)(!1),y=f.kitchenSessionsByDay;return(0,b.jsxs)(r.Screen,{title:t.name,back:!1,children:[(0,b.jsx)(o.RestaurantHero,{rid:e,size:240}),p?(0,b.jsx)(l.NativeRequestSetup,{rid:e,kind:"table",sessionHours:y,onClose:()=>k(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.Button,{testID:`${e}-book-table`,label:"Book a table",onPress:()=>k(!0)}),t.phone?(0,b.jsx)(r.Button,{kind:"secondary",label:`Call ${t.phone}`,onPress:()=>{s.default.openURL('tel:'+t.phone.replace(/[^0-9+]/g,''))}}):null,(0,b.jsx)(r.Muted,{children:"Send a table request for this venue\u2019s managers to confirm. This is not an instant booking. No deposit or payment is taken. No emails or texts are sent by this app."}),(0,b.jsxs)(r.Card,{children:[(0,b.jsx)(r.H2,{children:"Kitchen and venue hours"}),(0,b.jsx)(r.T,{children:t.hours.note})]}),t.clockArea.on?(0,b.jsx)(u.FindPub,{rid:e}):(0,b.jsxs)(r.Muted,{children:["Find us: ",t.address,". Precise map location to confirm."]}),(0,b.jsx)(c.QueuedMenus,{menu:t.menu,context:t.menuServiceContext,allergens:t.allergenCaveat}),(0,b.jsxs)(r.Banner,{kind:"warn",title:"To confirm",children:[t.gatesToConfirm.join(', '),"."]}),(0,b.jsx)(r.Muted,{children:"Ordering, takeaway, delivery and loyalty: to set up. Deposits are blank and off."})]})]})}},1206,[34,379,794,847,1207,1208,1214,848,5,6,25]); +__d(function(g,r,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])},1207,[34,379,102,794,991,992,1044,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.NativeRequestSetup=function(l){const[h,p]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let u=!0;p(null);const s=(0,t.isQueuedVenue)(l.rid),o=s?'queued_venue_request_setup_ready':'kirkton'===l.rid?'kirkton_request_setup_ready':'abbotsford_request_setup_ready';return(0,n.getSupabase)().rpc(o,s?{p_slug:(0,t.queuedDatabaseSlug)(l.rid)}:void 0).then(({data:t,error:n})=>{u&&p(!n&&!0===t)},()=>{u&&p(!1)}),()=>{u=!1}},[l.rid,l.kind]),!0===h?(0,c.jsx)(o.VenueRequestForm,{...l}):(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.H2,{children:null===h?'Checking booking setup\u2026':'Manager setup needed'}),(0,c.jsx)(s.Muted,{children:null===h?'Checking whether requests are ready.':(0,t.isQueuedVenue)(l.rid)?'An authorised manager must complete setup and confirm current kitchen hours before requests can be sent.':'kirkton'===l.rid?'An authorised manager must complete setup and confirm current kitchen hours before table requests can be sent. Contact details are to confirm.':'An authorised hotel manager must complete setup before requests can be sent.'}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Back to Customer home",onPress:l.onClose})]})};var t=r(d[0]),u=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),c=r(d[5])},1208,[6,34,931,794,1209,25]); +__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]})]})}},1209,[6,1210,1211,1212,34,102,796,794,840,11,1213,25]); +__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;t60*Number(t.slice(0,2))+Number(t.slice(3)),u=s(i[0]),l=s(i[1]);return Array.from({length:Math.floor((l-u)/15)+1},(t,n)=>{const o=u+15*n;return`${String(Math.floor(o/60)).padStart(2,'0')}:${String(o%60).padStart(2,'0')}`})}function i(t,i,s=new Date){if('table'!==t)return'Only table requests are available at this restaurant.';if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const u=(0,n.localDate)(s),l=(0,n.localDate)(new Date(+s+63072e6));if(!i.date||i.datel||!o(i.date).includes(i.time||''))return'Choose an open date and a time within kitchen hours. Closed Monday and Tuesday.';const d=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(s);return i.date===u&&(i.time||'')<=d?'Choose a future time within kitchen hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''}const s=(t,i,s)=>'greenside'===t?o(i):(0,n.requestSlots)(i,s),u=(t,o,s,u,l=new Date)=>'greenside'===t?i(o,s,l):(0,n.requestError)(o,s,u,l)},1211,[4,11]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allDaySlots=n,e.allDayRequestError=function(i,o,a=new Date){if(i.name.trim().length<2||i.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(i.phone)||!/^[0-9]{7,15}$/.test(i.phone.replace(/\D/g,''))||i.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email))return'Enter your name, phone number and email.';if(i.notes.length>2e3)return'Keep notes under 2000 characters.';const s=(0,t.localDate)(a),u=(0,t.localDate)(new Date(+a+63072e6));if(!i.date||i.dateu||!n(i.date,o).includes(i.time||''))return'Choose a future date and a time within the published hours, which are to confirm.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return i.date===s&&(i.time||'')<=l?'Choose a future time within the published hours.':!Number.isInteger(i.covers)||i.covers<1||i.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]);function n(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const i=new Date(t+'T12:00:00Z');if(!Number.isFinite(+i)||i.toISOString().slice(0,10)!==t)return[];const o=n[i.getUTCDay()];if(!Array.isArray(o)||2!==o.length||!o.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))return[];const a=t=>60*+t.slice(0,2)+ +t.slice(3),s=a(o[0]),u=a(o[1]);return!Number.isFinite(s)||!Number.isFinite(u)||s>u?[]:Array.from({length:Math.floor((u-s)/15)+1},(t,n)=>{const i=s+15*n;return`${String(Math.floor(i/60)).padStart(2,'0')}:${String(i%60).padStart(2,'0')}`})}},1212,[11]); +__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.'}},1213,[6,931]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.QueuedMenus=function({menu:c,context:o,allergens:a}){const u=c,f=(0,n.useMemo)(()=>t(c),[c]),[p,b]=(0,n.useState)(null);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.H2,{children:"Published menus"}),(0,s.jsx)(i.Banner,{kind:"warn",title:"Menu \u2014 to confirm",children:"Published reference only. Current prices, availability and allergens need confirmation. Items cannot be ordered here."}),o?(0,s.jsx)(i.Muted,{children:o}):null,a?(0,s.jsx)(i.Muted,{children:a}):(0,s.jsx)(i.Muted,{children:"Ask the restaurant about every allergy. Published dietary labels are not an allergen guarantee."}),u.offers?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:["Published offer \u2014 ",n.name,'number'==typeof n.priceGbp?` \xb7 \xa3${n.priceGbp.toFixed(2)}`:'',": ",n.when||'Terms to confirm',". To confirm."]},'offer'+t)),u.buffetSessionPrices?.sessions?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.label,": \xa3",n.price.toFixed(2)," \xb7 to confirm"]},'session'+t)),u.buffetSessionPrices?.kids?(0,s.jsxs)(i.Muted,{children:["Published children\u2019s prices \u2014 ",u.buffetSessionPrices.kids,". To confirm."]}):null,f.map((n,t)=>(0,s.jsx)(i.Button,{kind:"secondary",label:n.name+(p===t?' \xb7 selected':''),onPress:()=>b(p===t?null:t)},t)),null!==p?f[p]?.items.map((n,t)=>(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.T,{weight:"bold",children:n.name||n.label||'Published item'}),(0,s.jsx)(i.T,{children:l(n)}),n.description||n.desc?(0,s.jsx)(i.Muted,{children:n.description||n.desc}):null,n.options?.map((n,t)=>(0,s.jsxs)(i.Muted,{children:[n.name||n.label,": ",l(n)]},t))]},t)):null]})};var n=r(d[0]),i=r(d[1]),s=r(d[2]);function t(n,i=""){if(Array.isArray(n))return n.flatMap(n=>t(n,i));if(!n||'object'!=typeof n)return[];const s=n,l='string'==typeof s.name?s.name:'string'==typeof s.label?s.label:i;return(Array.isArray(s.items)?[{name:[i,l].filter((n,i,s)=>n&&s.indexOf(n)===i).join(' \xb7 ')||'Published menu',items:s.items}]:[]).concat(Object.entries(s).filter(([n])=>'items'!==n&&'options'!==n).flatMap(([,n])=>t(n,l||i)))}const l=n=>'included_in_buffet'===n.priceType?'Included in buffet \xb7 session price to confirm':n.priceLabel||('number'==typeof(n.priceGbp??n.price)?`\xa3${(n.priceGbp??n.price).toFixed(2)}`:'Price to confirm')},1214,[34,794,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedCustomerHome",{enumerable:!0,get:function(){return t}});const t=null},1215,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.HotelRequestGate=function({rid:e,hotel:l,children:c}){const[h,f]=(0,t.useState)(!1);return l?.enabled?(0,u.jsxs)(o.default,{style:{flex:1},children:[c,(0,u.jsx)(o.default,{style:{padding:12},children:(0,u.jsx)(s.Button,{label:"Book a room",onPress:()=>f(!0)})}),(0,u.jsx)(s.Sheet,{visible:h,onClose:()=>f(!1),title:"Room request",children:(0,u.jsx)(n.VenueRequestForm,{rid:e,kind:"room",hotel:l,onClose:()=>f(!1)})})]}):(0,u.jsx)(u.Fragment,{children:c})};var e,t=r(d[0]),l=r(d[1]),o=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4])},1216,[34,102,794,1209,25]); +__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 x}});var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),b=r(d[7]),j=r(d[8]);function x(){const[e,s]=(0,n.useState)(!1),[x,p]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let n=!0;return p(null),(0,o.getSupabase)().rpc('greenside_request_setup_ready').then(({data:e,error:s})=>{n&&p(!s&&!0===e)},()=>{n&&p(!1)}),()=>{n=!1}},[e]),(0,j.jsxs)(l.Screen,{title:b.GREENSIDE_RESTAURANT.name,back:!1,children:[(0,j.jsx)(u.RestaurantHero,{rid:"greenside",size:240}),e?!0===x?(0,j.jsx)(h.VenueRequestForm,{rid:"greenside",kind:"table",onClose:()=>s(!1)}):(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:null===x?'Checking booking setup\u2026':'Manager setup needed'}),(0,j.jsx)(l.Muted,{children:null===x?'Checking whether table requests are ready.':'An authorised manager must complete setup before table requests can be sent. Please call 01655 889685.'}),(0,j.jsx)(l.Button,{label:"Call 01655 889685",kind:"secondary",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}}),(0,j.jsx)(l.Button,{label:"Back to Customer home",kind:"secondary",onPress:()=>s(!1)})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.T,{center:!0,children:"Bar, restaurant and wood-fired pizza"}),(0,j.jsxs)(l.Row,{wrap:!0,children:[(0,j.jsx)(l.Button,{testID:"greenside-book-table",label:"Book a table",onPress:()=>s(!0)}),(0,j.jsx)(l.Button,{testID:"greenside-book-phone",kind:"secondary",label:"Call 01655 889685",onPress:()=>{t.default.openURL(b.GREENSIDE_BOOKING_PHONE)}})]}),(0,j.jsx)(l.Muted,{children:"Send a table request for a Greenside manager to confirm. This is not an instant booking. No deposit, payment, email or text is taken or sent by this app."}),(0,j.jsxs)(l.Card,{children:[(0,j.jsx)(l.H2,{children:"Kitchen hours"}),(0,j.jsx)(l.T,{children:"Wednesday, Thursday and Sunday: 10:00\u201320:00"}),(0,j.jsx)(l.T,{children:"Friday and Saturday: 10:00\u201321:00"}),(0,j.jsx)(l.T,{children:"Closed Monday and Tuesday"}),(0,j.jsx)(l.H2,{children:"Venue hours"}),(0,j.jsx)(l.T,{children:"Wednesday and Thursday: 10:00\u201323:00"}),(0,j.jsx)(l.T,{children:"Friday to Sunday: 10:00\u201300:00"}),(0,j.jsx)(l.T,{children:"Cash only"})]}),(0,j.jsx)(c.FindPub,{rid:"greenside"}),(0,j.jsx)(l.Banner,{kind:"warn",title:"Menus \u2014 unconfirmed",children:"The published menus, prices, availability and allergens need confirmation. Ask the restaurant about every allergy. No menu items are available to order here."}),(0,j.jsx)(l.Muted,{children:"Deposit policy needs confirmation. Deposits are off. The public email address needs confirmation."}),(0,j.jsx)(l.Button,{kind:"secondary",label:"View published menus on our website",onPress:()=>{t.default.openURL('https://thegreensiderestaurant.co.uk/menus/')}})]})]})}},1217,[34,379,931,794,847,1207,1209,4,25]); +__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 j}});var e,o=r(d[0]),t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},l=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]),b=r(d[7]),f=r(d[8]);function j(){const[e,t]=(0,o.useState)(null);return(0,f.jsxs)(l.Screen,{title:"The Abbotsford Hotel",back:!1,children:[(0,f.jsx)(c.RestaurantHero,{rid:"abbotsford",size:240}),(0,f.jsx)(l.T,{center:!0,children:"Epicurious restaurant \xb7 The Copper Bar"}),(0,f.jsx)(l.T,{children:"14 Corsehill Road, Ayr KA7 2ST"}),(0,f.jsx)(l.T,{children:"Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm."}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Book with the hotel"}),(0,f.jsx)(l.T,{children:"Table and room requests go to the hotel managers to confirm. They are not instant bookings or a guarantee of availability. No payment or deposit."}),(0,f.jsx)(l.Button,{label:"Book a table",onPress:()=>t('table')}),(0,f.jsx)(l.Button,{label:"Book a room",onPress:()=>t('room')}),(0,f.jsx)(l.Muted,{children:"Rooms: Prices to confirm with the hotel. Room details and inclusions need confirmation."})]}),(0,f.jsx)(b.AbbotsfordMenus,{}),(0,f.jsx)(s.FindPub,{rid:"abbotsford"}),(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.H2,{children:"Contact the hotel"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Call 01292 261506",onPress:()=>{n.default.openURL('tel:01292261506')}}),(0,f.jsx)(l.T,{children:"info@abbotsfordhotel.co.uk"})]}),(0,f.jsx)(l.Banner,{kind:"info",title:"Details to confirm",children:"Covers and table plan, deposit, Copper Bar hours, dog policy and allergens are still to confirm."}),(0,f.jsx)(l.Sheet,{visible:!!e,onClose:()=>t(null),title:'room'===e?'Book a room':'Book a table',children:e?(0,f.jsx)(u.NativeRequestSetup,{rid:"abbotsford",kind:e,hotel:h.ABBOTSFORD_HOTEL,allDayHours:h.ABBOTSFORD_HOURS,onClose:()=>t(null)}):null})]})}},1218,[34,379,794,1207,847,1208,8,1219,25]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordMenus=function(){const[e,t]=(0,n.useState)(null),h=o.find(n=>n.id===e);return(0,c.jsxs)(s.default,{testID:"abbotsford-menus",style:{gap:12},children:[(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.H2,{children:"Menus"}),(0,c.jsx)(l.T,{children:"Published menus for reference. Confirm availability, current prices and allergens with the team. No ordering is available here."}),(0,c.jsx)(l.T,{children:"Allergens: please speak to staff. Published dietary marks are not a complete allergen check."}),o.map(n=>(0,c.jsx)(l.Button,{kind:n.id===e?'primary':'secondary',label:`${n.name}${n.id===e?' \xb7 selected':''}`,onPress:()=>t(n.id)},n.id))]}),h?(0,c.jsxs)(s.default,{style:{gap:12},children:[(0,c.jsx)(l.H2,{children:h.name}),h.when?(0,c.jsx)(l.Muted,{children:h.when}):null,h.note?(0,c.jsx)(l.T,{children:h.note}):null,h.categories.map((e,n)=>(0,c.jsxs)(s.default,{style:{gap:10},children:[(0,c.jsx)(l.H2,{children:e.name}),e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.items.map((e,n)=>(0,c.jsx)(l.Card,{children:(0,c.jsxs)(s.default,{style:{gap:8},children:[(0,c.jsxs)(l.Row,{wrap:!0,children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(l.T,{children:'number'==typeof e.price?u(e.price):'Price to confirm'})]}),e.description?(0,c.jsx)(l.T,{children:e.description}):null,e.note?(0,c.jsx)(l.T,{children:e.note}):null,e.priceOptions?.length?(0,c.jsxs)(l.T,{children:["Published price options: ",e.priceOptions.map(u).join(' / ')]}):null,'number'==typeof e.sharedPrice?(0,c.jsxs)(l.T,{children:["Published group price: ",u(e.sharedPrice)," \u2014 confirm with staff"]}):null,e.dietary?.length?(0,c.jsxs)(l.Muted,{children:["Published marks: ",e.dietary.join(', '),". Ask staff about allergens."]}):null]})},n))]},n))]}):null]})};var n=r(d[0]),s=e(r(d[1])),l=r(d[2]),t=e(r(d[3])),c=r(d[4]);const o=t.default.menus,u=e=>new Intl.NumberFormat('en-GB',{style:'currency',currency:'GBP'}).format(e)},1219,[34,102,794,1220,25]); +__d(function(e,i,a,r,n,t,o){n.exports={currency:"GBP",note:"Parsed with pdftotext. Do not invent dishes. Menus subject to change. Dietary codes from a la carte: GF, GFA, V, VV.",menus:[{id:"breakfast",name:"Breakfast \u2014 Morning Edition",when:"Breakfast service; Morning Deals Monday\u2013Friday",sourcePdf:"raw/menu-breakfast.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/10/Abbotsford-Breakfast-Menu-1.pdf",categories:[{name:"Morning Deals (Monday\u2013Friday)",items:[{name:"Rolling Report",description:"Morning roll with choice of 2 fillings: Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg, plus filter tea or coffee",price:6.5,dietary:[]},{name:"The Full Feature",description:"The Abbotsford Breakfast plus fruit juice and filter tea or coffee",price:15,dietary:[]}]},{name:"The Epicurious Express",items:[{name:"The Abbotsford Breakfast",description:"Ayrshire bacon, link sausage, black pudding, haggis, potato scone, beans, tomato, mushrooms and two eggs (poached, scrambled or fried) with white or wholemeal toasted bloomer",price:11.95,dietary:[]},{name:"Light Breakfast",description:"Ayrshire bacon, link sausage, beans, tomato and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:[]},{name:"Vegetarian Breakfast",description:"Potato scone, tomato, mushrooms, beans and two eggs with white or wholemeal toasted bloomer",price:9.5,dietary:["V"]},{name:"Breakfast Roll",description:"Choice of Ayrshire bacon, pork link sausage, potato scone or egg; 2 items 4.50 | 3 items 5.50",price:3.95,dietary:[]},{name:"Eggs Benedict",description:"Two poached eggs with Ayrshire bacon on toasted muffin, hollandaise",price:10.95,dietary:[]},{name:"Eggs Royale",description:"Two poached eggs with flaked smoked salmon on toasted muffin, hollandaise",price:11.45,dietary:[]},{name:"Smashed Avocado Benedict",description:"Smashed avocado guacamole, two poached eggs on toasted muffin, hollandaise",price:10.95,dietary:["V"]},{name:"Pancake Stack",description:"American-style pancakes with Biscoff, Nutella, chocolate sauce and fresh strawberries",price:9.95,dietary:["V"]},{name:"French Toast",description:"Two slices of bloomer eggy bread with Ayrshire bacon and maple syrup",price:10.95,dietary:[]},{name:"The Morning Stack",description:"American-style pancakes with Ayrshire bacon and maple syrup; add two eggs 2.00",price:9.95,dietary:[]},{name:"Granola Bowl",description:"Almond and raisin granola topped with berries, natural yoghurt and honey",price:8.95,dietary:["V"]},{name:"Brunch \xc0 La Tina",description:"Wholemeal toasted bloomer, smashed avocado, grilled Bonnet goats cheese, smoked salmon, fried free-range egg and balsamic glaze",price:12.5,dietary:[]}]},{name:"Little Legends Ledger (Kids)",items:[{name:"Kids Breakfast",description:"Pork link sausage, beans, potato scone, slice of toast",price:5.95,dietary:[]},{name:"Kids Pancakes",description:"American-style pancakes with syrup, Nutella or butter and jam; add banana or strawberries 1.50",price:5.95,dietary:[]}]},{name:"Extras Desk",items:[{name:"Black Pudding",description:null,price:1.5,dietary:[]},{name:"Pork Link Sausage",description:null,price:1.5,dietary:[]},{name:"Ayrshire Bacon (2)",description:null,price:1.5,dietary:[]},{name:"Smashed Avocado",description:null,price:2,dietary:[]},{name:"Haggis",description:null,price:1.5,dietary:[]},{name:"Mushrooms",description:null,price:1.5,dietary:[]},{name:"Beans",description:null,price:1,dietary:[]},{name:"Tomato",description:null,price:1,dietary:[]},{name:"Egg",description:null,price:1,dietary:[]},{name:"Potato Scone",description:null,price:1,dietary:[]},{name:"Bucket of Chips",description:null,price:4.25,dietary:[]},{name:"Toasted White or Wholemeal Bread",description:"Served with butter and preserve",price:4.5,dietary:[]}]},{name:"Treat Tales",items:[{name:"Scone with butter, jam and hot drink",description:"9am\u201312noon offer",price:4.5,dietary:[]},{name:"Scones, Traybakes and Cakes",description:"From 2.50, available all day",price:2.5,dietary:[],note:"Price 'from' as printed"}]},{name:"Coffee",items:[{name:"Latte",description:null,price:3.75,dietary:[]},{name:"Espresso",description:null,price:3.25,dietary:[]},{name:"Cappuccino",description:null,price:3.75,dietary:[]},{name:"Americano",description:null,price:3.5,dietary:[]},{name:"Double Espresso",description:null,price:3.75,dietary:[]},{name:"Macchiato",description:null,price:3.75,dietary:[]},{name:"Espresso Con Panna",description:null,price:3.75,dietary:[]},{name:"Flavour Shot",description:null,price:.75,dietary:[]},{name:"Extra Shot of Coffee",description:null,price:.75,dietary:[]}]},{name:"Tea and Hot Chocolate",items:[{name:"Breakfast Tea",description:null,price:3.5,dietary:[]},{name:"Camomile Tea",description:null,price:3.5,dietary:[]},{name:"Earl Grey Tea",description:null,price:3.5,dietary:[]},{name:"Green Tea",description:null,price:3.5,dietary:[]},{name:"Peppermint Tea",description:null,price:3.5,dietary:[]},{name:"Red Berry Tea",description:null,price:3.5,dietary:[]},{name:"Lemon and Ginger Tea",description:null,price:3.5,dietary:[]},{name:"Hot Chocolate",description:null,price:3.95,dietary:[]},{name:"Luxury Hot Chocolate",description:"With cream and marshmallows",price:4.95,dietary:[]}]}]},{id:"alacarte",name:"\xc0 La Carte \u2014 Epicurious",when:"Sept 2026 menu; sandwiches 12noon\u20134pm",sourcePdf:"raw/menu-alacarte.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/09/Sept-2026-NEW-Menu-Abbotsford-A-La-Carte.pdf",categories:[{name:"The Birch Wine Board",items:[{name:"The Birch Wine Board",description:"Charred halloumi, roasted cauliflower, cured meats, chicken liver parfait, chutney, Scottish cheese, pickled onions, gherkins and fresh seasonal vegetables",price:19.95,dietary:[]}]},{name:"Starters",items:[{name:"Haggis Scotch Egg",description:"Smoked turnip veloute, Arran mustard and crispy leeks",price:10.95,dietary:[]},{name:"Traditional Cullen Skink",description:"With crusty ciabatta bread",price:10.95,dietary:["GFA"]},{name:"Chef's Soup of the Day",description:"With freshly baked bread",price:6.5,dietary:["GFA","VV"]},{name:"Moules Marini\xe8re",description:"Shetland mussels, white wine and garlic cream with garlic ciabatta",price:12.95,dietary:["GFA"]},{name:"Chicken Liver and Brandy Parfait",description:"Red onion chutney and bannocks",price:9.5,dietary:["GFA"]},{name:"Sweet Chilli and Soy Glazed Pork Belly Bites",description:"Chilli mint yogurt and pickled cucumber ribbons",price:10.5,dietary:["GFA"]},{name:"Fruit Platter",description:"Duo of melon, seasonal berries, passionfruit sorbet and raspberry coulis",price:9.95,dietary:["GF","VV"]}]},{name:"Sandwiches",note:"Served 12noon\u20134pm. White or malted bloomer with tortilla chips, house salad and coleslaw. GF on request. Add soup 3.95 | chips 4.50",items:[{name:"Tuna Mayonnaise",description:null,price:10.95,dietary:[]},{name:"Ploughman's",description:null,price:11.95,dietary:[]},{name:"Coronation Chicken",description:null,price:10.95,dietary:[]},{name:"Chicken and Bacon Club",description:null,price:12.95,dietary:[]}]},{name:"Burgers",note:"Toasted brioche, house slaw and hand-cut chips",items:[{name:"6oz Homemade Abbotsford Burger",description:"Burger sauce, pickles, tomato and baby gem; add cheese/blue cheese/bacon 1.50",price:16.95,dietary:[]},{name:"Abbotsford Spiced Buttermilk Chicken Burger",description:"BBQ pulled beef, garlic mayonnaise, pickles, tomato and baby gem",price:18.95,dietary:[]},{name:"The Burns Burger",description:"6oz Scotch beef, haggis, tattie scone, smoked Arran cheddar and peppercorn sauce",price:18.95,dietary:[]},{name:"Moving Mountains Burger",description:"Plant-based patty, lettuce, tomato, red onion and vegan garlic mayonnaise",price:16.95,dietary:["VV"]}]},{name:"From the Grill",note:"Flat-cap mushrooms, grilled plum tomato, fries and onion rings (GFA). Sauce 2.50: peppercorn | garlic butter | red wine jus",items:[{name:"8 oz Fillet Steak",description:null,price:38.95,dietary:["GFA"]},{name:"10 oz Sirloin Steak",description:null,price:35.95,dietary:["GFA"]}]},{name:"Mains",items:[{name:"Cajun Spiced Breast of Chicken",description:"Rice pilaf, proven\xe7al vegetables, coconut curry cream and spiced onions",price:null,dietary:["GFA"],note:"Printed 14.50 // 18.50",priceOptions:[14.5,18.5]},{name:"Confit Pork Belly",description:"Chorizo creamed potatoes, black pudding bon bons, beer-braised onion and mustard jus",price:21.95,dietary:[]},{name:"Individual Steak and Ale Pie",description:"Creamed potatoes, roasted carrot, tenderstem broccoli and red wine jus",price:19.95,dietary:[]},{name:"Trio of Seafood",description:"Chef's catch of the day, potato fondant, buttered greens and white wine chive cream",price:23.95,dietary:["GF"]},{name:"Beer Battered Haddock",description:"Pickled onion, mushy peas, tartare, fries and lemon",price:null,dietary:["GFA"],note:"Printed 13.45 // 18.50",priceOptions:[13.45,18.5]},{name:"Wild Mushroom Stroganoff",description:"Pilaf rice and tempura gherkins",price:null,dietary:["V"],note:"Printed 13.95 // 17.95",priceOptions:[13.95,17.95]}]},{name:"Sides",note:"All sides vegetarian; ask for GF",items:[{name:"Onion Rings",description:null,price:4,dietary:["V"]},{name:"House Slaw",description:null,price:4,dietary:["V"]},{name:"Creamed Potatoes",description:null,price:5,dietary:["V"]},{name:"House Salad",description:null,price:4,dietary:["V"]},{name:"Hand Cut Chips",description:null,price:4.5,dietary:["V"]},{name:"Sweet Potato Wedges",description:null,price:5.25,dietary:["V"]},{name:"Chilli and Parmesan Hand Cut Chips",description:null,price:5.25,dietary:["V"]}]},{name:"Desserts",items:[{name:"Sticky Toffee Pudding",description:"Butterscotch sauce and vanilla ice cream",price:8.95,dietary:["V","GF"]},{name:"Passionfruit Martini Panna Cotta",description:"Passionfruit syrup and prosecco sorbet",price:9.95,dietary:["GF"]},{name:"Warm Orange Scented Rice Pudding",description:"Ginger biscuit crumb",price:8.95,dietary:["VV","GF"]},{name:"Cheesecake of the Day",description:"With vanilla ice cream and fresh fruit garnish",price:9.95,dietary:["V"]},{name:"Traditional Tiramisu",description:"Coffee sponge fingers, amaretto mascarpone and dark chocolate powder",price:9.95,dietary:["V"]},{name:"Trio of Scottish Cheeses",description:"Cheese, fig chutney, biscuits and grapes",price:10.95,dietary:["GFA"]}]},{name:"Notes",items:[{name:"Chef's Daily Specials",description:"Ask your server",price:null,dietary:[]},{name:"The Ultimate Sunday Roast",description:"Every Sunday until stock runs out",price:null,dietary:[]}]}]},{id:"kids",name:"Kids \u2014 Abby's Favourites",when:null,sourcePdf:"raw/menu-kids.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/02/NEW-Menu-Abbotsford-Kids-Menu.pdf",categories:[{name:"Wee Lamb \xb7 Starters (\xa33)",items:[{name:"Garlic Bread",description:null,price:3,dietary:[]},{name:"Soup of the Day",description:null,price:3,dietary:[]}]},{name:"Rowan Pony \xb7 Mains (\xa37)",note:"Add bacon \xa31 | add cheese \xa31",items:[{name:"Chicken Goujons and Chips",description:null,price:7,dietary:[]},{name:"Cheesy Pasta and Garlic Bread",description:null,price:7,dietary:[]},{name:"Haddock and Chips",description:null,price:7,dietary:[]},{name:"3oz Beef Burger and Chips",description:null,price:7,dietary:[]}]},{name:"Scottie Dog \xb7 Treats (\xa33)",items:[{name:"Sticky Toffee Pudding",description:null,price:3,dietary:[]},{name:"Two Scoops of Ice Cream",description:null,price:3,dietary:[]}]}]},{id:"taco-tuesday",name:"Taco Tuesday",when:"Tuesdays",sourcePdf:"raw/menu-taco-tuesday.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/Taco-Tuesday-Menu-The-Abbotsford.pdf",categories:[{name:"Tacos",note:"Salad, pickled red onion, pico de gallo, fresh lime. Single \xa35 / Double \xa310",items:[{name:"Crispy Fried Chicken",description:"Sriracha mayo",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Beef Birria and Cheese",description:"Birria dip",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Breaded Haddock",description:"Tartare sauce",price:null,dietary:[],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]},{name:"Sweet Potato and Chickpea Falafel",description:"Sriracha mayo",price:null,dietary:["V"],note:"Single 5.00 / Double 10.00",priceOptions:[5,10]}]},{name:"Sides and Extras",items:[{name:"Nachos",description:"Guacamole, pico de gallo, sour cream and cheese",price:5,dietary:[]},{name:"Onion Rings",description:null,price:4,dietary:[]},{name:"Fries",description:null,price:4,dietary:[]},{name:"House Slaw",description:null,price:4,dietary:[]},{name:"Mexican Black Bean and Rice",description:null,price:4,dietary:[]},{name:"Chargrilled Cob",description:null,price:null,dietary:[],note:"Single \xa32 / Double \xa34",priceOptions:[2,4]}]},{name:"Cocktails",items:[{name:"Classic Margarita",description:"Or Spicy | Mango | Passionfruit",price:9.95,dietary:[]}]}]},{id:"bar-bites",name:"Bar Bites",when:"The Copper Bar",sourcePdf:"raw/menu-bar-bites.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Bar-Bites.pdf",categories:[{name:"Small Plates (\xa35)",items:[{name:"Ham Hough, Confit Chicken and Apricot Croquette",description:null,price:5,dietary:[]},{name:"Sriracha and Maple Glazed Chicken Goujons",description:null,price:5,dietary:[]},{name:"Goats Cheese, Caramelised Onion and Truffle Oil Arancini",description:null,price:5,dietary:["V"]},{name:"Homemade Sausage Roll",description:"Whole grain mustard, Arran cheddar, apple and walnut ketchup",price:5,dietary:[]}]},{name:"Loaded Fries (\xa38.95)",items:[{name:"Cajun Chicken Loaded Fries",description:"Cajun fries, diced cajun chicken, peppers, onions, cheddar and sriracha mayo",price:8.95,dietary:[]},{name:"Locally Caught Haggis Loaded Fries",description:"Seasoned fries, haggis, cheese and peppercorn sauce",price:8.95,dietary:[]}]},{name:"Sharing Plates",items:[{name:"Nice to Meat You",description:"Cold meats, olives and sun-dried tomatoes",price:10,dietary:[]},{name:"Say Cheese",description:"Scottish cheeses, quince jelly, chutney and oatcakes",price:10,dietary:[]},{name:"Sharing is Caring",description:"Nice to Meat You and Say Cheese combo",price:18,dietary:[]}]}]},{id:"drinks",name:"Drinks \u2014 Social Pours",when:null,sourcePdf:"raw/menu-drinks.pdf",sourceUrl:"https://www.abbotsfordhotel.co.uk/wp-content/uploads/2026/08/The-Abbotsford-Drinks-Menu.pdf",note:"Some cocktail groups share one printed price on the PDF.",categories:[{name:"The Classics",note:"Shared price line 9.95",items:[{name:"Daiquiri",description:"White rum, lime and sugar syrup; Strawberry, Passionfruit or Mango",price:null,dietary:[],sharedPrice:9.95},{name:"Old Fashioned",description:"Bourbon, sugar syrup and orange bitters",price:null,dietary:[],sharedPrice:9.95},{name:"Whisky Sour",description:"Whisky, lemon, sugar syrup, Angostura and egg white",price:null,dietary:[],sharedPrice:9.95},{name:"Margarita",description:"Tequila, lime, sugar syrup and triple sec",price:null,dietary:[],sharedPrice:9.95},{name:"Cosmopolitan",description:"Heroes vodka, cranberry, lime, triple sec and sugar syrup",price:9.95,dietary:[]}]},{name:"Martini Style",items:[{name:"Pornstar Martini",description:"Vanilla vodka, passionfruit, Passoa and pineapple",price:null,dietary:[],sharedPrice:10.95},{name:"French Martini",description:"Heroes vodka, pineapple and Chambord",price:null,dietary:[],sharedPrice:10.95},{name:"Espresso Martini",description:"Heroes vodka, coffee liqueur, sugar syrup and espresso",price:10.95,dietary:[]}]},{name:"That's the Spritz",note:"Shared price 9.95",items:[{name:"Aperol Spritz",description:"Aperol, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Hugo Spritz",description:"Elderflower liqueur, prosecco and soda",price:null,dietary:[],sharedPrice:9.95},{name:"Limoncello Spritz",description:"Limoncello, prosecco and lemonade",price:null,dietary:[],sharedPrice:9.95},{name:"Pink Gin Spritz",description:"Pink gin, prosecco and lemonade",price:9.95,dietary:[]}]},{name:"Hangover Free (Mocktails)",note:"Shared price 6.95",items:[{name:"Abbotsford Sunset",description:"Tanqueray Flor De Sevilla 0%, orange, lemon, grenadine and lemonade",price:null,dietary:[],sharedPrice:6.95},{name:"Mixed Berry Fizz",description:"Whitley Neill Raspberry 0%, lemon and soda",price:null,dietary:[],sharedPrice:6.95},{name:"Not So Mojito",description:"Apple juice, lime, sugar syrup, mint and soda",price:6.95,dietary:[]}]},{name:"Wine by the Glass \u2014 White",items:[{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}},{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:null,dietary:[],glass:{"175ml":9.95,"250ml":11.95}}]},{name:"Wine by the Glass \u2014 Rose",items:[{name:"La Maglia Rosa Pinot Grigio Blush, Pavia, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Whispering Hills Zinfandel Rose, California, USA",description:null,price:null,dietary:[],glass:{"175ml":6.5,"250ml":8.5}}]},{name:"Wine by the Glass \u2014 Red",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:null,dietary:[],glass:{"175ml":6.95,"250ml":8.95}},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:null,dietary:[],glass:{"175ml":7.95,"250ml":10.5}},{name:"Fico Grande Sangiovese, Italy",description:null,price:null,dietary:[],glass:{"175ml":7.5,"250ml":10}},{name:"Alma Mora Malbec, San Juan, Argentina",description:null,price:null,dietary:[],glass:{"175ml":8.95,"250ml":10.95}}]},{name:"Cellar Table \u2014 White (bottle)",items:[{name:"Petal and Stem Sauvignon Blanc, Marlborough, New Zealand",description:null,price:29.95,dietary:[]},{name:"Berri Estates Chardonnay, South Eastern Australia",description:null,price:24.95,dietary:[]},{name:"Grave del Friuli Pinot Grigio, Fantinel, Italy",description:null,price:29.95,dietary:[]},{name:"Mas Puech Picpoul de Pinet, France",description:null,price:29.95,dietary:[]},{name:"Monte di Sarocco Gavi, Italy",description:null,price:34.95,dietary:[]},{name:"Leiras Albarino, Rias Baixas, Spain",description:null,price:35.95,dietary:[]},{name:"Chateau Ste Michelle Chardonnay, Washington State, USA",description:null,price:47.95,dietary:[]},{name:"Louis Jadot Macon-Villages, France",description:null,price:60,dietary:[]}]},{name:"Cellar Table \u2014 Red (bottle)",items:[{name:"Berri Estates Shiraz, South Eastern Australia",description:null,price:25.95,dietary:[]},{name:"La Campagne Merlot, Pays d'Oc, France",description:null,price:30.95,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Zensa Primitivo Salento, Italy",description:null,price:30.95,dietary:[]},{name:"Chateauneuf-du-Pape, France",description:null,price:74.95,dietary:[]},{name:"Louis Jadot Pinot Noir, France",description:null,price:42,dietary:[]},{name:"Vina Pomal Reserva Centenario, Spain",description:null,price:55,dietary:[]}]},{name:"Cellar Table \u2014 Rose (bottle)",items:[{name:"Coteaux Varois en Provence Rose, Estandon, France",description:null,price:55,dietary:[]},{name:"La Maglia Rosa Pinot Grigio Blush, Italy",description:null,price:29.95,dietary:[]},{name:"Whispering Hills Zinfandel, USA",description:null,price:24.95,dietary:[]}]},{name:"Sparkling and Champagne",items:[{name:"Oliver and Greg's Prosecco Brut, Italy",description:null,price:29.95,dietary:[],note:"200ml 8.95 | Bottle 29.95",glass:{"200ml":8.95}},{name:"Bottega Gold Prosecco Brut, Italy",description:null,price:40,dietary:[]},{name:"Veuve Clicquot Yellow Label, France",description:null,price:89,dietary:[]},{name:"Veuve Clicquot Rose, France",description:null,price:99,dietary:[]}]},{name:"Abbotsford Top Picks",items:[{name:"Sancerre, Domaine des Chaintres, France",description:null,price:70,dietary:[]},{name:"Peth Wetz Riesling, Germany",description:null,price:55,dietary:[]},{name:"Fico Grande Sangiovese, Italy",description:null,price:29.95,dietary:[]},{name:"Valpolicella Classico Superiore Ripasso, Italy",description:null,price:65,dietary:[]},{name:"Chateau Ste. Michelle Cabernet Sauvignon, USA",description:null,price:60,dietary:[]},{name:"Chateau Grand Jauga Sauternes, France",description:null,price:40,dietary:[],note:"Dessert wine"}]}]}]}},1220,[]); +__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 k}});var n=r(d[0]),t=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function k(){const[k,j]=(0,n.useState)(!1),p=(0,c.useRestaurant)('kirkton')??u.KIRKTON_RESTAURANT;return(0,h.jsxs)(t.Screen,{title:p.name,back:!1,children:[(0,h.jsx)(o.RestaurantHero,{rid:"kirkton",size:240}),(0,h.jsx)(t.T,{center:!0,children:"Bar and restaurant in Dalrymple"}),k?(0,h.jsx)(l.NativeRequestSetup,{rid:"kirkton",kind:"table",allDayHours:p.kitchenHours,onClose:()=>j(!1)}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Book a table"}),(0,h.jsx)(t.Button,{testID:"kirkton-book-table",label:"Book a table",onPress:()=>j(!0)}),(0,h.jsx)(t.T,{children:"Send a table request for the venue managers to confirm once setup is complete. This is not an instant booking."}),(0,h.jsx)(t.Muted,{children:"No deposit, payment, email or text is taken or sent by this app."})]}),(0,h.jsxs)(t.Card,{children:[(0,h.jsx)(t.H2,{children:"Venue setup in progress"}),(0,h.jsx)(t.T,{children:"Contact phone: to confirm"}),(0,h.jsx)(t.T,{children:"Opening and kitchen hours: to confirm"}),(0,h.jsx)(t.T,{children:"Table plan and Covers: to confirm"}),(0,h.jsx)(t.T,{children:"Takeaway: to confirm"}),(0,h.jsx)(t.Muted,{children:"Table requests need an authorised manager and confirmed kitchen hours. Orders and payments are not enabled. Deposit policy needs confirmation; deposits are off."})]}),(0,h.jsx)(s.FindPub,{rid:"kirkton"}),(0,h.jsx)(t.Banner,{kind:"warn",title:"Menus \u2014 provisional and unconfirmed",children:"The available menu records are archived from 2019. They are not current prices, availability or allergen information. No menu items are available to order here."})]})]})}},1221,[34,794,847,1207,1208,848,9,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},1222,[34,402,102,426,794,840,1153,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},1223,[798,34,336,395,402,295,102,1193,794,989,830,990,827,840,1034,25,1224]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},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.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)})]})}},1225,[34,102,1226,794,848,997,1201,1204,840,25]); +__d(function(g,r,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])},1226,[34,102,1227,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1227,[1228]); +__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}});var e=r(d[0]),t=r(d[1]),l=o(t),s=o(r(d[2])),n=o(r(d[3])),c=o(r(d[4])),h=r(d[5]);const u=({size:o,backgroundColor:e,logo:l,logoSVG:s,logoSize:n,logoBackgroundColor:u,logoColor:x,logoMargin:f,logoBorderRadius:p,clipPathId:j})=>{const C=(o-n-2*f)/2,y=n+2*f,b=p+f/n*p,k=`clip-logo-background-${j}`,G=`clip-logo-${j}`;return(0,h.jsxs)(t.G,{x:C,y:C,children:[(0,h.jsxs)(t.Defs,{children:[(0,h.jsx)(t.ClipPath,{id:k,children:(0,h.jsx)(t.Rect,{width:y,height:y,rx:b,ry:b})}),(0,h.jsx)(t.ClipPath,{id:G,children:(0,h.jsx)(t.Rect,{width:n,height:n,rx:p,ry:p})})]}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{width:y,height:y,fill:e,clipPath:`url(#${k})`})}),(0,h.jsxs)(t.G,{x:f,y:f,clipPath:`url(#${G})`,children:[(0,h.jsx)(t.Rect,{width:y-f,height:y-f,fill:u}),s?(0,h.jsx)(c.default,{svg:s,logoSize:n,logoColor:x}):(0,h.jsx)(t.Image,{width:n,height:n,preserveAspectRatio:"xMidYMid slice",href:l,clipPath:`url(#${G})`})]})]})};var x=({value:o="this is a QR code",size:c=100,color:x="black",backgroundColor:f="white",logo:p,logoSVG:j,logoSize:C=.2*c,logoBackgroundColor:y="transparent",logoColor:b,logoMargin:k=2,logoBorderRadius:G=0,quietZone:R=0,enableLinearGradient:w=!1,gradientDirection:P=['0%','0%','100%','100%'],linearGradient:S=['rgb(255,0,0)','rgb(0,255,255)'],ecl:M="M",getRef:z,onError:v,testID:B})=>{const I=(0,e.useId)(),_=(0,e.useMemo)(()=>{try{return(0,n.default)((0,s.default)(o,M),c)}catch(o){if(!v||'function'!=typeof v)throw o;v(o)}},[o,c,M]);if(!_)return null;const{path:D,cellSize:$}=_,O=p||j;return(0,h.jsxs)(l.default,{testID:B,ref:z,viewBox:[-R,-R,c+2*R,c+2*R].join(' '),width:c,height:c,children:[(0,h.jsx)(t.Defs,{children:(0,h.jsxs)(t.LinearGradient,{id:"grad",x1:P[0],y1:P[1],x2:P[2],y2:P[3],children:[(0,h.jsx)(t.Stop,{offset:"0",stopColor:S[0],stopOpacity:"1"}),(0,h.jsx)(t.Stop,{offset:"1",stopColor:S[1],stopOpacity:"1"})]})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Rect,{x:-R,y:-R,width:c+2*R,height:c+2*R,fill:f})}),(0,h.jsx)(t.G,{children:(0,h.jsx)(t.Path,{d:D,strokeLinecap:"butt",stroke:w?'url(#grad)':x,strokeWidth:$})}),O&&u({size:c,backgroundColor:f,logo:p,logoSVG:j,logoSize:C,logoBackgroundColor:y,logoColor:b,logoMargin:k,logoBorderRadius:G,clipPathId:I})]})}},1228,[34,900,1229,1258,1259,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=(e,t)=>{const l=Array.prototype.slice.call(u.default.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(l.length);return l.reduce((e,t,u)=>(u%n===0?e.push([t]):e[e.length-1].push(t))&&e,[])}},1229,[1230]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1230,[1231,1232,1255,1257]); +__d(function(g,r,i,a,m,e,d){m.exports=function(){return'function'==typeof Promise&&Promise.prototype&&Promise.prototype.then}},1231,[]); +__d(function(g,_r,_i,a,m,e,d){const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),i=_r(d[5]),f=_r(d[6]),c=_r(d[7]),l=_r(d[8]),u=_r(d[9]),h=_r(d[10]),w=_r(d[11]),C=_r(d[12]);function y(t,o){const n=t.size,r=i.getPositions(o);for(let o=0;o=0&&o<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===o||6===o)||o>=2&&o<=4&&r>=2&&r<=4?t.set(s+o,i+r,!0,!0):t.set(s+o,i+r,!1,!0))}}function S(t){const o=t.size;for(let n=8;n>o&1),t.set(s,i,f,!0),t.set(i,s,f,!0)}function B(t,o,n){const r=t.size,s=h.getEncodedBits(o,n);let i,f;for(i=0;i<15;i++)f=1==(s>>i&1),i<6?t.set(i,8,f,!0):i<8?t.set(i+1,8,f,!0):t.set(r-15+i,8,f,!0),i<8?t.set(8,r-i-1,f,!0):i<9?t.set(8,15-i-1+1,f,!0):t.set(8,15-i-1,f,!0);t.set(r-8,8,1,!0)}function b(t,o){const n=t.size;let r=-1,s=n-1,i=7,f=0;for(let c=n-1;c>0;c-=2)for(6===c&&c--;;){for(let n=0;n<2;n++)if(!t.isReserved(s,c-n)){let r=!1;f>>i&1)),t.set(s,c-n,r),i--,-1===i&&(f++,i=7)}if(s+=r,s<0||n<=s){s-=r,r=-r;break}}}function M(o,r,s){const i=new n;s.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),w.getCharCountIndicator(t.mode,o)),t.write(i)});const f=8*(t.getSymbolTotalCodewords(o)-c.getTotalCodewordsCount(o,r));for(i.getLengthInBits()+4<=f&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const l=(f-i.getLengthInBits())/8;for(let t=0;t=7&&v(I,n),b(I,h),isNaN(i)&&(i=f.getBestMask(I,B.bind(null,I,s))),f.applyMask(i,I),B(I,s,i),{modules:I,version:n,errorCorrectionLevel:s,maskPattern:i,segments:c}}e.create=function(n,r){if(void 0===n||''===n)throw new Error('No input text');let s,i,c=o.M;return void 0!==r&&(c=o.from(r.errorCorrectionLevel,o.M),s=u.from(r.version),i=f.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),A(n,s,c,i)}},1232,[1233,1234,1235,1236,1237,1238,1239,1240,1241,1244,1248,1245,1249]); +__d(function(g,r,i,a,m,e,d){let n;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return 4*n+17},e.getSymbolTotalCodewords=function(n){return o[n]},e.getBCHDigit=function(n){let o=0;for(;0!==n;)o++,n>>>=1;return o},e.setToSJISFunction=function(o){if('function'!=typeof o)throw new Error('"toSJISFunc" is not a valid function.');n=o},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(o){return n(o)}},1233,[]); +__d(function(g,r,i,a,m,_e,d){function t(t){if('string'!=typeof t)throw new Error('Param is not a string');switch(t.toLowerCase()){case'l':case'low':return _e.L;case'm':case'medium':return _e.M;case'q':case'quartile':return _e.Q;case'h':case'high':return _e.H;default:throw new Error('Unknown EC Level: '+t)}}_e.L={bit:1},_e.M={bit:0},_e.Q={bit:3},_e.H={bit:2},_e.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},_e.from=function(e,n){if(_e.isValid(e))return e;try{return t(e)}catch(t){return n}}},1234,[]); +__d(function(g,r,_i,a,m,e,d){function t(){this.buffer=[],this.length=0}t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let h=0;h>>n-h-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},m.exports=t},1235,[]); +__d(function(g,r,i,a,m,e,d){function t(t){if(!t||t<1)throw new Error('BitMatrix size must be defined and greater than 0');this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,s,n,o){const h=t*this.size+s;this.data[h]=n,o&&(this.reservedBit[h]=!0)},t.prototype.get=function(t,s){return this.data[t*this.size+s]},t.prototype.xor=function(t,s,n){this.data[t*this.size+s]^=n},t.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},m.exports=t},1236,[]); +__d(function(g,r,_i,a,m,e,d){const o=r(d[0]).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,s=o(t),l=145===s?26:2*Math.ceil((s-13)/(2*n-2)),f=[s-7];for(let o=1;o=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let l=0,o=0,P=0,T=null,c=null;for(let u=0;u=5&&(l+=t+(o-5)),T=s,o=1),s=n.get(N,u),s===c?P++:(P>=5&&(l+=t+(P-5)),c=s,P=1)}o>=5&&(l+=t+(o-5)),P>=5&&(l+=t+(P-5))}return l},e.getPenaltyN2=function(t){const s=t.size;let l=0;for(let n=0;n=10&&(1488===o||93===o)&&l++,P=P<<1&2047|t.get(T,s),T>=10&&(1488===P||93===P)&&l++}return l*s},e.getPenaltyN4=function(t){let n=0;const s=t.data.length;for(let l=0;l0){const t=new Uint8Array(this.degree);return t.set(s,h),t}return s},m.exports=n},1241,[1242]); +__d(function(g,r,_i,a,m,e,d){const n=r(d[0]);e.mul=function(t,l){const o=new Uint8Array(t.length+l.length-1);for(let u=0;u=0;){const t=o[0];for(let u=0;u1)return C(t,u);if(0===t.length)return 1;f=t[0]}else f=t;return s(f.mode,f.getLength(),u)},e.getEncodedBits=function(n){if(!u.isValid(n)||n<7)throw new Error('Invalid QR Code version');let o=n<<12;for(;t.getBCHDigit(o)-c>=0;)o^=7973<=1&&e<10?n.ccBits[0]:e<27?n.ccBits[1]:n.ccBits[2]},_e.getBestModeForData=function(t){return n.testNumeric(t)?_e.NUMERIC:n.testAlphanumeric(t)?_e.ALPHANUMERIC:n.testKanji(t)?_e.KANJI:_e.BYTE},_e.toString=function(t){if(t&&t.id)return t.id;throw new Error('Invalid mode')},_e.isValid=function(t){return t&&t.bit&&t.ccBits},_e.from=function(t,n){if(_e.isValid(t))return t;try{return e(t)}catch(t){return n}}},1245,[1246,1247]); +__d(function(g,r,i,a,m,e,d){e.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}},1246,[]); +__d(function(g,r,i,a,m,e,d){let u="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";u=u.replace(/u/g,'\\u');const n='(?:(?![A-Z0-9 $%*+\\-./:]|'+u+')(?:.|[\r\n]))+';e.KANJI=new RegExp(u,'g'),e.BYTE_KANJI=new RegExp('[^A-Z0-9 $%*+\\-./:]+','g'),e.BYTE=new RegExp(n,'g'),e.NUMERIC=new RegExp('[0-9]+','g'),e.ALPHANUMERIC=new RegExp('[A-Z $%*+\\-./:]+','g');const t=new RegExp('^'+u+'$'),E=new RegExp("^[0-9]+$"),A=new RegExp('^[A-Z0-9 $%*+\\-./:]+$');e.testKanji=function(u){return t.test(u)},e.testNumeric=function(u){return E.test(u)},e.testAlphanumeric=function(u){return A.test(u)}},1247,[]); +__d(function(g,r,i,a,m,e,_d){const t=r(_d[0]),n=t.getBCHDigit(1335);e.getEncodedBits=function(o,c){const B=o.bit<<3|c;let d=B<<10;for(;t.getBCHDigit(d)-n>=0;)d^=1335<=0?t[t.length-1]:null;return o&&o.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)},[])}function C(n){const o=[];for(let u=0;u0&&(o=this.data.substr(n),s=parseInt(o,10),t.put(s,3*i+1))},m.exports=n},1250,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]),n=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':'];function i(n){this.mode=t.ALPHANUMERIC,this.data=n}i.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let h=45*n.indexOf(this.data[i]);h+=n.indexOf(this.data[i+1]),t.put(h,11)}this.data.length%2&&t.put(n.indexOf(this.data[i]),6)},m.exports=i},1251,[1245]); +__d(function(g,r,_i,a,m,e,d){const t=r(d[0]);function n(n){this.mode=t.BYTE,this.data='string'==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else{if(!(o>=57408&&o<=60351))throw new Error('Invalid SJIS character: '+this.data[i]+"\nMake sure your charset is UTF-8");o-=49472}o=192*(o>>>8&255)+(255&o),t.put(o,13)}},m.exports=i},1253,[1245,1233]); +__d(function(g,r,i,_a,m,e,_d){'use strict';var t={single_source_shortest_paths:function(o,s,u){var n={},a={};a[s]=0;var h,f,p,_,c,v,d,l=t.PriorityQueue.make();for(l.push(s,0);!l.empty();)for(p in f=(h=l.pop()).value,_=h.cost,c=o[f]||{})c.hasOwnProperty(p)&&(v=_+c[p],d=a[p],(void 0===a[p]||d>v)&&(a[p]=v,l.push(p,v),n[p]=f));if(void 0!==u&&void 0===a[u]){var y=['Could not find a path from ',s,' to ',u,'.'].join('');throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(t,o){for(var s=[],u=o;u;)s.push(u),t[u],u=t[u];return s.reverse(),s},find_path:function(o,s,u){var n=t.single_source_shortest_paths(o,s,u);return t.extract_shortest_path_from_predecessor_list(n,u)},PriorityQueue:{make:function(o){var s,u=t.PriorityQueue,n={};for(s in o=o||{},u)u.hasOwnProperty(s)&&(n[s]=u[s]);return n.queue=[],n.sorter=o.sorter||u.default_sorter,n},default_sorter:function(t,o){return t.cost-o.cost},push:function(t,o){var s={value:t,cost:o};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==m&&(m.exports=t)},1254,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]);function e(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+'px',e.style.width=n+'px'}function n(){try{return document.createElement('canvas')}catch(t){throw new Error('You need to specify a canvas element')}}_e.render=function(o,c,s){let u=s,h=c;void 0!==u||c&&c.getContext||(u=c,c=void 0),c||(h=n()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),p=h.getContext('2d'),y=p.createImageData(l,l);return t.qrToImageData(y.data,o,u),e(p,h,l),p.putImageData(y,0,0),h},_e.renderToDataURL=function(t,e,n){let o=n;void 0!==o||e&&e.getContext||(o=e,e=void 0),o||(o={});const c=_e.render(t,e,o),s=o.type||'image/png',u=o.rendererOpts||{};return c.toDataURL(s,u.quality)}},1255,[1256]); +__d(function(g,r,_i,a,m,e,d){function t(t){if('number'==typeof t&&(t=t.toString()),'string'!=typeof t)throw new Error('Color should be defined as hex string');let o=t.slice().replace('#','').split('');if(o.length<3||5===o.length||o.length>8)throw new Error('Invalid hex color: '+t);3!==o.length&&4!==o.length||(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),6===o.length&&o.push('F','F');const n=parseInt(o.join(''),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:'#'+o.slice(0,6).join('')}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=void 0===o.margin||null===o.margin||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,l=o.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(o.color.dark||'#000000ff'),light:t(o.color.light||'#ffffffff')},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(t,o){return o.width&&o.width>=t+2*o.margin?o.width/(t+2*o.margin):o.scale},e.getImageWidth=function(t,o){const n=e.getScale(t,o);return Math.floor((t+2*o.margin)*n)},e.qrToImageData=function(t,o,n){const i=o.modules.size,l=o.modules.data,c=e.getScale(i,n),f=Math.floor((i+2*n.margin)*c),h=n.margin*c,s=[n.color.light,n.color.dark];for(let o=0;o=h&&u>=h&&o0&&f>0&&t[u-1]||(l+=s?n('M',f+i,.5+w+i):n('m',h,0),h=0,s=!1),f+1':'',p='',v="viewBox=\"0 0 "+f+' '+f+'"',x=''+w+p+'\n';return'function'==typeof h&&h(null,x),x}},1257,[1256]); +__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 t}});var t=(t,n)=>{const l=n/t.length;let c='';return t.forEach((n,u)=>{let o=!1;n.forEach((n,f)=>{n?(o||(c+=`M${l*f} ${l/2+l*u} `,o=!0),o&&f===t.length-1&&(c+=`L${l*(f+1)} ${l/2+l*u} `)):o&&(c+=`L${l*f} ${l/2+l*u} `,o=!1)})}),{cellSize:l,path:c}}},1258,[]); +__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}}),r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3]);var s=({svg:s,logoSize:l,logoColor:u})=>{if((0,n.isString)(s)){const u=(0,n.isUrlString)(s)?s:`data:image/svg+xml;base64,${window.btoa(s)}`;return(0,o.jsx)(t.Image,{href:encodeURI(u),width:l,height:l})}const c=s;return(0,o.jsx)(c,{fill:u,width:l,height:l})}},1259,[34,900,1260,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'string'==typeof t}Object.defineProperty(e,'__esModule',{value:!0}),e.isString=t,e.isUrlString=function(n){return t(n)&&n.startsWith('http')}},1260,[]); +__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]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},1261,[30,34,794,848,865,25]); +__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 j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},1262,[806,30,34,102,1226,794,836,848,840,1225,1204,25]); +__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 y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},1263,[806,30,34,102,1199,794,848,865,836,827,840,1200,1204,25]); +__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 j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},1264,[806,30,34,794,848,865,827,840,1225,1204,25]); +__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 j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},1265,[806,30,34,794,848,865,840,1225,1204,25]); +__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 h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),x=(0,u.useRestaurant)(h),j=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),f=(0,u.useBookings)(h),w=(0,u.useOrders)(h),y=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[v,M]=(0,s.useState)(2),[P,S]=(0,s.useState)(j.name);if(!x)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===j.id),B=(0,r.forecastToday)(x,f,w,y,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*x.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,x.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"Keep this page open to see when your table is ready. Text alerts are not connected."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:x.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,x.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:P,onChangeText:S}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:v,onChange:M,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:P.trim().length<2,onPress:()=>u.repo.waitlist.join(x.id,P,v,j.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},1266,[30,34,794,827,1120,1267,848,840,25]); +__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}},1267,[]); +__d(function(g,_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 h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),B=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===B.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):B.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{center:!0,weight:"semibold",style:{width:'100%',flexBasis:'100%'},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},1268,[30,1075,34,402,102,794,827,848,840,25]); +__d(function(g,_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 l=_r(d[0]),t=_r(d[1]),n=_r(d[2]),s=e(n),a=_r(d[3]),o=_r(d[4]),r=e(_r(d[5])),i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),m=_r(d[10]),b=_r(d[11]),y=_r(d[12]),j=_r(d[13]),x=_r(d[14]),p=_r(d[15]),k=_r(d[16]);function f(){const e=(0,y.useBasket)(),f=(0,y.useRestaurant)(e.restaurantId??void 0),w=(0,y.useAllMenu)(e.restaurantId??void 0),v=(0,y.useCustomer)(),C=(0,y.useOrders)(f?.id),S=(0,y.useStore)(e=>e.setLineQty),T=(0,y.useStore)(e=>e.overrideLine),B=(0,y.useStore)(e=>e.startBasket),P=(0,y.useNow)(15e3),[$,O]=(0,n.useState)(null),[I,M]=(0,n.useState)(!1),[N,F]=(0,n.useState)(''),[L]=(0,n.useState)(()=>(0,o.startForm)()),[R,z]=(0,n.useState)(''),[A,D]=(0,n.useState)(v.phone??''),[E,Y]=(0,n.useState)(v.email??''),[_,q]=(0,n.useState)(!1),H=(0,y.useOrderAtTable)(e.restaurantId??void 0);s.default.useEffect(()=>{H||'table'!==e.mode||y.useStore.setState(e=>({basket:{...e.basket,mode:'takeaway',tableNo:void 0}}))},[H,e.mode]);const[G,K]=(0,n.useState)(null),[Q,J]=(0,n.useState)(!1),U=(0,n.useMemo)(()=>(0,j.linesFromBasket)(e,w,v.allergies),[e,w,v.allergies]);if(!f||!e.lines.length)return(0,k.jsxs)(u.Screen,{title:"Your basket",children:[(0,k.jsx)(u.Muted,{children:"Your basket is empty."}),(0,k.jsx)(u.Button,{label:"Browse restaurants",onPress:()=>t.router.replace('/customer')})]});const V=H&&'table'===e.mode,W=(0,m.takeawaySlots)(f,C,P),X=U.reduce((e,l)=>e+l.unitPrice*l.qty,0),Z=U.some(e=>e.contains.length&&!e.overridden),ee=e.lines.filter(e=>{const l=w.find(l=>l.id===e.itemId);return!l||l.soldOut||!l.signOff}),le=!V&&!$,te=!V&&f.settings.takeawayPaused,ne=(0,p.ukPhone)(A),se=!Z&&!ee.length&&I&&!le&&!te&&(V||ne.ok&&(0,p.emailOk)(E)),ae=async e=>{const l=await y.repo.orders.placeFromBasket({slotTime:V?void 0:$,tip:0,giftCardCode:e?.giftCardCode,notes:N,paidNow:!V,phone:V?void 0:ne.pretty,email:V?void 0:E.trim()||void 0});(0,o.rememberGuard)(l.id,(0,o.guardFor)({...L,hp:R})),q(!1),t.router.replace(`/customer/order/${l.id}`)},oe=e.lines.find(e=>e.key===G),re=oe?U[e.lines.indexOf(oe)]:void 0;return(0,k.jsxs)(u.Screen,{title:"Your basket",subtitle:`${f.name} \xb7 ${V?`${(0,l.tableNumbers)(e.tableNo)} (order at table)`:'Takeaway \u2014 collection'}`,footer:(0,k.jsxs)(r.default,{style:{gap:8},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"Subtotal"}),(0,k.jsx)(u.T,{weight:"bold",size:20,colour:x.colours.gold,children:(0,h.gbp)(X)})]}),Z?(0,k.jsx)(u.T,{size:14,colour:x.colours.red,children:"Resolve the blocked allergy item(s) before continuing."}):I?le&&!te?(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Choose a collection time."}):null:(0,k.jsx)(u.T,{size:14,colour:x.colours.amber,children:"Confirm your allergies to continue."}),V?(0,k.jsx)(u.Button,{label:"Send order to the kitchen",disabled:!se,onPress:()=>ae(),testID:"send-table-order"}):(0,k.jsx)(u.Button,{label:`Continue to payment \xb7 ${(0,h.gbp)(X)}`,disabled:!se,onPress:()=>q(!0),testID:"checkout"})]}),children:[(V||e.tableNo,null),V?(0,k.jsx)(u.Banner,{kind:"success",title:`${(0,l.tableNumbers)(e.tableNo)}`,children:"Ordered food goes to the kitchen straight away; you pay at the end (split the bill if you like)."}):null,f.fictional?null:(0,k.jsx)(u.ExampleAllergenNotice,{}),U.map((l,t)=>{const n=e.lines[t],s=l.contains.length&&!l.overridden;return(0,k.jsxs)(u.Card,{highlight:l.contains.length?x.colours.red:l.may.length?x.colours.amber:void 0,children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsxs)(r.default,{style:{flex:1,paddingRight:8},children:[(0,k.jsx)(u.T,{weight:"semibold",children:l.name}),l.choices.length?(0,k.jsx)(u.Muted,{children:l.choices.join(' \xb7 ')}):null,l.notes?(0,k.jsxs)(u.Muted,{children:["Note: ",l.notes]}):null]}),(0,k.jsx)(u.T,{weight:"semibold",children:(0,h.gbp)(l.unitPrice*l.qty)})]}),s?(0,k.jsxs)(u.Banner,{kind:"danger",title:`BLOCKED \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:[(0,k.jsx)(u.T,{size:14,colour:"#FFE3DF",children:`Conflicts with your declared ${v.allergies.filter(e=>l.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} (${(0,c.severityLabel)(e.severity)})`).join(', ')}.`}),(0,k.jsxs)(u.Row,{gap:8,style:{marginTop:6},children:[(0,k.jsx)(u.Button,{small:!0,kind:"secondary",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Button,{small:!0,kind:"danger",label:"Override\u2026",onPress:()=>{J(!1),K(n.key)}})]})]}):l.contains.length?(0,k.jsx)(u.Banner,{kind:"danger",title:`Allergy override recorded \u2014 contains ${l.contains.map(c.allergenLabel).join(', ')}`,children:"The kitchen will get an allergy alert that must be acknowledged, and staff will check with you at handover."}):null,l.may.length?(0,k.jsx)(u.Banner,{kind:"warn",title:`May contain ${l.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact risk (e.g. shared fryer). Please check with staff."}):null,ee.includes(n)?(0,k.jsx)(u.Badge,{kind:"amber",label:"No longer available online \u2014 please remove"}):null,(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>S(n.key,0)}),(0,k.jsx)(u.Stepper,{value:n.qty,onChange:e=>S(n.key,e),min:1,label:l.name})]})]},n.key)}),(0,k.jsx)(u.Button,{kind:"ghost",label:"Add more items",onPress:()=>t.router.push(`/customer/${f.id}`)}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.H2,{children:["Collection time \u2014 ",(0,b.niceDate)(P)]}),te?(0,k.jsx)(u.Banner,{kind:"warn",title:"Takeaway paused",children:"The restaurant has paused takeaway slots for now. Please try again later or book a table."}):0===W.length?(0,k.jsx)(u.Banner,{kind:"warn",children:"No collection slots left today."}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(u.Muted,{children:["15-minute slots, max ",f.settings.slotCap," orders each so the kitchen isn\u2019t overloaded."]}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:W.slice(0,16).map(e=>(0,k.jsx)(u.Chip,{label:e.label,sub:e.full?'Full':e.cap-e.taken+" left",disabled:e.full,selected:$===e.time.toISOString(),onPress:()=>O(e.time.toISOString())},e.label))})]})]}),(0,k.jsxs)(u.Card,{highlight:I?void 0:x.colours.amber,children:[(0,k.jsx)(u.H2,{children:"Confirm allergies for this order"}),(0,k.jsx)(u.Row,{wrap:!0,gap:6,children:v.allergies.length?v.allergies.map(e=>(0,k.jsx)(u.Badge,{kind:"red",label:`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`},e.allergen)):(0,k.jsx)(u.Muted,{children:"No allergies declared on your profile."})}),(0,k.jsx)(u.Toggle,{label:v.allergies.length?'Yes, these are correct for everyone this order is for':'I confirm no one in this order has a food allergy',value:I,onChange:M}),(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit allergies in profile",onPress:()=>t.router.push('/customer/profile')})]}),V?null:(0,k.jsxs)(u.Card,{children:[(0,k.jsx)(u.H2,{children:"Your details"}),(0,k.jsx)(u.Field,{testID:"order-phone",label:"Mobile number (needed for collection)",value:A,onChangeText:D,keyboardType:"phone-pad",autoComplete:"tel",placeholder:"e.g. 07700 900123"}),!ne.ok&&A?(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:ne.error}):null,(0,k.jsx)(u.Field,{label:"Email (optional)",value:E,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"you@example.com"}),(0,p.emailOk)(E)?null:(0,k.jsx)(u.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right. Check it, or leave it blank."}),(0,k.jsx)(u.Muted,{children:"Your order confirmation and collection time are shown here. Text messages are not connected."})]}),(0,k.jsx)(u.Field,{label:"Order notes (optional)",value:N,onChangeText:F,placeholder:"e.g. cutlery please"}),V?(0,k.jsx)(u.Button,{small:!0,kind:"ghost",label:"Switch to takeaway instead",onPress:()=>B(f.id,'takeaway')}):null,(0,k.jsx)(i.MockPay,{visible:_,onClose:()=>q(!1),amount:X,restaurantId:f.id,onPaid:e=>ae({giftCardCode:e.giftCardCode}),title:"Pay for your takeaway"}),(0,k.jsxs)(u.Sheet,{visible:!!oe,onClose:()=>K(null),title:"Allergy override",children:[re?(0,k.jsx)(u.Banner,{kind:"danger",title:`${re.name} contains ${re.contains.map(c.allergenLabel).join(', ')}`,children:"Only continue if this item is for someone without this allergy, or you have spoken to staff."}):null,(0,k.jsx)(u.Toggle,{label:"I understand and want to add it anyway",value:Q,onChange:J}),(0,k.jsx)(u.Button,{kind:"danger",disabled:!Q,label:"Confirm override",onPress:()=>{oe&&re&&T(oe.key,re.contains),K(null)}})]}),(0,k.jsx)(a.Honeypot,{value:R,onChange:z})]})}},1269,[829,30,34,1191,995,102,1199,794,830,836,1104,827,848,800,840,833,25]); +__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=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"VENUE"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},1270,[30,34,102,1195,794,830,852,848,840,1222,5,25]); +__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)}})]})}},1271,[829,30,34,102,1199,1197,794,830,836,827,848,840,25]); +__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 y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},1272,[829,1204,30,34,102,794,830,836,827,848,853,25]); +__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]})}},1273,[30,34,846,25]); +__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}},1274,[806,30,34,794,848,5,1204,25]); +__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."})})}},1275,[30,34,794,1276,1131,1204,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1276,[796,829,34,102,794,830,836,1131,1277,848,840,25]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1277,[931,985,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1278,[30,34,846,1279,1334,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Pe}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:g,headerExtra:G,subHeader:Le,noVoice:We=!1}={}){const Oe=(0,P.default)(),Ve=g??Oe.width,Ue=Oe.height,Ke=Ve<700,qe=Ve>=Ue,Ye=!Ke&&qe&&Ve>=600,Qe=Ye,Je=Math.round(Math.min(520,Math.max(Ve>=1e3?448:280,.3*Ve))),Xe=S.default.useRef(null),Ze=S.default.useRef(0),[et,tt]=(0,v.useState)({w:0,h:0}),lt=(0,q.useOwner)(e=>e.site),st=(0,V.useRestaurant)(lt);(0,me.useAlertWatcher)(lt,{enabled:!e});const it=(0,V.useOrders)(lt),ot=(0,V.useBookings)(lt),nt=(0,V.useEvents)(lt),at=(0,V.useStore)(e=>e.skipMinutes),rt=(0,V.useStore)(e=>e.clock.mode),dt=(0,V.useNow)(5e3),ct=(0,q.useOwner)(e=>e.staff),ut=(0,q.useOwner)(e=>e.attendance),ht=(0,q.useOwner)(e=>e.shifts);S.default.useEffect(()=>{(0,Q.ensureAttendance)((0,F.ymd)(dt),dt)},[(0,F.ymd)(dt)]);const gt=ut.filter(e=>e.in&&!e.out&&dt.getTime()-new Date(e.in).getTime()<72e6&&dt.getTime()>=new Date(e.in).getTime()),bt=Ee(ct.find(e=>e.id===gt[0]?.staffId)?.name)||'Duty Manager';(0,k.useSoldOutLink)(!1,bt,!e);const yt=(0,F.ymd)(dt),pt=(0,T.useTravelDay)('display',yt),xt=(0,Y.useFrontDoor)(yt,qe),ft=(0,J.useDisplaySettings)(lt),mt=ft.privacy,jt=(0,ne.useSaverSync)(),wt=(0,J.usePlan)(lt),kt=(0,J.useFloor)(e=>e.live[lt]),It=(0,je.useBlocks)(e=>e.blocks),[Dt,vt]=(0,v.useState)('plan'),[St,Ct]=(0,v.useState)('all'),[Tt,$t]=(0,v.useState)(null),[Bt,Rt]=(0,v.useState)(null),[Lt,Wt]=(0,v.useState)(null),[zt,Mt]=(0,v.useState)(!1),[Ht,Pt]=(0,v.useState)(!1),[Et,At]=(0,v.useState)(null),[Ot,Nt]=(0,v.useState)(!1),[_t,Gt]=(0,v.useState)(!1),[Ft,Vt]=(0,v.useState)(null),[Ut,Kt]=(0,v.useState)(null),[qt,Yt]=(0,v.useState)(null),Qt=S.default.useRef(0),Jt=e=>{Qt.current=Date.now(),Yt(e)};S.default.useEffect(()=>{if(!qt)return;const e=setInterval(()=>{Date.now()-Qt.current>=De.DAY_IDLE_MS&&Yt(null)},5e3);return()=>clearInterval(e)},[qt]);const Xt=(0,V.useWaitlist)(lt),Zt=(0,V.useStore)(e=>e.walkIns[lt]??0),[el,tl]=(0,v.useState)(!1),[ll,sl]=(0,v.useState)(!1),[il,ol]=(0,v.useState)(!1);(0,N.useReviewAlerts)(lt);const[nl,al]=(0,v.useState)({view:0,content:0}),[rl,dl]=(0,v.useState)(null);S.default.useEffect(()=>{rl&&((0,I.notify)({id:`floor-note:${Date.now()}`,title:rl,timeoutMs:4500,big:!0,testID:'floor-toast'}),dl(null))},[rl]),S.default.useEffect(()=>{if(!e)return(0,$.setDisplaySilent)(!0),()=>(0,$.setDisplaySilent)(!1)},[e]);const[cl,ul]=(0,v.useState)(null),hl=S.default.useRef(0),[gl,bl]=(0,v.useState)(null);S.default.useEffect(()=>{if(!cl)return;hl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-hl.current;if(e>=Pe)return ul(null),void dl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');bl(e>=105e3?Math.ceil((Pe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[cl]);const yl=e=>e.date!==yt?Wt({title:`Guest details \xb7 ${(0,De.dayWord)(e.date,yt)} ${e.time}`,body:(0,He.jsx)(He.Fragment,{children:(0,ye.bookingDetails)(e)})}):Wt({title:`Guest details \xb7 ${e.time}`,body:(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Fe,{rid:lt,id:e.id,turnBase:st.settings.turnMins}),e.walkIn?null:(0,He.jsx)(A.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Wt(null),At(e.id)},style:{minHeight:56}}),e.walkIn?(0,He.jsx)(ue.CancelWalkInButton,{rid:lt,b:e,big:!0,onDone:e=>{Wt(null),dl(e)}}):null,e.walkIn?(0,He.jsx)(ue.ReinstateWalkInButton,{rid:lt,b:e,today:yt,onDone:e=>{Wt(null),dl(e)}}):null,(0,ye.bookingDetails)(e)]})}),pl=ot.filter(e=>e.date===yt).sort((e,t)=>e.time.localeCompare(t.time)),xl=pl.filter(e=>!['cancelled','noshow'].includes(e.status)),fl=it.filter(Ae).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),ml=(0,v.useMemo)(()=>(0,d.forecastToday)(st,ot,it,nt,dt),[st,ot,it,nt,dt.getTime()/6e4|0]),jl=(0,je.closedAreasAt)(It,lt,yt,(0,F.hm)(dt)),wl=[...jl].join(','),kl=(0,v.useMemo)(()=>(0,X.floorView)(wt,ot,it,kt??{},dt,st.settings.turnMins,jl),[wt,ot,it,kt,dt.getTime(),wl]),Il=(0,be.hoursFor)(st,dt),Dl=Il?.open??new Date(`${yt}T12:00:00`),vl=Il?.close??new Date(`${yt}T21:00:00`),Sl=(0,F.addMins)(Dl,-Dl.getMinutes()),Cl=(0,F.addMins)(vl,90),Tl=e=>new Date(`${yt}T${e}:00`),$l=(0,je.blocksOn)(It,lt,yt).map(e=>({from:Tl(e.from),to:Tl(e.to),label:e.reason??'Paused'})).concat((0,i.queuedServicePauses)(st,dt,yt)),Bl=Object.keys(kl).filter(e=>'blocked'===kl[e]?.status),Rl=qt&&qt!==yt?qt:yt,Ll=Rl!==yt,Wl=(0,De.dayWord)(Rl,yt),zl=/^(Today|Yesterday|Tomorrow)$/.test(Wl),Ml=Ll?(0,De.bookingsForDay)(ot,Rl,yt).sort((e,t)=>e.time.localeCompare(t.time)):pl,Hl=(0,F.parseYmd)(Rl);Hl.setHours(12);const Pl=Ll?(0,be.hoursFor)(st,Hl):Il,El=Pl?.open??new Date(`${Rl}T12:00:00`),Al=Pl?.close??new Date(`${Rl}T21:00:00`),Ol=e=>new Date(`${Rl}T${e}:00`),Nl=[...Ll?(0,je.blocksOn)(It,lt,Rl).map(e=>({from:Ol(e.from),to:Ol(e.to),label:e.reason??'Paused'})):$l,...Ll?(0,i.queuedServicePauses)(st,Hl,Rl):[]],_l=(0,i.queuedServiceSessions)(st,Hl),Gl=l.IS_QUEUED_VENUE&&(void 0===_l||!_l.length),Fl=(0,He.jsxs)(H.default,{testID:"queued-hours-gate",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:void 0===_l?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,He.jsx)(A.Muted,{children:s.queuedVenues[lt]?.hours.note})]}),Vl=Ll?Pl||Ml.length?RlLl?(0,X.dayFloorView)(wt,Ml,Rl):kl,[Ll,wt,Ml,Rl,kl]),[Kl,ql]=(0,v.useState)(null),Yl=Ll?Ml.filter(e=>!['cancelled','noshow'].includes(e.status)):xl,Ql=Yl.reduce((e,t)=>e+t.partySize,0),Jl=(0,c.coversSplit)(Yl,Rl),Xl=(0,ve.cancelledDayTally)(ot,Rl),Zl=(0,Se.cancellationsFor)(ot,Rl,e=>e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)','')),es=(0,ve.cancelledTallyWords)(Xl,zl?Wl.toLowerCase():Ll?`on ${Wl}`:'today'),ts=It.filter(e=>e.rid===lt&&e.date===Rl&&!e.removedAt),ls=(0,Ie.chartBands)(ts,60*El.getHours()+El.getMinutes(),60*Al.getHours()+Al.getMinutes()),ss=new Set((0,Ie.blockedHours)(ls)),is=dt.getHours()+(dt.getMinutes()>=30?1:0),os=ml.hours.filter(e=>e.hour>=is&&!ss.has(e.hour)),ns=os.reduce((e,t)=>e+t.coversHigh,0),as=os.reduce((e,t)=>e+t.coversLow,0),rs=Math.round((as+ns)/2),ds=!ml.example&&ml.open&&ml.enough&&ns>0?`Usually ${(0,d.coversRange)(rs,rs)} more`:void 0,cs=async(e,t)=>{const l=kl[e]?.booking;if(!l||e===t)return;const s=kl[t]?.status;if(s&&!['free','soon'].includes(s))return void dl('dirty'===s?`${(0,r.tableNumbers)(t)} needs clearing first.`:`${(0,r.tableNumbers)(t)} is ${X.STATUS[s].label.toLowerCase()}. Pick a free table.`);await V.repo.bookings.update(l.id,{table:t});const i=kt?.[e]?.stage;J.useFloor.getState().setLive(lt,t,{stage:i??'seated',dirty:!1}),J.useFloor.getState().setLive(lt,e,{stage:void 0,dirty:!0}),dl(`${(0,ae.privName)(l,mt)} moved ${(0,r.tableNumbers)(e)} \u2192 ${t}. ${(0,r.tableNumbers)(e)} needs clearing.`)},us=Ut?ot.find(e=>e.id===Ut.id):void 0,hs=Ut&&us?(()=>{const e=us.walkIn?(0,ae.privName)(us,mt):Ee(us.name),t=(0,ge.seatsOf)(wt,Ut.tables).total,l=(0,ge.seatLine)(t,us.partySize),s=(0,ge.pickClashes)(us,Ut.tables,ot.filter(e=>e.date===us.date),st.settings.turnMins),i=(0,ge.tableKey)(Ut.tables)!==(0,ge.tableKey)((0,J.tablesOf)(us.table));return(0,He.jsxs)(H.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:U.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,padding:10},children:[(0,He.jsxs)(H.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,De.dayWord)(us.date,yt)} ${us.time}. Tap tables on the plan to add or take them off. ${(0,ge.tablesWords)(Ut.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,De.dayWord)(us.date,yt)," ",us.time]}),(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[(0,ge.tablesWords)(Ut.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,r.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,He.jsxs)(A.Row,{gap:8,wrap:!0,children:[(0,He.jsx)(A.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,ge.tablesWords)(Ut.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(us){try{await(0,he.saveBookingTables)(lt,us,Ut.tables),dl((0,ge.savedWords)(e,us.partySize,Ut.tables,t))}catch(t){dl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}Kt(null)}else Kt(null)}}),(0,He.jsx)(A.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>Kt(null)})]})]})})():null,gs=wt.areas.filter(e=>wt.tables.some(t=>t.areaId===e.id)),bs=e=>{const t=wt.tables.filter(t=>t.areaId===e);return Ll?`${t.filter(e=>!Ul[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(kl[e.name]?.status??'free')).length}/${t.length} free`},ys='all'===St||gs.some(e=>e.id===St)?St:'all',ps=e=>(0,He.jsx)(Z.FloorCanvas,{plan:wt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:Ye,big:!0,view:Ul,privacy:mt,turnBase:st.settings.turnMins,highlight:Ut?Ut.tables:Bt?[Bt]:void 0,onTap:e=>{return t=e.name,void(Ut?Kt(e=>e?{...e,tables:(0,ge.toggleTable)(e.tables,t)}:e):Ll?ql(t):Bt?(t!==Bt&&cs(Bt,t),Rt(null)):$t(t));var t},onDrop:(e,t)=>Ut||Ll?void 0:cs(e.name,t.name)}),xs=Ke?1:qe||gs.length>2?2:1,fs=e=>{const t=wt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},ms=[];for(let e=0;e{const t=(0,Z.areaBounds)(wt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,Z.minReadableScale)(wt,e.id)}}),et.w,et.h):null,ws=e=>(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',height:ee.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:bs(e.id)})]}),ks=(0,He.jsx)(H.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-et.w)>1||Math.abs(l-et.h)>1)&&tt({w:t,h:l})},children:js?(0,He.jsx)(M.default,{style:{flex:1},scrollEnabled:js.scroll,showsVerticalScrollIndicator:js.scroll,contentContainerStyle:{gap:ee.GRID_GAP},children:js.rows.map((e,t)=>(0,He.jsx)(H.default,{style:{height:js.rowHeights[t],flexDirection:'row',gap:ee.GRID_GAP},children:e.map(e=>{const t=gs.find(t=>t.id===e);return(0,He.jsxs)(H.default,{testID:`area-cell-${e}`,style:{width:js.cellW,gap:2},children:[ws(t),(0,He.jsx)(H.default,{style:{flex:1},children:ps(e)})]},e)})},t))}):null}),Is=(0,He.jsxs)(H.default,{testID:"venue-plan",style:{flex:Ke?void 0:1,gap:10,minWidth:0},children:[(0,He.jsx)(a.TableNumberWarning,{plan:wt}),wt.tables.length?null:(0,He.jsxs)(H.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,He.jsx)(A.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,He.jsx)(A.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,He.jsx)(A.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?n.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?n.KIRKMICHAEL_GUIDE:n.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,He.jsx)(_e,{chipId:"all",compact:!Ke,label:"Whole venue",selected:'all'===ys,onPress:()=>Ct('all')},"__all"),...gs.map(e=>(0,He.jsx)(_e,{chipId:e.id,compact:!Ke,label:`${e.name}${(0,te.areaMarks)(e)}`,colour:(0,U.brandColour)(e.colour),sub:Ke?jl.has(e.id)?'closed':ys===e.id?bs(e.id):void 0:void 0,selected:ys===e.id,onPress:()=>Ct(e.id)},e.id))];return Ke?(0,He.jsx)(H.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,He.jsx)(M.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;al(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>al(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:nl.view>0&&nl.content>0&&nl.content<=nl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:nl.view>0&&nl.content<=nl.view+1?'100%':void 0},children:e})})(),(0,He.jsx)(h.FloorLegend,{}),hs,Bt?(0,He.jsxs)(A.Row,{gap:8,style:{backgroundColor:U.colours.goldTint,borderRadius:10,padding:8},children:[(0,He.jsxs)(A.T,{weight:"semibold",colour:U.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,r.tableNumbers)(Bt),": tap the new table."]}),(0,He.jsx)(A.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Rt(null)})]}):null,'all'===ys&&Ye?ks:'all'===ys?(0,He.jsx)(H.default,{style:{flex:Ke?void 0:1,gap:12,minHeight:Qe?void 0:360},children:ms.map((e,t)=>(0,He.jsxs)(H.default,{style:{flex:Ke?void 0:Math.max(.3,...e.map(e=>fs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,He.jsxs)(H.default,{style:{flex:1,gap:2},children:[Ke?(0,He.jsxs)(H.default,{style:{alignItems:'center',gap:4},children:[(0,He.jsxs)(A.T,{center:!0,size:18,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{center:!0,size:14,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{center:!0,children:bs(e.id)})]}):(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:(0,U.brandColour)(e.colour),children:[e.name,(0,te.areaMarks)(e)]}),jl.has(e.id)?(0,He.jsx)(A.T,{size:13,weight:"semibold",colour:U.colours.blue,children:"Closed for weather"}):(0,He.jsx)(A.Muted,{children:bs(e.id)})]}),(0,He.jsx)(H.default,{style:Ke?{height:Math.max(280,Math.round((Ve-40)*fs(e.id)))}:{flex:1},children:ps(e.id)})]},e.id)),e.length{if(Ll)return void Vt(e.id);const t=(0,J.tablesOf)(e.table)[0];t&&kl[t]?$t(t):yl(e)}},Rl)}),vs='timeline'===Dt,Ss=Ll?(0,He.jsxs)(H.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:U.colours.gold,backgroundColor:U.colours.goldTint},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:zl?`Showing ${Wl} \xb7 ${(0,F.niceDate)((0,F.parseYmd)(Rl))}`:`Showing ${(0,De.dayWord)(Rl,yt)}`}),(0,He.jsx)(H.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${es}. Showing ${(0,De.dayLong)(Rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,He.jsx)(A.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{Kt(null),Jt(null)},style:{minHeight:44}})]}):null,Cs=(0,He.jsx)(H.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:Ke?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===vs;return(0,He.jsx)(z.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},onPress:()=>vt(e),style:{flex:Ke?1:void 0,minHeight:Ke?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?U.colours.gold:'transparent',...$e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,He.jsx)(A.T,{size:Ke?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Ts=(0,u.useBookingWrite)(),$s=e=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Be.BigAction,{premium:!0,label:"Walk-in",onPress:xt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"New booking",onPress:xt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint}),(0,He.jsx)(Be.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Pt(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ts.ok,accessibilityHint:Ts.hint})]});(0,Me.useDisplayNotices)(lt,!e);const Bs=Ke?180:168,[Rs,Ls]=(0,v.useState)(Bs),Ws=S.default.useRef(Bs),zs=S.default.useRef(null),Ms=S.default.useRef(null),Hs=()=>{const e=zs.current,t=Ms.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Ue<820?8:12,o=44+(Ue<820?4:8),n=i>Ws.current?Math.ceil(i-Ws.current):ke.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Bs,Math.floor(t-s-l)-n-o));Math.abs(Ws.current-a)>=2&&(Ws.current=a,Ls(a))})})};S.default.useEffect(()=>{const e=setTimeout(Hs,60);return()=>clearTimeout(e)},[Ve,Ue]);const Ps=(0,He.jsxs)(H.default,{ref:Ms,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Hs()},style:{flexDirection:'row',flexWrap:Ve>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ke?12:6,justifyContent:Ke?'center':void 0,borderTopWidth:1,borderTopColor:U.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,He.jsx)(ze.DisplayClockButton,{}),(0,He.jsx)(se.HoldToEdit,{quiet:!0,onUnlock:()=>{bl(null),ul({at:Date.now()})},onHint:()=>dl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,He.jsx)(we.BlockBookingsButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,display:!0,day:Rl}),wt.areas.some(e=>e.outdoor)?(0,He.jsx)(we.CloseGardenButton,{rid:lt,r:st,now:dt,by:bt,quiet:!0,short:!0}):null,(0,He.jsx)(z.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>ol(!0),style:({pressed:e})=>({...$e.look.quiet(e),flexGrow:1}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),(0,He.jsx)(p.GiftQrButton,{rid:lt,venue:st.name})]}),Es=fl.length?(0,He.jsxs)(H.default,{testID:"takeaway-panel",style:[$e.look.panel,{overflow:'hidden'}],children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,He.jsx)(A.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,He.jsxs)(A.T,{size:12,colour:U.colours.muted,children:[fl.length," live"]})]}),(0,He.jsx)(H.default,{style:{padding:10},children:(0,He.jsx)(Ge,{list:fl,me:bt,compact:!0,bookings:ot})})]}):null,As=(Te.DueToday,Ll?Ml:pl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Os=Ll?zl?`${Wl}\u2019s guests`:`Guests ${Wl}`:'Today\u2019s guests',Ns=(0,He.jsxs)(He.Fragment,{children:[0===As.length?(0,He.jsx)(A.Muted,{children:Ll?Rl{const t=(0,K.isSeatedHighlight)(e.status,{otherDay:Ll}),l=(0,re.guestRowText)(e,{name:e.walkIn?(0,ae.privName)(e,mt):(e.name??'').replace(' (example)',''),seated:t}),s=t?K.SEATED_FG:U.colours.text,i=t?K.SEATED_MUTED:U.colours.muted,o=t?K.SEATED_FG:U.colours.gold,n=l.depositWarn?U.colours.amber:t?K.SEATED_FG:U.colours.goldLight;return(0,He.jsxs)(z.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Ll?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Gt(!1),Vt(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,K.seatedHighlightStyle)({backgroundColor:e?U.colours.goldLight:U.colours.gold,borderBottomWidth:1})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:U.colours.hairline,backgroundColor:e?U.colours.tilePressed:'transparent'},children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,He.jsx)(A.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,He.jsx)(H.default,{style:{paddingTop:2},children:(0,He.jsx)(L.AllergyIcon,{text:l.allergy,size:22,colour:t?'#7A4A00':U.colours.amber,ink:t?U.colours.gold:U.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,He.jsxs)(A.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:16,colour:s,children:l.people}),l.deposit?(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,He.jsx)(A.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,He.jsx)(A.T,{size:16,colour:i,children:" \xb7 "}),(0,He.jsx)(A.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,He.jsx)(A.T,{size:16,children:" "}):null,l.dog?(0,He.jsx)(H.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,He.jsx)(de.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,He.jsx)(Ce.CancellationsSection,{items:Zl,dayWord:Ll?zl?Wl.toLowerCase():`on ${Wl}`:'today'})]}),_s=(0,He.jsx)(M.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ns}),Gs=W.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Gt(!1)}}),Fs=(0,He.jsxs)(z.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Os}, ${As.length}`,accessibilityState:{expanded:_t},'aria-expanded':_t,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Gt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:_t?U.colours.gold:U.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?U.colours.tilePressed:_t?U.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,He.jsx)(A.T,{size:16,weight:"bold",colour:U.colours.gold,children:As.length}),(0,He.jsx)(H.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(H.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,He.jsxs)(A.T,{size:13,weight:"semibold",colour:U.colours.goldLight,numberOfLines:1,children:[Os," ",_t?'\u2039':'\u203a']})})})]}),Vs=_t?(0,He.jsxs)(H.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,He.jsxs)(H.default,{testID:"guests-drawer",...Gs.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Ve)),backgroundColor:U.colours.surface,borderRightWidth:1,borderColor:U.colours.gold,borderRadius:14,...$e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,He.jsxs)(A.T,{size:17,weight:"semibold",colour:U.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Os.toUpperCase()," (",As.length,")"]}),Xl.count?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,style:{width:'100%'},testID:"cancelled-day-tally-guests",children:es}):null,(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Os}`,onPress:()=>Gt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:18,colour:U.colours.muted,children:"\u2715"})})]}),_s]}),(0,He.jsx)(z.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Os}`,accessibilityRole:"button",onPress:()=>Gt(!1),style:{flex:1}})]}):null,Us=Gl?Fl:l.IS_KIRKTON&&!Object.values(st.kitchenHours??{}).some(Boolean)?(0,He.jsxs)(H.default,{testID:"kirkton-hours-to-confirm",style:[$e.look.panel,{padding:14,gap:8}],children:[(0,He.jsx)(A.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,He.jsx)(A.Muted,{children:"No service hours have been set for this venue."})]}):(0,He.jsx)(ke.DayGraph,{busyThreshold:(0,t.venueBusy)(st,ot,dt).busy,todays:Ml,open:El,close:Al,now:dt,turnBase:st.settings.turnMins,blocks:ts,pauses:Nl,compact:Ke,dense:!Ke,height:Ye?Rs:Bs,forecastNote:Ll?void 0:ds,emptyText:Vl,past:Rl{Ll?Gt(!0):vt('timeline')},Qs=(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',padding:Ue<820?8:12,paddingTop:Ue<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[pt?null:Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pt?null:Ss,pt?(0,He.jsx)(M.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"})}):vs?Ds:Is,Vs]}),(0,He.jsxs)(H.default,{testID:"display-side",style:{width:Je,gap:Ue<820?4:8,minHeight:0},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:$s(!1)}),(0,He.jsx)(H.default,{style:{flexShrink:0},children:Cs}),pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:Ue<820,snug:Ue<820,tight:Ue<700,aside:`${Yl.length} ${1===Yl.length?'table':'tables'} booked${fl.length?` \xb7 ${fl.length} takeaway`:''}`,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{ref:zs,testID:"day-graph-slot",onLayout:Hs,style:{flexGrow:0,flexShrink:0,overflow:'visible'},children:Ks}),(0,He.jsxs)(M.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,He.jsx)(z.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,He.jsx)(A.T,{center:!0,weight:"semibold",children:"Reviews"})}),Es,(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt})]})]})]});return(0,He.jsxs)(E.SafeAreaView,{style:{flex:1,backgroundColor:U.colours.bg},onTouchStart:()=>{Qt.current=Date.now()},onMouseDown:()=>{Qt.current=Date.now()},children:[Ke?(0,He.jsxs)(H.default,{style:{flex:1},children:[(0,He.jsxs)(M.default,{ref:Xe,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,He.jsx)(H.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,He.jsx)(f.ExitButton,{})}),(0,He.jsx)(_.RestaurantLogo,{rid:lt,size:64}),(0,He.jsx)(A.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:st.name}),(0,He.jsx)(_.PoweredBy,{}),(0,He.jsx)(D.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,He.jsx)(H.default,{accessible:!0,accessibilityLabel:`Current time ${(0,F.hm)(dt)}`,children:(0,He.jsx)(A.T,{center:!0,size:30,weight:"semibold",colour:U.colours.goldLight,children:(0,F.hm)(dt)})}),(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:"m"}),(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:"m"}),G]}),Le,qs,(0,He.jsx)(H.default,{testID:"phone-glance",style:{width:'100%'},children:(0,He.jsx)(Ne,{phone:!0,split:Jl,items:[{label:`Tables \xb7 ${Wl}`,value:Yl.length,testID:'badge-tables'},{label:`Covers \xb7 ${Wl}`,value:Ql,testID:'badge-covers'},{label:'Takeaway',value:fl.length,alert:fl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Mt(!0)}]})}),(0,He.jsx)(H.default,{testID:"primary-actions",style:{gap:8},children:$s(!0)}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),Cs,(0,He.jsx)(H.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:vs?Ds:Is}),(0,He.jsxs)(H.default,{onLayout:e=>{Ze.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[$e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,He.jsxs)(A.T,{center:!0,size:20,weight:"semibold",colour:U.colours.goldLight,accessibilityRole:"header",children:[Os," (",As.length,")"]}),(0,He.jsx)(H.default,{testID:"display-guest-list",accessibilityLabel:Os,style:{gap:4},children:Ns})]}),Es,Ks,(0,He.jsx)(H.default,{testID:"covers-dock",children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,compact:!0,sound:(0,$.flapSoundOn)(),onPress:()=>Xe.current?.scrollTo({y:Ze.current,animated:!0})})}),(0,He.jsxs)(H.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,He.jsx)(A.T,{center:!0,size:14,colour:mt?U.colours.muted:U.colours.amber,children:mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,He.jsx)(A.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,He.jsx)(A.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>sl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ps]}),e?null:(0,He.jsx)(H.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:U.colours.hairline},children:(0,He.jsx)(R.VoiceSlot,{size:56})})]}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Ve>=1e3?18:14,paddingVertical:Ue<820?4:8,gap:8,minHeight:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...$e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,He.jsx)(H.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,He.jsx)(_.RestaurantBrand,{rid:st.id,size:Ve<900?32:40,beside:!0})}),(0,He.jsxs)(H.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,He.jsx)(A.T,{size:Ve<900?18:21,weight:"semibold",colour:U.colours.goldLight,style:{letterSpacing:.4,lineHeight:26},children:(0,F.hm)(dt)}),Ve>=900?(0,He.jsx)(A.T,{size:13,colour:U.colours.muted,children:(0,F.niceDate)(dt)}):null]})]}),pt?(0,He.jsx)(H.default,{style:{width:220}}):(0,He.jsx)(H.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:qs}),(0,He.jsxs)(H.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,He.jsx)(Re.ShellfishChip,{rid:lt,by:bt,app:"display",size:Ve<900?'xs':Ve<1100||Ue<700?'s':'m'}),(0,He.jsx)(z.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>tl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,He.jsx)(A.T,{size:15,weight:"semibold",colour:U.colours.muted,children:"?"})}),'simulated'===rt?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>at(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,He.jsx)(A.T,{size:11,colour:U.colours.muted,children:"+15"})}):null,e?null:(0,He.jsx)(f.ExitButton,{}),G,We?null:(0,He.jsx)(R.VoiceSlot,{size:44})]})]}),Le,pt?null:(0,He.jsxs)(H.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,He.jsx)(Ne,{splitOnly:!0,split:Jl,items:[]}),(0,He.jsx)(H.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Ve>=1e3?18:14)+(e?0:52)+('simulated'===rt?52:0),zIndex:4},children:(0,He.jsx)(Re.SundayRoastChip,{rid:lt,by:bt,app:"display",size:Ve<1100||Ue<700?'s':'m'})})]}),Ye?Qs:(Js=(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{testID:"front-door-bar",style:{gap:10},children:[(0,He.jsx)(H.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:$s(!1)}),Cs]}),(0,He.jsx)(we.BlocksBanner,{rid:lt,now:dt,big:!0,by:bt}),pt?(0,He.jsx)(T.DayView,{rid:lt,day:pt,today:yt,app:"display"}):(0,He.jsx)(He.Fragment,{children:(0,He.jsxs)(H.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Fs,(0,He.jsxs)(H.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Ss,vs?Ds:Is,Vs]})]})}),Es,pt?null:(0,He.jsx)(H.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,He.jsx)(C.CoversToday,{rid:lt,day:Rl,sound:(0,$.flapSoundOn)(),onPress:Ys})}),pt?null:(0,He.jsx)(H.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Bs+ke.DAY_GRAPH_CHROME},children:Ks})]}),(0,He.jsx)(M.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Js})),Ps]}),(0,He.jsx)(j.SoldOutStrip,{rid:lt,by:bt,onOpen:()=>ol(!0)}),(0,He.jsx)(w.SoldOutSheet,{visible:il,onClose:()=>ol(!1),rid:lt,by:bt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,He.jsx)(y.TableOrderCue,{rid:lt}),xt.elements,Ht?(0,He.jsx)(b.EditBookingPicker,{rid:lt,today:yt,who:bt,hidePrivate:!0,onClose:()=>Pt(!1)}):null,Et?(0,He.jsx)(b.EditBookingSheet,{rid:lt,id:Et,who:bt,hidePrivate:!0,onClose:()=>At(null)}):null,Tt?(0,He.jsx)(ye.TableSheet,{rid:lt,name:Tt,view:kl,plan:wt,todays:pl,now:dt,privacy:mt,turnBase:st.settings.turnMins,onClose:()=>$t(null),onWalkIn:e=>xt.openWalkInAt(e),onMove:e=>Rt(e),onDetails:yl}):null,Kl?(()=>{const e=Ul[Kl],t=e?.dayBookings??[];return(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>ql(null),title:`${(0,r.tableNumbers)(Kl)} \xb7 ${zl?Wl:(0,De.dayLong)(Rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,He.jsxs)(A.T,{size:16,colour:U.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${zl?Wl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${zl?Wl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ae.privName)(e,mt):Ee(e.name);return(0,He.jsx)(A.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ge.tablesWords)((0,J.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ql(null),Vt(e.id)},style:{minHeight:56}},e.id)}),(0,He.jsx)(A.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ql(null),style:{minHeight:56}})]})})():null,Ft?(()=>{const e=ot.find(e=>e.id===Ft);return e?(0,He.jsx)(ce.GuestActionsSheet,{rid:lt,b:e,name:e.walkIn?(0,ae.privName)(e,mt):Ee(e.name),view:kl,now:dt,otherDay:e.date!==yt,turnBase:st.settings.turnMins,onClose:()=>Vt(null),onDetails:yl,onDone:dl,onPickOnPlan:(e,t)=>{Gt(!1),vt('plan'),Ct('all'),Kt({id:e.id,tables:t})}}):null})():null,Lt?(0,He.jsx)(ye.DetailsPanel,{title:Lt.title,onClose:()=>Wt(null),children:Lt.body}):null,Ot?(0,He.jsx)(ye.ServiceSummary,{r:st,todays:pl,orders:it,waitlistAll:Xt,walkInCount:Zt,onClose:()=>Nt(!1)}):null,el?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>tl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,He.jsx)(h.FloorLegend,{}),(0,He.jsx)(A.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>tl(!1)})]}):null,ll?(0,He.jsxs)(A.Sheet,{visible:!0,onClose:()=>sl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,He.jsx)(O.ReviewsSection,{rid:lt,mode:"read",venueName:st.name}),(0,He.jsx)(A.Button,{kind:"secondary",label:"Close",onPress:()=>sl(!1)})]}):null,zt?(0,He.jsxs)(ye.DetailsPanel,{title:"Takeaway",onClose:()=>Mt(!1),children:[(0,He.jsx)(A.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,He.jsx)(Ge,{list:fl,me:bt,bookings:ot})]}):null,cl?(0,He.jsx)(H.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:U.colours.bg},children:(0,He.jsx)(le.PlanDesigner,{initial:wt,venue:st.name,mode:"display",startStep:"arrange",onActivity:()=>{hl.current=Date.now(),null!==gl&&bl(null)},notice:null!==gl?`Locking again in ${gl} s \xb7 touch to keep editing`:null,onSave:e=>{J.useFloor.getState().setPlan(lt,e),ul(null),dl('Table plan saved. Editing is locked again.')},onCancel:()=>{ul(null),dl('No changes kept. Editing is locked again.')}},cl.at)}):null,e?null:(0,He.jsx)(oe.Screensaver,{rid:lt,idleMins:ft.idleMins,pinOn:ft.pinOn,wake:ft,tonightCards:ft.tonightCards,cfg:jt}),e?null:(0,He.jsx)(xe.PrintHost,{rid:lt}),e?null:(0,He.jsx)(pe.AlertHost,{variant:"display",rid:lt,skipTakeaway:!0}),e?null:(0,He.jsx)(B.SeatAllergenReminder,{rid:lt}),e?null:(0,He.jsx)(fe.TakeawayTakeover,{rid:lt,me:bt})]});var Js};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=e(v),C=_r(_d[24]),T=_r(_d[25]),$=_r(_d[26]),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=e(_r(_d[30])),z=e(_r(_d[31])),M=e(_r(_d[32])),H=e(_r(_d[33])),P=e(_r(_d[34])),E=_r(_d[35]),A=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]);const Pe=12e4,Ee=e=>(e??'').replace(' (example)',''),Ae=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Oe=e=>e.slotTime?(0,F.hm)(new Date(e.slotTime)):'ASAP';function Ne({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,He.jsxs)(H.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,He.jsx)(H.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,He.jsxs)(H.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,He.jsx)(A.T,{size:l?24:19,weight:"semibold",colour:e.alert?U.colours.amber:U.colours.text,children:e.value}),(0,He.jsx)(A.T,{size:l?14:12,colour:U.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,He.jsx)(z.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,He.jsx)(S.default.Fragment,{children:i},e.testID)})}),s?(0,He.jsx)(H.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,He.jsx)(A.T,{size:14,colour:U.colours.muted,children:"No Covers yet"}):(0,He.jsxs)(He.Fragment,{children:[(0,He.jsxs)(H.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",colour:U.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,He.jsx)(A.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,He.jsxs)(H.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:U.colours.gold},children:[(0,He.jsx)(H.default,{style:{width:`${s.walkInPct}%`,backgroundColor:U.colours.gold}}),(0,He.jsx)(H.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function _e({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,He.jsxs)(z.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,He.jsx)(H.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,He.jsx)(A.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?U.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,He.jsx)(A.T,{size:12,colour:U.colours.muted,children:l}):null]})}function Ge({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,We.statusBlock)(e,t,(0,We.linkedBooking)(e,s));return e.length?(0,He.jsx)(H.default,{style:{gap:8},children:e.map(e=>(0,He.jsxs)(H.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:U.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?U.colours.ok:e.allergies.length?U.colours.red:U.colours.gold},children:[(0,He.jsxs)(A.Row,{style:{justifyContent:'space-between'},children:[(0,He.jsxs)(A.T,{size:l?16:18,weight:"bold",children:[Oe(e)," \xb7 ",Ee(e.customerName)]}),(0,He.jsx)(A.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,He.jsxs)(A.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,He.jsxs)(A.T,{size:14,weight:"semibold",colour:U.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,He.jsx)(Le.AllergyChain,{o:e,me:t,compact:!0}):null,(0,He.jsxs)(A.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,He.jsx)(A.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>V.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,He.jsx)(A.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,He.jsx)(A.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>V.repo.orders.setStatus(e.id,'collected',t)}):null,(0,He.jsx)(xe.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,He.jsx)(A.Muted,{children:"No takeaway orders right now."})}function Fe({rid:e,id:t,turnBase:l}){const s=(0,V.useBookings)(e).find(e=>e.id===t);return s?(0,He.jsx)(g.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1279,[1121,5,6,1280,798,822,1094,829,1120,1281,1282,1283,1091,1115,1284,1285,1287,1288,1289,1130,977,1099,1290,34,1073,1148,1033,1087,1116,1291,380,402,295,102,426,36,794,1182,1186,847,830,827,848,840,1090,865,1096,1100,1014,1079,1108,1292,1107,1293,1296,1298,1301,1304,1300,1305,1307,1308,1112,1093,1095,852,1310,1171,1311,1181,1173,1011,1316,1324,1326,1076,1114,1328,1329,1330,1143,1331,1142,1136,838,1332,1333,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1281,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1282,[1012,1100]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.FloorLegend=function({inline:e=!1}){return(0,s.jsx)(l.default,{testID:"floor-legend",accessible:!0,accessibilityLabel:`Table colours: ${c.map(([,e])=>e).join(', ')}`,style:{flexDirection:'row',flexWrap:e?'nowrap':'wrap',gap:e?8:14,alignItems:'center',justifyContent:'center',flexShrink:0},children:c.map(([t,c])=>(0,s.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:e?4:6},children:[(0,s.jsx)(l.default,{testID:`legend-swatch-${t}`,style:{width:e?12:16,height:e?12:16,borderRadius:4,backgroundColor:o.STATUS[t].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,s.jsx)(n.T,{size:e?12:13,center:!0,children:c})]},t))})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),s=r(d[4]);const c=[['free','Free'],['soon','Booked later'],['seated','Seated'],['dirty','Needs clearing']]},1283,[34,102,1079,794,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},1284,[829,34,102,794,848,1131,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},1285,[34,395,402,426,102,1226,794,1143,1014,1286,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1286,[]); +__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}))},1287,[815]); +__d(function(g,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,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:6,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,minHeight:44,minWidth:44,paddingHorizontal:8,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:12,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit?':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},1288,[798,34,379,395,402,102,794,1143,840,25]); +__d(function(g,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,"STRIP_FONT",{enumerable:!0,get:function(){return F}}),_e.SoldOutStrip=function({rid:e,now:w,by:O,onOpen:I}){const C=(0,h.useSoldOut)(e=>e.entries),z=(0,f.useStore)(e=>e.clock),[_,A]=(0,n.useState)(0),[H,L]=(0,n.useState)(!1),D=(0,y.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{$()},[]);const R=w??(0,p.nowFrom)(z),W=(0,b.activeSoldOut)(C,e,R);if(!W.length)return null;const E=W.map(e=>{const t=D.reason(e.itemId);return(0,x.withReason)(e.name,S.IS_CAR&&'none left'===t?'':t)}),M=(0,b.stripText)(E),P=_>0&&(0,b.stripNeedsTicker)(E,_,F),B=Math.round(.28*M.length);[20,30,40,50,60,80,100,120].find(e=>e>=B);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(l.default,{testID:"display-soldout-strip",dataSet:{centreExempt:'moving-ticker'},accessibilityRole:"button",accessibilityLabel:`Sold out: ${E.join(', ')}. Tap for the list.`,onPress:()=>I?I():L(!0),onLayout:e=>A(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:j.colours.accentBorder},children:[(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:j.colours.amber},children:["SOLD OUT",W.length>1?` \xb7 ${W.length}`:'']}),(0,T.jsx)(d.default,{style:{flex:1,minWidth:0,maxWidth:'100%',overflow:'hidden'},children:((e,t=!1)=>(0,T.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&k?{whiteSpace:'nowrap'}:{},fontFamily:j.fonts.medium,fontSize:F,lineHeight:20,color:j.colours.gold,paddingRight:48},children:M},e))('a')}),P&&!k?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:12,color:j.colours.muted},children:"Tap for all"}):null]}),I?null:(0,T.jsxs)(c.Sheet,{visible:H,onClose:()=>L(!1),title:(0,b.soldOutCount)(W.length),maxWidth:520,testID:"display-soldout-sheet",children:[O?(0,T.jsx)(u.SoldOutList,{rid:e,by:O,hideLinks:!0}):(0,T.jsx)(s.default,{style:{maxHeight:420},children:W.map(e=>(0,T.jsxs)(d.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.colours.border},children:[(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.semibold,fontSize:17,color:j.colours.text},children:e.name}),D.reason(e.itemId)?(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.medium,fontSize:14,color:j.colours.amber},children:D.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,T.jsxs)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted},children:["Since ",v(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${v(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,T.jsx)(o.Text,{style:{fontFamily:j.fonts.regular,fontSize:13,color:j.colours.muted,marginTop:8},children:"A reminder for staff. It doesn't change your till."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),d=e(r(_d[6])),c=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]),j=r(_d[16]),T=r(_d[17]);const k='undefined'!=typeof document,w=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let O=!1;function $(){if(!k||O)return;O=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=w,document.head.appendChild(e)}const v=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},F=15},1289,[798,796,34,236,402,295,102,794,1130,848,977,800,979,980,846,978,840,25]); +__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])},1290,[798,34,102,840,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},1291,[34,102,900,840,25]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},1292,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min Covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1293,[798,796,1094,829,1099,34,236,402,295,426,102,828,840,794,1294,1295,1014,865,1107,25]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},1294,[798,829,34,1295,102,828,840,794,1108,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1295,[828]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};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},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1296,[34,236,402,102,840,794,1143,1297,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},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,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),_e.Timeline=function({plan:e,bookings:k,now:T,privacy:C,onOpen:v,turnBase:S,t0:E,t1:z,height:D,pauses:I,blockedTables:R,hideNow:$,compact:L=!1}){const _=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),O=k.filter(e=>!['cancelled','noshow'].includes(e.status)),B=(0,r.useMemo)(()=>(0,c.clashes)(O,S),[O,S]),W=Math.max(1,Math.ceil((z.getTime()-E.getTime())/9e5)),[N,A]=(0,r.useState)(0),F=Math.min(W,Math.max(1,Math.floor(Math.max(30,N-w-2)/j))),[H,P]=(0,r.useState)(0),Y=Math.max(0,W-F),V=Math.max(0,Math.min(Y,H)),X=(0,h.addMins)(E,15*V),U=(0,h.addMins)(X,15*F),q=e=>(e.getTime()-X.getTime())/9e5*j,[G,J]=(0,r.useState)(null),K=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=$?0:Math.floor((T.getTime()-E.getTime())/9e5)-Math.floor(F/3);P(Math.max(0,Math.min(Y,e)))},[E.getTime(),F,Y,$]);const[Q,Z]=(0,r.useState)(''),[ee,te]=(0,r.useState)(null),oe=(0,r.useRef)(null);oe.current=ee,(0,r.useEffect)(()=>{if(!ee)return;const e=setTimeout(()=>te(null),s.ARM_MS);return()=>clearTimeout(e)},[ee]);const re=ee?O.find(e=>e.id===ee.id):void 0,ne=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(oe.current,e.id,Date.now()),onResponderGrant:e=>{K.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!K.current||!(0,s.isArmed)(oe.current,e.id,Date.now()))return;const r=o.nativeEvent.pageX-K.current.x,n=o.nativeEvent.pageY-K.current.y;(Math.abs(n)>=6||Math.abs(r)>=6)&&J({id:e.id,row:t,dy:n})},onResponderRelease:o=>{const r=K.current;K.current=null,J(null);const i=o.nativeEvent.pageX-(r?.x??0),l=o.nativeEvent.pageY-(r?.y??0),d=(0,s.releaseOn)(oe.current,e.id,!(Math.abs(i)<6&&Math.abs(l)<6),Date.now());if(te(d.arm),'select'===d.action){Z('');try{n.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void Z('');if('none'===d.action)return;Z('');const u=_.findIndex(e=>e.key===t),f=Math.max(0,Math.min(_.length-1,u+Math.round(l/M))),g=(0,b.dragTables)(e.table,t,_[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),Z(`${(0,y.privName)(e,C)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,h.hm)((0,c.startOf)(e))}`)):Math.abs(i)>=6&&Math.abs(l)<26&&Z('Times only change in Edit booking.')}}),ie=q(T);return(0,x.jsxs)(l.default,{style:{flex:1,gap:6},testID:"timeline",children:[L?(0,x.jsxs)(l.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,x.jsx)(l.default,{style:{alignSelf:'center'},children:(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'})}),(0,x.jsx)(p.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),Q?(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{center:!0,size:14,colour:g.colours.goldLight,children:Q})}):null]}):(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(p.Row,{gap:8,children:[(0,x.jsx)(p.Badge,{kind:B.size?'red':'ok',label:B.size?`${B.size} bookings clash`:'No clashes'}),(0,x.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,x.jsx)(p.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,x.jsx)(l.default,{testID:"clash-count",accessibilityLabel:`clashes ${B.size}`,children:(0,x.jsx)(p.T,{size:13,colour:g.colours.goldLight,children:Q})})]}),(0,x.jsxs)(p.T,{center:!0,testID:"timeline-window",children:[(0,h.hm)(X)," to ",(0,h.hm)(U)]}),W>F?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===V,onPress:()=>P(Math.max(0,V-F))}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:V>=Y,onPress:()=>P(Math.min(Y,V+F))})]}):null,I?.length?(0,x.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(l.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,x.jsx)(p.T,{size:14,children:"Blocked"})]}):null,(0,x.jsxs)(l.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-N)>1&&A(t)},style:{flex:D?void 0:1,height:D,flexShrink:L?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,x.jsxs)(i.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,x.jsxs)(l.default,{style:{width:w,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:[(0,x.jsx)(l.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:12,colour:g.colours.muted,children:"Table"})}),_.map((e,t)=>(0,x.jsxs)(l.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:M,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&_[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:[(0,x.jsx)(p.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&_[t-1].area===e.area?null:(0,x.jsx)(p.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,x.jsx)(l.default,{style:{width:F*j,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!oe.current,onResponderRelease:()=>{te(null),Z('')},children:(0,x.jsxs)(l.default,{style:{width:F*j},children:[(0,x.jsx)(l.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:g.colours.border},children:Array.from({length:Math.ceil(F/4)},(e,t)=>Math.min(4,F-4*t)*j<60?null:(0,x.jsx)(l.default,{style:{width:Math.min(4,F-4*t)*j,justifyContent:'center',borderLeftWidth:1,borderColor:g.colours.border},children:(0,x.jsx)(p.T,{size:11,colour:g.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,h.hm)((0,h.addMins)(X,60*t))})},t))}),(I??[]).map((e,t)=>{const o=Math.max(0,q(e.from)),r=Math.min(F*j,q(e.to));return r<=o?null:(0,x.jsx)(l.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,h.hm)(e.from)} to ${(0,h.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),_.map((e,r)=>{return(0,x.jsxs)(l.default,{testID:`tl-row-${e.key}`,style:{height:M,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&_[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(F/4)},(e,o)=>(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*j,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),R?.includes(e.key)?(0,x.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,x.jsx)(p.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,O.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)X)).map(t=>{const r=G?.id===t.id&&G.row===e.key?G:null,n=q((0,c.startOf)(t)),i=Math.max(0,Math.min(F*j-44,n)),a=Math.min(F*j,q((0,h.addMins)((0,c.startOf)(t),(0,c.durOf)(t,S)))),d=Math.min(F*j-i,Math.max(44,a-Math.max(0,n))),b=B.has(t.id),M=ee?.id===t.id;return(0,x.jsx)(l.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,y.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,h.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,S)} min${b?', clash':''}${(0,u.depositView)(t,!0)?`, ${(0,u.depositView)(t,!0).a11y}`:''}${M?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:M},accessibilityHint:M?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:M?'1':'0'},...ne(t,e.key),style:[{position:'absolute',left:i,top:4+(r?r.dy:0),width:d,height:44,borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:M?3:b?2.5:1,borderColor:M?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...M?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:r?40:M?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:M?'ns-resize':'pointer',touchAction:M?'none':'pan-y'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:d<100?String(t.partySize):(0,x.jsxs)(x.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,y.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,h.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,u.depositView)(t,!0)?d>=150?` \xb7 ${(0,u.depositView)(t,!0).label}`:'Deposit paid'===(0,u.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&ie>=0&&ie<=F*j?(0,x.jsx)(l.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:ie,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,x.jsx)(l.default,{style:{position:'absolute',top:0,left:Math.max(-ie,Math.min(-18,F*j-ie-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,x.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,h.hm)(T)})})}):null]})})]}),re?(0,x.jsx)(l.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,x.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,x.jsx)(l.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,y.privName)(re,C)} ${s.SELECTED_A11Y}`,children:(0,x.jsxs)(p.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,y.privName)(re,C)," \xb7 ",re.partySize]})}),(0,x.jsx)(p.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{te(null),v(re)}}),(0,x.jsx)(p.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{te(null),Z('')}})]})}):null]})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),l=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),y=_r(_d[17]),x=_r(_d[18]);const j=30,M=52,w=120},1298,[798,829,34,281,236,295,102,1109,848,1014,1079,14,827,1095,1299,840,794,1300,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1299,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1300,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1301,[5,798,34,283,336,236,402,102,426,840,847,794,1015,994,1287,1302,2,1303,1304,848,827,25]); +__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},1302,[236]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1304,[34,815,931,985,1303]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1305,[829,14,1014,1306]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.allergyLine=function(n){const o=(n.allergies??[]).map(n=>(0,l.allergenLabel)(n.allergen)).join(', '),a=n.allergyNote?.trim()??'';return o||a?[o,a].filter(Boolean).join(' \xb7 ')+(n.allergyPeople?` (${n.allergyPeople} ${1===n.allergyPeople?'person':'people'})`:''):null};var l=r(d[0])},1306,[830]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},1307,[34,102,900,840,25]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:B,name:D,view:S,now:P,onClose:I,onDetails:L,onDone:v,otherDay:N,turnBase:T=90,onPickOnPlan:W}){const[H,_]=(0,a.useState)(!1),z=(0,x.useBookingWrite)(),[M,A]=(0,a.useState)(!1),[G,O]=(0,a.useState)(!1),[F,R]=(0,a.useState)(!1),q=(0,y.guestRowText)(B,{name:D,seated:'seated'===B.status&&!N}),E='seated'===B.status&&!N,J=B.table?E?`Seated \xb7 ${(0,s.tableCardLabel)(B.table)}`:(0,s.tableCardLabel)(B.table):E?'Seated':'No table yet',K=N?[]:(0,u.guestActions)(B,D,S,P).filter(e=>'details'!==e.id),Q=(0,k.tableActions)(B,D),U={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},V=async t=>{const s={...B,table:t};t!==B.table&&await b.repo.bookings.update(B.id,{table:t}),await(0,c.seatBookingNow)(e,s),v(`${D} seated at ${(0,u.tableWords)(t)}.`),I()},X=async t=>'seat'===t.id&&t.table?V(t.table):'pick'===t.id?_(e=>!e):'details'===t.id?(I(),L(B)):'finished'===t.id?('seated'===B.status?await(0,c.finishBookingNow)(e,B):await b.repo.bookings.setStatus(B.id,'finished'),v('seated'===B.status&&B.table?`${D} finished. ${(0,u.tableWords)(B.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),I()):'noshow'===t.id?(await b.repo.bookings.setStatus(B.id,'noshow'),v(`${D} marked as a no-show.`),I()):void 0,Y=H?(0,u.freeTablesNow)(S,B.partySize).slice(0,8):[];if(M)return(0,C.jsx)(g.TablePicker,{rid:e,booking:B,name:D,turnBase:T,onClose:I,onSaved:v,onPickOnPlan:W?e=>{I(),W(B,e)}:void 0});if(G)return(0,C.jsx)(h.CancelWalkInConfirm,{rid:e,b:B,onClose:I,onDone:v});if(F)return(0,C.jsx)(f.CancelBookingConfirm,{rid:e,b:B,name:D,onClose:I,onDone:v});const Z=[...K];return(0,C.jsxs)(o.Sheet,{visible:!0,onClose:I,title:`${B.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(n.default,{accessible:!0,accessibilityLabel:q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(o.T,{size:18,children:[q.people,q.deposit?(0,C.jsxs)(o.T,{size:18,weight:"semibold",colour:q.depositWarn?$.colours.amber:$.colours.goldLight,children:[" \xb7 ",q.deposit]}):null," \xb7 ",J]})}),(0,C.jsxs)(n.default,{style:{gap:10},children:[Z.map(e=>(0,C.jsxs)(l.default.Fragment,{children:[(0,C.jsx)(o.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:z.hint,disabled:'details'!==e.id&&!z.ok,testID:`guest-act-${e.id}`,onPress:()=>X(e),style:j}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(o.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&H?(0,C.jsxs)(n.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Y.length?(0,C.jsx)(o.Muted,{children:"No free tables right now."}):null,Y.map(e=>(0,C.jsx)(o.Button,{kind:"secondary",label:`${(0,t.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-pick-${e.table}`,onPress:()=>V(e.table),style:j},e.table))]}):null]},e.id)),Q.map(t=>(0,C.jsx)(o.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:z.hint,disabled:!z.ok,testID:`guest-act-${t.id}`,style:j,onPress:async()=>{if(z.ok){if('assign'===t.id)return A(!0);await(0,g.saveBookingTables)(e,B,[]),v(`${D}: table taken off.`),I()}}},t.id)),!N&&(0,h.canCancelWalkIn)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${B.ref}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelwalkin",onPress:()=>O(!0),style:j}):null,(0,p.canCancelBooking)(B)?(0,C.jsx)(o.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${B.time}, ${B.partySize} Covers`,accessibilityHint:z.hint,disabled:!z.ok,testID:"guest-act-cancelbooking",onPress:()=>R(!0),style:j}):null,(0,C.jsx)(o.Button,{kind:"ghost",label:U.label,accessibilityLabel:U.a11y,testID:"guest-act-details",onPress:()=>X(U),style:j})]}),(0,C.jsx)(o.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:I,style:j})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=e(a),n=e(r(d[3])),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),C=r(d[16]);const j={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1308,[829,1014,34,102,794,1096,848,1309,1305,1095,1093,1112,1113,1114,840,1282,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1309,[1014,1079]); +__d(function(g,_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,"Card",{enumerable:!0,get:function(){return C}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,r.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,$.jsxs)(h.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,$.jsxs)(b.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,$.jsx)(m.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,$.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,$.jsx)(m.T,{size:13,weight:"semibold",children:e.time}),(0,$.jsxs)(m.T,{size:13,children:[(0,f.privName)(e,s)," \xb7 ",e.partySize]}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,accessibilityLabel:e.table?(0,l.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,$.jsx)(m.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,$.jsx)(m.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,$.jsx)(m.T,{size:12,children:k.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,$.jsxs)(m.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,$.jsxs)(m.Row,{gap:4,children:[(0,$.jsx)(h.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:k.STATUS[e].colour}}),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:k.STATUS[e].label})]},e)),(0,$.jsx)(m.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,n.useState)(20);return(0,n.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,n.useEffect)(()=>{l<=0&&s()},[l]),(0,$.jsxs)(m.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,$.jsx)(m.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,$.jsx)(m.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:u,todays:b,now:j,privacy:v,turnBase:C,onClose:I,onWalkIn:B,onMove:D,onDetails:M}){const z=a[t],P=y.useFloor.getState(),[N,R]=(0,n.useState)(!1),[L,A]=(0,n.useState)(z?.note??''),[W,O]=(0,n.useState)(!1),H=(0,T.useBookingWrite)();if(!z)return null;const F=z.booking,E=['seated','mains','dessert','bill'].includes(z.status),_=b.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,r.minsBetween)(j,(0,k.startOf)(e)))-Math.abs((0,r.minsBetween)(j,(0,k.startOf)(t)))),G=e=>e.partySize<=z.table.maxSeats,U=z.next??z.due,V=(0,k.turnFor)(z.covers||z.table.maxSeats,C);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${k.STATUS[z.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===z.status?(0,$.jsx)(m.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{y.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Badge,{kind:"neutral",label:`${z.table.minSeats}\u2013${z.table.maxSeats} seats`}),F?(0,$.jsx)(m.Badge,{kind:"gold",label:`${(0,f.privName)(F,v)} \xb7 ${F.partySize} \xb7 ${z.seatedMins}m`}):null,F?(0,$.jsx)(m.Badge,{kind:z.seatedMins>(0,k.durOf)(F,C)?'red':'neutral',label:`Turn about ${(0,k.durOf)(F,C)} min \xb7 free about ${(0,r.hm)((0,k.endOf)(F,C))} (est.)`}):(0,$.jsx)(m.Badge,{kind:"neutral",label:`Turn estimate for ${z.table.maxSeats}: about ${V} min`}),z.next?(0,$.jsx)(m.Badge,{kind:"blue",label:`Next: ${z.next.time} ${(0,f.privName)(z.next,v)} (${z.next.partySize})`}):null,z.allergy?(0,$.jsx)(m.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,$.jsx)(w.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,$.jsx)(i.BookingTableButton,{rid:e,booking:F??U,turnBase:C,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,$.jsx)(o.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,$.jsx)(o.ReinstateWalkInButton,{rid:e,b:F,today:(0,r.ymd)(new Date)}):null,!E&&'blocked'!==z.status&&U?(0,$.jsx)(m.Button,{label:`Seat ${(0,f.privName)(U,v)}`,accessibilityLabel:`Seat ${(0,f.privName)(U,v)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await p.repo.bookings.update(s.id,{table:s.table&&(0,y.tablesOf)(s.table).includes(t)?s.table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==z.status&&U&&(0,k.startOf)(U)<=j?(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,f.privName)(U,v)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,f.privName)(U,v)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await p.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===z.status?null:(0,$.jsxs)(m.Row,{gap:8,children:[(0,$.jsx)(m.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===z.status&&y.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,$.jsx)(m.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,$.jsxs)(h.default,{style:{gap:6},children:[0===_.length?(0,$.jsx)(m.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,$.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,f.privName)(s,v)} ${s.time}`,onPress:async()=>{await p.repo.bookings.update(s.id,{table:t}),await p.repo.bookings.setStatus(s.id,'seated'),(0,x.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:[s.time," \xb7 ",(0,f.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,$.jsxs)(m.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",z.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,$.jsx)(m.Row,{wrap:!0,gap:6,children:k.STAGES.map(s=>(0,$.jsx)(m.Chip,{label:k.STAGE_LABEL[s],selected:z.status===s,onPress:()=>P.setLive(e,t,{stage:s})},s))}),(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[F?(0,$.jsx)(m.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,$.jsx)(m.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await p.repo.bookings.setStatus(F.id,'finished'),P.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,$.jsxs)(m.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(m.Button,{kind:"secondary",label:'blocked'===z.status?'Unblock table':'Block table',onPress:()=>{P.setLive(e,t,{blocked:'blocked'!==z.status}),I()},testID:"block-table"}),(0,$.jsx)(m.Button,{kind:"ghost",label:z.note?'Edit note':'Note',onPress:()=>R(!N)}),F||U?(0,$.jsx)(m.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),M(F??U)},testID:"guest-details"}):null]}),N?(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[m.styles.input,{flex:1}]}),(0,$.jsx)(m.Button,{small:!0,label:"Save",onPress:()=>{P.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,v?(0,$.jsx)(m.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,u.joins.some(e=>e.tables.includes(t))?(0,$.jsxs)(m.Muted,{children:["Joins with ",u.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",u.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:i,waiting:o,now:u,privacy:b,busy:j,onToast:w}){const[T,I]=(0,n.useState)(''),[B,D]=(0,n.useState)(2),M=(0,y.useFloor)(e=>e.smsLog);return(0,$.jsxs)(C,{title:`Waitlist (${o.length})`,right:(0,$.jsxs)(m.Muted,{children:["new party about ",(0,v.estimateWait)(o.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,$.jsx)(m.Muted,{children:"Nobody waiting."}):null,o.map((s,o)=>{const n=(0,k.suggestTable)(l,i,a,s.partySize,u,(0,k.turnFor)(s.partySize,t.settings.turnMins)),c=(0,v.estimateWait)(o+1,t.settings.turnMins,j),T=Math.max(0,(0,r.minsBetween)(new Date(s.joinedAt),u)),C=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,$.jsxs)(h.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(m.T,{weight:"semibold",children:["#",s.number," ",(0,f.pv)(s.name,b)," \xb7 ",s.partySize]}),(0,$.jsxs)(m.T,{size:12,colour:T>c?S.colours.amber:S.colours.muted,children:["waited ",T,"m \xb7 quoted about ",c,"m"]})]}),n?(0,$.jsxs)(m.T,{size:12,colour:n.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",n.table," (",n.why,")"]}):(0,$.jsx)(m.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,$.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(m.Button,{small:!0,label:C||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{y.useFloor.getState().logSms(e,u.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),p.repo.waitlist.setStatus(s.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),n?(0,$.jsx)(m.Button,{small:!0,kind:"success",label:`Seat at ${n.table}`,onPress:async()=>{await p.repo.waitlist.setStatus(s.id,'seated'),await p.repo.bookings.seatWalkIn(e,s.partySize,n.table,`From waitlist #${s.number}`),(0,x.resetTableLive)(e,n.table),w(`Waitlist #${s.number} seated at ${n.table}`)}}):null,(0,$.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>p.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,$.jsx)(m.Badge,{kind:"ok",label:`Told table ready${C?` ${(0,r.hm)(new Date(C.at))}`:''} `}):null]},s.id)}),(0,$.jsxs)(m.Row,{gap:6,children:[(0,$.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:T,onChangeText:I,style:[m.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,$.jsx)(c.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(m.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,$.jsx)(m.Button,{small:!0,label:"Add",disabled:T.trim().length<2,onPress:()=>{p.repo.waitlist.join(e,T.trim(),B),I('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:i,walkInCount:o,staffOn:n,onSummary:u}){const c=o+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=i.getHours(),x=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===b)?.covers??0)*(i.getMinutes()/60)),f=x?c/x:1,p=f>=1.1?S.colours.amber:f>=.85?S.colours.ok:S.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,r.addMins)(i,15*(t-4)-i.getMinutes()%15),a=(0,r.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,k.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),v=y.filter(e=>e.future&&e.covers>j),T=s.nextHour?.covers??0,I=Math.ceil(T/16);return(0,$.jsxs)(C,{title:"Pace & kitchen",right:(0,$.jsx)(m.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,$.jsxs)(h.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${x}`,style:{gap:4},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{size:14,children:"Covers so far"}),(0,$.jsxs)(m.T,{weight:"bold",colour:p,children:[c," ",(0,$.jsxs)(m.T,{size:13,colour:S.colours.muted,children:["/ about ",x," forecast"]})]})]}),(0,$.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,$.jsx)(h.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,$.jsxs)(m.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 Covers']})]}),(0,$.jsx)(m.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,$.jsx)(h.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,$.jsxs)(h.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,$.jsx)(m.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,$.jsx)(h.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,$.jsx)(m.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,r.hm)(e.from)})]},t))}),v.map(e=>(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,r.hm)(e.from),"\u2013",(0,r.hm)((0,r.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),I>n?(0,$.jsxs)(m.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",T," Covers with ",n," on: about ",I-n," more on the floor suggested."]}):(0,$.jsxs)(m.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,$.jsx)(m.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),n=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,r.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,y.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{children:e}),(0,$.jsx)(m.T,{weight:"semibold",children:t})]},e);return(0,$.jsxs)(m.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(n)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,$.jsx)(m.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return y.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]);_r(d[9]);var c=e(_r(d[10])),b=e(_r(d[11])),h=e(_r(d[12])),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]);const C=({title:e,right:t,children:s,testID:l})=>(0,$.jsxs)(h.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,$.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(m.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,$.jsxs)(h.default,{style:{gap:6},children:[(0,$.jsxs)(m.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,$.jsxs)(m.Muted,{children:[e.time," \xb7 ",e.table?(0,y.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,$.jsx)(w.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,$.jsx)(u.BookingNeeds,{b:e,big:!0}),e.notes?(0,$.jsxs)(m.T,{children:["Notes: ",e.notes]}):(0,$.jsx)(m.Muted,{children:"No notes."}),e.allergies.length?(0,$.jsx)(h.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,$.jsxs)(m.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,$.jsx)(m.Muted,{children:"No allergies declared."}),(0,$.jsx)(m.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const B=!0},1310,[798,796,829,1120,1091,1112,827,34,1081,236,402,295,102,794,1096,1300,848,1014,830,1089,1079,1267,840,1282,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},1311,[796,34,236,402,102,794,848,1014,1312,840,1313,1315,25]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1312,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1313,[815,848,1014,1312,1314,1315]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1314,[829]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1315,[236,1314]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'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)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(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:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(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 l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{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)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1316,[829,34,1152,1143,402,102,1011,1014,852,827,840,794,1317,1320,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1317,[1318,839,829,34,281,395,402,295,102,848,1011,1014,1319,827,840,1041,794,1320,1321,985,1282,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1318,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1319,[852,827,851]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"wixBlockPushOn",{enumerable:!0,get:function(){return o}}),e.pushBlocksToWix=function(t,n,c){if(!o(t)||!n.length)return;const l=u.useSync.getState();if(!l.venueId||'guest'===l.kind)return;setTimeout(()=>{(0,s.getSupabase)().functions.invoke('wix-blocks-push',{body:{venue_id:l.venueId,block_ids:n.slice(0,120),action:c}}).catch(()=>{})},4e3)},Object.defineProperty(e,"websiteBlockStatus",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]),u=r(d[3]);const o=s=>!t.IS_ISOLATED_VENUE&&!['souters','kirkmichael','wildings'].includes(s)&&!!n.useFloor.getState().settings[s]?.wixBlockPushOn;const c=t=>(t??'awaiting venue sync').replace(/\bWix\b/gi,'Website bookings')},1320,[5,1014,931,985]); +__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})},1321,[815,931,985,1322,2,1323]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WEAK",{enumerable:!0,get:function(){return t}}),e.pinProblem=function(n,i){if(!/^\d+$/.test(n)||n.length8)return`The PIN must be ${i} to 8 digits.`;if(/^(\d)\1+$/.test(n))return t;const u=t=>n.split('').every((i,u)=>0===u||Number(i)===(Number(n[u-1])+t+10)%10);return u(1)||u(-1)?t:null};const t='Pick a PIN that is harder to guess (not all the same digit or a run like 1234).'},1322,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(s,o){const c=(new Date).toISOString();switch(s){case'display_staff_list':return[...t.ROSTER.filter(t=>'st-tracy'!==t.id).map(t=>({ref:t.id,name:t.name,dept:t.dept,hasPin:!0,clockedIn:a.has(t.id)})),{ref:'tmp-casey',name:'Casey (temp)',dept:'Front of house',temp:!0,hasPin:!0,clockedIn:!1}];case'display_pin_lengths':return Object.fromEntries(t.ROSTER.map(t=>[t.id,'staff'===t.role?{len:4,min:4}:{len:6,min:6}]));case'display_managers':return t.ROSTER.filter(t=>'staff'!==t.role).map(t=>({ref:t.id,name:t.name}));case'display_add_temp':return{ok:!0,name:String(o.p_name??'Temp'),code:'4071',ref:'tmp-new',temp:!0};case'display_change_pin':return{ok:!0,name:n(o.p_staff_ref)};case'display_clock':{const t=String(o.p_staff_ref),s=String(o.p_action);return'in'===s&&a.add(t),'out'===s&&a.delete(t),{ok:!0,name:n(t),clockedIn:'out'!==s&&('status'!==s||a.has(t)),onBreak:'break_start'===s,hadBreak:!1,onRota:!0,since:c,at:c,ref:t}}default:return{ok:!0}}};var t=r(d[0]);const a=new Set(['st-gordon','st-bisto','st-agate','st-eilidh']),n=a=>t.ROSTER.find(t=>t.id===a)?.name??'Casey (temp)'},1323,[15]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return f}}),_e.DayGraph=function({todays:e,open:f,close:j,now:b,turnBase:w,blocks:T=[],height:v=150,forecastNote:M,emptyText:$,past:A,closed:D,compact:k=!1,dense:_=!1,bare:z=!1,fill:I=!1}){const[C,L]=(0,t.useState)(0),F=f.getTime()-18e5,H=j.getTime()+36e5,O=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(F),new Date(H),w),[e,F,H,w]),S=60*f.getHours()+f.getMinutes(),P=60*j.getHours()+j.getMinutes(),B=(0,t.useMemo)(()=>(0,m.chartBands)(T,S,P),[T,S,P]),N=new Date(f);N.setHours(0,0,0,0);const R=e=>N.getTime()+6e4*e,X=Math.max(8,...O.map(e=>e.covers)),U=O.reduce((e,t)=>!t.covers||(0,m.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),B)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),W=Math.max(48,v-x.AXIS_BAND),E=_?8:16,G=Math.max(10,C-28-8),V=Math.max(10,W-E-6),Y=e=>28+(e-F)/(H-F)*G,Z=e=>E+V-e/(1.15*X)*V,q=[];for(let e=new Date(F);e.getTime()<=H;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=F&&t.getTime()<=H&&q.push(t.getTime())}const J=C?(0,x.layoutChart)({width:C,height:W,t0:F,t1:H,hours:q,busiest:D?null:U}):{hours:[],busiest:null},K=O.map((e,t)=>`${t?'L':'M'}${Y(e.t).toFixed(1)},${Z(e.covers).toFixed(1)}`).join(' '),Q=I&&K&&O.length>1?`${K} L${Y(O[O.length-1].t).toFixed(1)},${Z(0).toFixed(1)} L${Y(O[0].t).toFixed(1)},${Z(0).toFixed(1)} Z`:'',ee=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,te=J.busiest?.text??(U&&!D?(0,x.busiestText)(U.t,U.covers):''),se=B.map(e=>e.spoken).join('. '),ie=`Covers through the day. Open ${(0,u.hm)(f)}. Close ${(0,u.hm)(j)}.${te?` ${te}.`:''}${se?` ${se}.`:''}`,oe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(i.default,{testID:"day-graph",style:[d.look.panel,{overflow:'visible',paddingTop:z?4:_?2:10,paddingBottom:z?2:6,backgroundColor:h.colours.bg}],children:[z?null:k?(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(n.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsxs)(n.T,{center:!0,size:14,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}):(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(n.T,{size:_?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.muted,children:[ee," ",1===ee?'table':'tables'," ",A?'seated':'booked']})]}),z?null:D?M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:M}):null:(0,y.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Open ",(0,u.hm)(f)]}),M?(0,y.jsx)(n.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:M}):(0,y.jsx)(i.default,{style:{flex:1}}),(0,y.jsxs)(n.T,{size:12,colour:h.colours.goldLight,children:["Close ",(0,u.hm)(j)]})]}),(0,y.jsx)(i.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ie,onLayout:e=>L(e.nativeEvent.layout.width),style:{height:W,minHeight:W},children:C?(0,y.jsxs)(l.default,{width:C,height:W,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${oe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${oe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),B.map((e,t)=>(0,y.jsx)(o.Rect,{x:Y(R(e.fromMin)),y:E,width:Math.max(3,Y(R(e.toMin))-Y(R(e.fromMin))),height:V,fill:`url(#${oe}-${e.strength})`},`${e.fromMin}-${t}`)),Q?(0,y.jsx)(o.Path,{d:Q,fill:"#3A2F1E",stroke:"none"}):null,K?(0,y.jsx)(o.Path,{d:K,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,D?null:[f,j].map((e,t)=>(0,y.jsx)(o.Line,{x1:Y(e.getTime()),x2:Y(e.getTime()),y1:E,y2:E+V,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),J.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:J.busiest.x+J.busiest.w/2,y:J.busiest.y+J.busiest.h-2,fill:h.colours.gold,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:J.busiest.text}):null,ee?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+G/2,y:E+V/2,fill:h.colours.muted,fontSize:(0,c.soutersFont)(13),textAnchor:"middle",children:$??'No bookings yet today'})]}):null}),(0,y.jsx)(i.default,{testID:"day-graph-axis",style:{height:x.AXIS_BAND,minHeight:x.AXIS_BAND,position:'relative'},children:J.hours.map(e=>(0,y.jsx)(n.T,{testID:"day-graph-hour",size:x.AXIS_FONT,colour:h.colours.muted,style:{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:x.AXIS_BAND,textAlign:'center'},children:e.text},e.text+e.x))})]})};var t=r(_d[0]),s=e(t),i=e(r(_d[1])),o=r(_d[2]),l=e(o),n=r(_d[3]),d=r(_d[4]),u=r(_d[5]),h=r(_d[6]),c=r(_d[7]),x=r(_d[8]),m=r(_d[9]),p=r(_d[10]),y=r(_d[11]);const f=64},1324,[34,102,900,794,1143,827,840,798,1325,1326,1327,25]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=i,e.anyOverlap=u,e.busiestText=s,e.hourAxis=h,e.dayLabelWidth=c,e.daysAxis=function(n,a,i=1){if(!a.length||n<=0)return[];const u=Math.max(10,n-28-8),s=Math.max(1,a.length-1),h=t=>a.length<=1?28+u/2:28+t/s*u,o=t=>t.every((a,i)=>a.x>=0&&a.x+a.w<=n&&(0===i||t[i-1].x+t[i-1].w+2<=a.x)),x=(u,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%u===0).map(({t:a,i:u})=>{const o=a.length>s?a.slice(0,s):a,x=Math.min(n,c(o,i));return{x:Math.max(0,Math.min(n-x,h(u)-x/2)),y:0,w:x,h:t,text:o}});return o(x)?x.map((t,a)=>{const i=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,u=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-i),h=Math.max(0,u-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+h,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const o=Math.min(s,h);return{...t,x:t.x-o,w:t.w+2*o,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const i=Math.max(1,n.width),u=Math.max(10,i-28-8),o=Math.max(1,n.t1-n.t0),x=h(i,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&n.busiest.covers>0){const t=s(n.busiest.t,n.busiest.covers),h=Math.min(i,a(t,13)),x=28+(n.busiest.t-n.t0)/o*u-h/2;c={x:Math.max(0,Math.min(i-h,x)),y:1,w:h,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function i(t,n){return t.x28+(t-s)/c*x,f=o.map(i=>{const u=String(new Date(i).getHours()).padStart(2,'0'),s=a(u,n);return{x:l(i)-s/2,y:0,w:s,h:t,text:u}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(i-t.w,t.x))}));if(!u(n))return n}return[]}const o='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,i=n){const u=[...t].reduce((t,n)=>{const a=o.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(u*i*Math.max(1,a))+4}},1325,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.chartBands=function(n,s,a){const c=[];for(const u of n){if(u.removedAt)continue;const n=u.wholeDay?0:t(u.from),f=u.wholeDay?1440:t(u.to);if(null==n||null==f)continue;const h=Math.max(n,s),l=Math.min(f,a);if(l<=h)continue;const M=o(u,h,l);c.push({fromMin:h,toMin:l,strength:M.strength,spoken:M.spoken})}c.sort((t,n)=>t.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},1326,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},1327,[1079]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(t,n,o){return t.filter(t=>t.date===n&&'cancelled'===t.status).sort((t,n)=>t.time.localeCompare(n.time)||t.name.localeCompare(n.name)).map(t=>b(t,o(t)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return f}});var t=r(_d[0]),n=r(_d[1]);const o=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],a='#F2E6CC',l='#1F1A12',c='#5A4C33',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(t,n)=>{if(!t)return null;const o=new Date(t);if(Number.isNaN(o.getTime()))return null;const a=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===n?a:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${a}`};function u(t){const n=t;if(n.cancelled?.by)return n.cancelled.by;const o=!!n.wix?.status&&/CANCEL|DECLIN/i.test(n.wix.status);return o&&n.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(t.tags??[]).some(t=>t.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===n.wix?.status?'Website booking not finished (deposit not paid)':n.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(a,l){const c=a,b=o(a.table??c.cancelled?.table??void 0),p=b.length?`Table ${(0,t.tableNumbers)(b.join('+'))}`:'No table',f=`${a.partySize} ${1===a.partySize?'person':'people'}`,y=d(c.cancelled?.at??(c.wix?c.wix.updatedDate:null),a.date),C=u(a),N=a.walkIn?'Walk-in':s[a.source??'']??(c.wix?'Website':'Not recorded'),h=(0,n.allergyLine)(a),w=`Cancelled: ${l}, ${h?`allergy noted: ${h}, `:''}${f}, was ${a.time}, ${p.toLowerCase()}. ${C}${y?` at ${y}`:''}.`;return{id:a.id,date:a.date,name:l,people:f,time:a.time,table:p,tables:b,walkIn:!!a.walkIn,by:C,when:y,source:N,notes:(a.notes??'').trim(),allergy:h,spoken:w}}const p=t=>`Cancellations ${t}`,f=(t="today")=>`No cancellations ${t}.`},1328,[829,1306]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:c="today",testID:y="display-cancellations"}){const[b,p]=(0,l.useState)(null),C=(0,o.cancellationsHeading)(e.length);return(0,h.jsxs)(n.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:o.CANCEL_TINT,padding:10,gap:6},children:[(0,h.jsx)(n.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${C}. Cancelled bookings, not counted in Covers.`:`Cancellations: none ${c}.`,style:{alignItems:'center'},children:(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,center:!0,testID:"cancellations-head",children:C})}),e.length?e.map(e=>(0,h.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>p(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(31,26,18,0.15)',backgroundColor:e?'#E8D9B6':'transparent'}),children:[(0,h.jsxs)(n.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,h.jsx)(s.T,{size:17,weight:"semibold",colour:o.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),e.allergy?(0,h.jsx)(n.default,{style:{paddingTop:1},children:(0,h.jsx)(u.AllergyIcon,{text:e.allergy,size:20,colour:"#8A5A00",ink:"#F3E7CC",testID:`cancel-allergy-${e.id}`})}):null]}),(0,h.jsxs)(s.T,{size:15,colour:o.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,h.jsx)(s.T,{size:15,colour:o.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,o.cancellationsEmpty)(c)}),b?(0,h.jsx)(x,{c:b,onClose:()=>p(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),o=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]);function y({k:e,v:l}){return(0,h.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,h.jsx)(s.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,h.jsx)(s.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,h.jsxs)(s.Sheet,{visible:!0,onClose:l,title:`Cancelled \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,h.jsxs)(n.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,h.jsx)(y,{k:"Name",v:e.name}),(0,h.jsx)(y,{k:"Party",v:e.people}),e.allergy?(0,h.jsx)(y,{k:"Allergies",v:e.allergy}):null,(0,h.jsx)(y,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,h.jsx)(y,{k:"Table",v:e.table}),(0,h.jsx)(y,{k:"Cancelled by",v:e.by}),(0,h.jsx)(y,{k:"When",v:e.when??'Not recorded'}),(0,h.jsx)(y,{k:"Booked by",v:e.source}),(0,h.jsx)(y,{k:"Notes",v:e.notes||'None'})]}),(0,h.jsx)(s.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1329,[34,402,102,794,1328,840,1291,25]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},1330,[34,102,899,794,1143,827,840,25]); +__d(function(g,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,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:x="l",block:h,premium:p,disabled:b,accessibilityHint:y}){const{width:w}=(0,s.default)(),j='l'===x&&w>=520,D='s'===x,I=h?{alignSelf:'stretch'}:p?{flexGrow:1,flexBasis:140,minWidth:140,maxWidth:'100%'}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:j?200:150,maxWidth:j?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:y,accessibilityState:{disabled:!!b},disabled:b,onPress:l,style:({pressed:e})=>p?{...I,minHeight:D?52:j?78:62,borderRadius:D?14:20,...D?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?12:8,paddingHorizontal:D?6:j?20:10,...t.look.primary(e)}:{...I,minHeight:j?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:j?10:6,paddingHorizontal:j?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(o.T,{size:D?16:j?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:D,numberOfLines:D?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:s,testID:o="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:s?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:s?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12,justifyContent:'center',flexGrow:s?0:1,flexBasis:s?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return s?(0,c.jsxs)(l.default,{testID:o,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:o,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),o=r(d[5]),c=r(d[6]);const f='#CFA45F'},1331,[34,1143,402,102,426,794,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=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]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.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,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1332,[798,796,2,1143,34,402,102,426,794,840,865,992,827,994,1321,985,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},1333,[34,1021,865,1001,800,1022,994,1321,1070]); +__d(function(g,_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,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},1334,[5,798,847,34,236,402,102,426,985,840,794,1287,1335,25]); +__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}})()},1335,[]); __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]})}},1336,[30,34,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1337,[30,34,1338,846,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1338,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1339,[30,34,846,1340,25]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1340,[1341,1345,798,991,1073,1346,1160,1040,1041,1347,1349,1352,1130,977,1042,2,1047,1048,1354,993,34,1132,1181,1185,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1355,1070,1085,1086,1082,1043,1025,1100,1362,1363,1364,1372,1373,997,236,1187,1145,1151,1369,1155,1154,1380,1148,15,1161,1162,899,793,985,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1341,[796,34,1033,395,102,1107,1108,1292,1315,794,1011,1014,827,840,1100,1015,1342,1343,1035,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1342,[796,34,402,102,794,840,1014,5,1015,846,985,25]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1343,[34,102,794,1014,1344,828,840,1060,931,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1344,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1345,[34,102,794,1100,985,25]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1346,[829,34,102,794,830,836,1131,848,838,840,25]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1347,[985,34,281,236,102,1225,794,1200,1203,840,1348,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1348,[34,236,102,794,1200,25]); -__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1349,[34,102,794,830,1200,1350,1351,840,25]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1350,[830]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1351,[985,1350,1203]); -__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1352,[5,1353,34,102,794,836,1200,1201,1202,985,1203,840,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1353,[34,794,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1354,[34,102,794,840,993,1037,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1355,[5,1353,11,1356,796,806,1112,1113,1091,1115,1114,1327,1328,1100,1281,1012,1089,14,1357,1181,1358,1315,1081,1075,1090,34,102,794,1290,848,830,836,827,1266,840,1147,1096,1014,1359,1360,1136,1361,1172,985,1149,1323,852,25]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1356,[6,34,102,794,985,1212,25]); -__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1357,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1358,[34,402,1143,794,840,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1359,[34,102,848,1014,794,840,25]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1360,[34,402,102,794,840,25]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1361,[34,102,853,848,833,840,794,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1362,[34,1316,1100,25]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1363,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1364,[804,982,1365,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1365,[796,1120,985,900,1170,1172,34,281,379,236,402,102,426,853,794,848,1181,865,836,827,840,1147,1100,838,1366,1135,1369,1370,1119,1126,1125,1024,13,1123,1371,1166,25]); -__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1366,[925,800,798,806,852,1061,1367,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1166,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1367,[499,1368]); -__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 t}});var t={}},1368,[]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1369,[796,34,1193,1041,839,379,402,102,794,865,836,827,840,1147,1100,1166,25]); -__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1370,[1042,34,402,102,794,865,840,1100,985,25]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1371,[798,34,283,364,236,102,426,900,794,796,840,1324,25]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1372,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); -__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1373,[5,1374,1375,1376,1377,1378,34,236,41,102,846,997,840,1379,794,985,2,1072,996,865,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1374,[34,102,847,794,5,6,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1375,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1376,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1377,[34,102,847,794,25]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1378,[34,102,847,794,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1379,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const v=(0,m.useInStaffApp)(),{now:L,meId:N,me:A,r:z,today:H}=(0,m.useCtx)(3e4),O=(0,s.useTravelDay)('staff',H),P=(0,c.useOwner)(e=>e.shifts),R=(0,c.useOwner)(e=>e.attendance),F=(0,c.useOwner)(e=>e.staffCanViewSuppliers),_=(0,c.useOwner)(e=>e.quickLinks),E=(0,c.useOwner)(e=>e.chat),W=(0,c.useOwner)(e=>e.swaps),V=(0,c.useOwner)(e=>e.leave),q=P.filter(e=>e.staffId===N&&e.published&&e.date>=H).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),G=q.find(e=>e.date===H),U=R.filter(e=>e.staffId===N&&e.in&&!e.out&&L.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Y=(0,x.usePay)(N,0),Q=(0,b.useOrders)(z.id),K=(0,b.useBookings)(z.id),J=Q.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,K))),X=K.filter(e=>e.date===H&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,Q.filter(T.LIVE))),Z=K.filter(e=>(0,S.undoKind)(e,H)||e.walkIn&&'cancelled'===e.status&&e.date===H).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),ee=E.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],se=W.filter(e=>e.fromId===N&&'open'===e.status).length+V.filter(e=>e.staffId===N&&'pending'===e.status).length,te=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & leave',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...F?[['Suppliers',()=>e('more','suppliers')]]:[]];return!v&&O?(0,$.jsxs)(o.default,{style:{gap:10},children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(s.DayView,{rid:z.id,day:O,today:H,app:"staff"})]}):(0,$.jsxs)(o.default,{style:{gap:10},children:[v?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s.DayBar,{app:"staff",today:H}),(0,$.jsx)(t.CoversToday,{rid:z.id})]}),(0,$.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,$.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,$.jsx)(C.StaffAvatar,{id:N,size:52})}),(0,$.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",A.replace(' (example)','').split(' ')[0]]})]}),(0,$.jsx)(r.Badge,{kind:"gold",label:v?z.name:'Staff app preview'})]}),(0,$.jsx)(r.Muted,{children:v?`${L.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,$.jsx)(M.StaffTipsTile,{rid:z.id,today:H,onPress:()=>e('more','mytips')}),(0,$.jsxs)(r.Card,{highlight:U?u.colours.ok:void 0,children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{weight:"semibold",children:U?`On shift since ${(0,h.hm)(new Date(U.in))}`:'Not clocked in'}),U?(0,$.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((L.getTime()-new Date(U.in).getTime())/6e4)))}):null]}),G?(0,$.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(G.start),"\u2013",(0,m.fmtH)(G.end)]}):q[0]?(0,$.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[q[0].day]," ",Number(q[0].date.slice(8))," ",(0,m.fmtH)(q[0].start),"\u2013",(0,m.fmtH)(q[0].end)]}):(0,$.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,$.jsx)(r.Button,{small:!0,kind:U?'secondary':'success',label:U?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),(0,$.jsx)(p.ShellfishTile,{rid:z.id,by:A.replace(' (example)',''),app:"staff"}),Z.length?(0,$.jsx)(r.Card,{children:(0,$.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",Z.length,")"]}),(0,$.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),Z.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,$.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,$.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,$.jsxs)(r.Muted,{children:[e.table?(0,D.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,$.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(z.id,e)}):null,e.walkIn?(0,$.jsx)(a.CancelWalkInButton,{rid:z.id,b:e,small:!0}):null,e.walkIn?(0,$.jsx)(a.ReinstateWalkInButton,{rid:z.id,b:e,today:H,small:!0}):null,(0,$.jsx)(S.BookingUndo,{b:e,rid:z.id,today:H,who:s})]})]},e.id)})]})}):null,J.length+X.length?(0,$.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,$.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",J.length+X.length,")"]}),(0,$.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),J.map(e=>(0,$.jsx)(j.AllergyChain,{o:e,me:A},e.id)),X.map(e=>(0,$.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,I.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,$.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,$.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,$.jsx)(j.BookingAllergyChain,{b:e,me:A}),(0,$.jsx)(o.default,{style:{flexDirection:'row'},children:(0,$.jsx)(w.WhatsAppGuest,{b:e,rid:z.id,kind:"auto"})})]},e.id))]}):null,ee?(0,$.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,$.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,$.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,$.jsx)(r.T,{size:14,children:ee.text})]}):null,(0,$.jsxs)(r.Card,{children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,$.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Y.paid)," paid hours"]})]}),se?(0,$.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,$.jsxs)(r.T,{size:14,children:["You have ",se," request",se>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(_,'staff').length?(0,$.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,$.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,$.jsx)(y.QuickLinksRow,{compact:!0})]}):null,v?null:(0,$.jsx)(o.default,{style:{gap:6},children:te.map(([e,s])=>(0,$.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),D=_r(d[23]),I=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27])},1380,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1366,1136,850,1149,838,1147,899,1359,1014,829,1096,1154,25]); -__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]})}},1381,[30,34,846,25]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1382,[1383,985,795,1334,1385,1011,30,1412,496,34,385,336,236,41,102,5,847,846,1414,36,848,1014,865,840,1373,997,1010,1417,1418,1419,1420,1099,2,1024,1440,1303,25,1441,1442,1443,1444]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1383,[2,796,34,236,383,102,794,1384,985,840,1151,997,865,988,25]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1384,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1385,[1386,1409,1411]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1386,[215,1387,1390,1404,1405,1406,1407,1408]); -__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1387,[215,1388]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1388,[1389]); -__d(function(g,r,i,a,m,e,d){},1389,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1390,[1391,215,1387,1404,1405]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1391,[1392,1393,1403]); -__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1392,[1393,1397,1402]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1393,[215,372,1394,1398,1399,1400,1401,1397,1402]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1394,[215,1395,339,280,1396,1397]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1395,[504]); -__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1396,[215,339]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1397,[]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1398,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1399,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1400,[1398]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1401,[]); -__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1402,[372,1396]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1403,[34,1393]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1404,[1391,215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1405,[1391,1404]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1406,[1387]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1407,[215,1387,1390,1388]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1408,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1409,[215,54,1410]); -__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1410,[215]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1411,[34,1386]); -__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]}})})},1412,[1413]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1413,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1414,[34,41,102,426,794,847,997,985,2,5,840,1415,1416,25]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),e.railSizes=function(s,o){const l=s>=1600?168:s>=1200?136:120,t=Math.floor((o-44)/12),n=Math.max(44,Math.min(72,t-18));return{railW:l,per:t,circle:n,label:t>=80?13:t>=66?11:10,icon:Math.round(.46*n)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return o}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}];const o=s=>s.split('').join(' ')},1415,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1416,[34,102,794,840,25]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1417,[986,857,856,985]); -__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1418,[798,796,34,1342,1015,402,102,846,985,1007,1014,5,840,794,1286,974,2,25]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1419,[796,34,236,402,102,840,985,1045,2,25]); -__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1420,[5,796,34,385,283,364,380,236,402,295,426,102,1421,1116,2,900,1100,15,865,794,840,1422,930,1436,1432,1433,1437,1117,1438,929,1439,1435,25,277]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"useAssistantUi",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AssistantFab",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AssistantSheet",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"AssistantPage",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AssistantSettings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"AssistantPlanCard",{enumerable:!0,get:function(){return c}});const t=!1,n={getState:()=>({open:!1,setOpen:t=>{}})},u=()=>null,s=()=>null,l=()=>null,o=()=>null,c=()=>null},1421,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${O[t.risk]}${$(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if($(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(c.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const c=(0,l.searchHelp)(p.HELP,e,3);return c.length?{kind:'help',ids:c.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,O={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},$=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);return e.staffId&&e.date&&a>t?(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`):'That shift isn\u2019t complete.'}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...u.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1422,[1423,1098,829,1426,1427,865,848,1014,1431,1432,1433,1429,1428,1434,1435,1012,1013]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1423,[1424,1425,1038]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1424,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1425,[34,846,1424,827,985,931]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1426,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1427,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1428,1426]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1428,[804,1098,829,1120,1203,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1429,1430]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1429,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1430,[808,815,818]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1431,[798,34,283,364,236,402,102,815,794,840,25]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1432,[]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1433,[]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1434,[800,865,989,836,1428,1032]); -__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1435,[]); -__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1436,[865,800,1014]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1437,[815]); -__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1438,[808,815,818]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1439,[815]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=f(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),A=[],k=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);i.includes(c)||(A.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0}),d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:u(d,23.5)}:void 0}):d===y&&e<=m&&k.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:u(d,e-.05),inSite:!0}))}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!A.some(e=>e.staffId===t.staffId&&e.date===t.date)),...A],attendance:[...S.attendance,...k]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:u(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:u((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',f=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,u=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1440,[848,800,865,1024,15,997,846]); -__d(function(e,s,o,p,t,a,f){"use strict";t.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1441,[]); -__d(function(s,o,e,p,t,c,d){"use strict";t.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1442,[]); -__d(function(o,s,e,f,p,t,d){"use strict";p.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1443,[]); -__d(function(o,s,p,t,d,e,n){"use strict";d.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1444,[]); -__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]})}},1445,[30,34,846,25]); -__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1446,[1447]); -__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1447,[25,1448,591]); -__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1448,[34,172]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1449,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1450,[25,499,34,270,651]); +__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]})}},1337,[30,34,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1338,[30,34,1339,846,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1339,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1340,[30,34,846,1341,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,me.jsx)(J.StaffAppCtx.Provider,{value:!0,children:(0,me.jsx)(we,{})})};var s=_r(d[0]),t=_r(d[1]),o=_r(d[2]),i=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),v=_r(d[18]),S=_r(d[19]),C=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),B=_r(d[24]),P=e(_r(d[25])),A=e(_r(d[26])),I=e(_r(d[27])),O=e(_r(d[28])),L=e(_r(d[29])),W=_r(d[30]),z=_r(d[31]),H=_r(d[32]),E=_r(d[33]),D=_r(d[34]),N=_r(d[35]),_=_r(d[36]),V=_r(d[37]),F=_r(d[38]),U=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]);_r(d[51]);var te=_r(d[52]),ae=_r(d[53]),oe=_r(d[54]),ie=_r(d[55]),re=_r(d[56]),le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]);const be=ce.ROSTER.find(e=>'chef'===e.app)?.id,ye=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],xe={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me'},je=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: take a picture of the taking sheet or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks (say or type)'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Phone notifications',sub:'Turn on reminders on this phone'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],ke=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function we(){const{r:e,rid:r,me:n,meId:w,today:v,now:S}=(0,J.useCtx)(3e4);(0,R.useReviewAlerts)(r),(0,le.useStaffTipsNotice)(r,v);const ne=(0,J.useSignedIn)(),de=ne?.ownerAccess&&'owner'!==ne.role?'owner privileges':ne?.managerAccess&&'staff'===ne.role?'manager privileges':'',ce=(0,J.useShiftManager)(),we=(0,ge.useSync)(e=>e.perms),Ce=ke.filter(e=>'mgr-swaps'===e.id?we.includes('rota.swap'):'mgr-times'!==e.id||(we.includes('bookings.settings')||we.includes('*')));(0,y.useSoldOutLink)(!0,n);(0,D.useOwner)(e=>e.staff);const Te=(0,D.useOwner)(e=>e.staffCanViewSuppliers),[Me,Re]=(0,C.useState)('home'),[Be,Pe]=(0,C.useState)(null),[Ae,Ie]=(0,C.useState)(!1),Oe=(0,C.useRef)(null);(0,C.useEffect)(()=>{(0,J.ensureAttendance)(v,S),(0,_.ensureChat)(S)},[v]),globalThis.__ccNow=S.getTime();const Le=(0,_.useChatUnread)().total,We=(0,C.useRef)({t:'home',s:null});We.current={t:Me,s:Be};const ze=(0,C.useRef)([]),He=(0,C.useCallback)((e,s=null)=>{const t=We.current;t.t===e&&t.s===s||(ze.current=[...ze.current,{...t,y:Ne.leave()}].slice(-30),Ne.restore(0)),Re(e),Pe(s)},[]),Ee=(0,C.useCallback)(()=>{if((0,u.runBackLayer)())return!0;const e=We.current;let s=ze.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=ze.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Ne.leave(),Re(t.t),Pe(t.s),Ne.restore(t.y??0),!0},[]);(0,u.useWebBack)(Ee);const De=(0,u.useInnerBackShown)();(0,C.useEffect)(()=>{j.PITCH&&(globalThis.__pitchGo=He)},[He]),(0,F.useShiftReminders)({rid:r,staffId:w,name:n,onStartBreak:()=>He('clock')}),(0,U.useScheduledNotices)({rid:r,staffId:ne?.id??'',name:n,onOpen:()=>He('me','orderlists')}),(0,$.useOffRotaPrompt)({rid:r,staffId:ne?.id??''});const Ne=(0,c.useScrollMemory)(Oe),Ve=(0,C.useCallback)((e,s=null)=>'chat'===e?He('chat'):'clock'===s?He('clock'):'rota'===s?He('rota'):s&&je.some(e=>e.id===s)?He('me',s):'blocks'===s&&ce?He('me','mgr-blocks'):void He('home'===e?'home':'me'),[He,ce]);(0,C.useEffect)(()=>{const e=P.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]);const Fe='me'===Me&&Be?je.find(e=>e.id===Be)??(ce?Ce.find(e=>e.id===Be):void 0):void 0,Ue=(0,Q.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),$e=je.filter(e=>('suppliers'!==e.id||Te)&&('orderlists'!==e.id||Ue||ne&&'staff'!==ne.role));(0,C.useEffect)(()=>{D.useOwner.getState().staffAs&&D.useOwner.setState({staffAs:void 0})},[]);(0,L.default)().width;return(0,me.jsxs)(W.SafeAreaView,{style:{flex:1,backgroundColor:N.colours.bg},edges:['top','left','right','bottom'],children:[(0,me.jsxs)(O.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:N.colours.border,gap:6},children:[(0,me.jsx)(O.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,me.jsx)(E.VoiceSlot,{size:44})}),(0,me.jsx)(O.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,me.jsx)(A.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,i.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${de?`, ${de}`:''}`,onPress:()=>Ie(!0),hitSlop:6,style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,me.jsxs)(z.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,me.jsx)(fe.StaffAvatar,{id:w,size:24,ring:!1}),(0,me.jsxs)(O.default,{style:{flexShrink:1},children:[(0,me.jsxs)(z.T,{size:13,weight:"semibold",colour:N.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),ne?'':' (preview)'," \u25be"]}),de?(0,me.jsx)(z.Muted,{center:!1,size:10,numberOfLines:1,children:de}):null]})]})})}),(0,me.jsx)(H.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,me.jsxs)(I.default,{ref:Oe,...Ne.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,me.jsx)(u.BackTitleRow,{back:!('home'===Me&&!Be||De),onBack:Ee,title:Fe?Fe.title:xe[Me]}),'home'===Me&&ce?(0,me.jsx)(Z.ManagerFeaturesNote,{}):null,'home'===Me&&ne&&'staff'!==ne.role&&!ce&&'undefined'!=typeof window?(0,me.jsxs)(O.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:N.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"You have manager access"}),(0,me.jsx)(z.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,me.jsx)(A.default,{accessibilityRole:"button",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:N.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,me.jsx)(z.T,{size:14,colour:N.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Me&&ne?(0,me.jsx)(k.MyTasksToday,{rid:r,staffId:ne.id,name:ne.name,onShift:(0,F.shiftNow)(ne.id,S.getTime()).on}):null,'home'===Me?(0,me.jsx)(ve,{go:Ve}):null,'clock'===Me?(0,me.jsx)(re.ClockInOut,{}):null,'rota'===Me?(0,me.jsx)(re.Rota,{}):null,'chat'===Me?(0,me.jsx)(_.Chat,{go:Ve}):null,'me'!==Me||Fe?null:(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.border,backgroundColor:N.colours.surface,overflow:'hidden'},children:$e.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),ce?(0,me.jsxs)(O.default,{testID:"manager-features",style:{gap:6},children:[(0,me.jsx)(z.T,{weight:"semibold",colour:N.colours.gold,children:"Manager features"}),(0,me.jsx)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:N.colours.gold,backgroundColor:N.colours.surface,overflow:'hidden'},children:Ce.map((e,s)=>(0,me.jsx)(A.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>He('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:N.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,me.jsxs)(z.Row,{style:{justifyContent:'space-between'},children:[(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"medium",children:e.title}),(0,me.jsx)(z.Muted,{children:e.sub})]}),(0,me.jsx)(z.T,{colour:N.colours.muted,children:"\u203a"})]})},e.id))}),(0,me.jsx)(Z.ManagerFeaturesAbout,{})]}):null,Te?null:(0,me.jsx)(z.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,me.jsxs)(z.Muted,{center:!0,children:["Staff app \xb7 ",x.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),ce&&Fe?.id.startsWith('mgr-')?(0,me.jsxs)(J.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===Fe.id?(0,me.jsx)(s.TablePlan,{}):null,'mgr-times'===Fe.id?(0,me.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===Fe.id?(0,me.jsx)(V.Bookings,{}):null,'mgr-clear'===Fe.id?(0,me.jsx)(Z.TablesToClear,{rid:r}):null,'mgr-blocks'===Fe.id?(0,me.jsx)(K.BlocksPage,{}):null,'mgr-allergy'===Fe.id?(0,me.jsx)(q.AllergenSignOffLog,{}):null,'mgr-stock'===Fe.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(X.TrackedStockPage,{}),(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===Fe.id?(0,me.jsx)(Z.ClockOverview,{today:v,now:S}):null,'mgr-swaps'===Fe.id?(0,me.jsx)(Z.SwapApprovals,{today:v,me:n}):null]}):null,'loyalty'===Fe?.id?(0,me.jsx)(h.StaffLoyalty,{venue:e.name}):null,'guests'===Fe?.id?(0,me.jsx)(f.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===Fe?.id?(0,me.jsx)(V.Bookings,{}):null,'giftcards'===Fe?.id?(0,me.jsx)(p.GiftCardsPage,{me:n.replace(' (example)','')}):null,'tableorders'===Fe?.id?(0,me.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)','')}):null,'soldout'===Fe?.id?(0,me.jsx)(b.SoldOutList,{rid:r,by:n.replace(' (example)','')}):null,'board'===Fe?.id?(0,me.jsx)(B.QuestionBoard,{rid:r,today:v,manager:!1,by:""}):null,'recipecards'===Fe?.id?(0,me.jsx)(T.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===Fe?.id?(0,me.jsx)(pe.AvatarMaker,{meId:w,me:n}):null,'cashup'===Fe?.id?(0,me.jsx)(Se,{rid:r,today:v,meId:w,me:n}):null,'haccp'===Fe?.id?(0,me.jsx)(he.HaccpLog,{mode:"staff",me:n,meId:w,now:S}):null,'accidents'===Fe?.id?(0,me.jsx)(ue.AccidentBook,{app:"staff",me:n,meId:w,now:S,seeAll:!1}):null,'mypay'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(ae.MyHoursPay,{staffId:w})]}):null,'mytips'===Fe?.id?(0,me.jsx)(le.MyTips,{}):null,'reviews'===Fe?.id?(0,me.jsx)(M.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(oe.MyPeriods,{staffId:w}),(0,me.jsx)(re.Timesheets,{})]}):null,'orderlists'===Fe?.id?(0,me.jsx)(G.OrderListsScreen,{rid:r,today:v,editor:!!ne&&'staff'!==ne.role&&!ce,who:{id:w,name:n.replace(' (example)','')}}):null,'phone'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.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,me.jsx)(Y.PushButton,{})]}):null,'suppliers'===Fe?.id?Te?(0,me.jsx)(ie.Suppliers,{}):(0,me.jsx)(z.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===Fe?.id?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,i.privateClockVenue)(r)?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(z.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,me.jsx)(z.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,me.jsxs)(me.Fragment,{children:[" ",(0,me.jsx)(z.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,me.jsxs)(z.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,me.jsx)(z.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,me.jsx)(te.BottomTabs,{background:(0,o.soutersSurface)('#0d0d0d'),active:Me,onPress:e=>He(e),tabs:ye.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Le?{text:String(Le),bg:N.colours.red}:null}))}),(0,me.jsx)(z.Sheet,{visible:Ae,onClose:()=>Ie(!1),title:"Signed in as",children:ne?(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsxs)(z.Row,{gap:10,children:[(0,me.jsx)(fe.StaffAvatar,{id:ne.id,size:48}),(0,me.jsxs)(O.default,{style:{flex:1},children:[(0,me.jsx)(z.T,{weight:"semibold",children:ne.name}),(0,me.jsx)(z.Muted,{children:(0,se.levelJob)(ne.level??'Staff',ne.job)})]})]}),(0,me.jsx)(z.Muted,{children:"Signed in with your personal link. This phone remembers you."}),ce?(0,me.jsx)(z.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===ne.role||ce?null:(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,se.appUrl)('owner');e&&window.location.assign(e)}}),ne.id===be?(0,me.jsx)(z.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,se.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,me.jsxs)(O.default,{style:{gap:8},children:[(0,me.jsx)(z.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,me.jsx)(ee.SignInWithLink,{})]})})]})}function ve({go:e}){const{rid:s,today:t}=(0,J.useCtx)(3e4),o=(0,de.useTravelDay)('staff',t);return(0,me.jsxs)(O.default,{style:{gap:10},children:[(0,me.jsx)(n.WhoBar,{}),(0,me.jsx)(de.DayBar,{app:"staff",today:t}),o?null:(0,me.jsx)(r.CoversToday,{rid:s}),o?(0,me.jsx)(de.DayView,{rid:s,day:o,today:t,app:"staff"}):(0,me.jsx)(ne.StaffHome,{go:e})]})}function Se({rid:e,today:s,meId:t,me:o}){return!0!==(0,S.useCashAccess)(e=>e.mine)?(0,me.jsx)(v.NoCashUpAccess,{}):(0,me.jsx)(w.CashUpScreen,{rid:e,today:s,canEdit:!0,who:{id:t??'me',name:o.replace(' (example)','')}})}},1341,[1342,1346,798,991,1073,1347,1161,1040,1041,1348,1350,1353,1130,977,1042,2,1047,1048,1355,993,34,1132,1182,1186,1156,373,402,295,102,426,36,794,847,1116,865,840,1135,1356,1070,1085,1086,1082,1043,1025,1100,1363,1364,1365,1373,1374,997,236,1188,1145,1151,1370,1155,1154,1381,1148,15,1162,1163,899,793,985,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[S,P]=(0,t.useState)(null),[C,D]=(0,t.useState)(T.areas[0]?.id??''),[I,M]=(0,t.useState)(null),B=T.areas.find(e=>e.id===C)??T.areas[0],N=(0,x.planCounts)(T),O=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[N.tables," tables \xb7 ",N.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>P(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:O.has(e.id)?'red':'neutral',label:O.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>P('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>P('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>P('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,B?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:B.id,onPick:D,closed:O,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:B.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,I?(0,k.jsx)(h.Banner,{kind:"success",title:I}):null,(0,k.jsx)(l.default,{visible:!!S,animationType:"slide",onRequestClose:()=>P(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:S?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",startStep:S,onSave:e=>{x.useFloor.getState().setPlan(s,e),P(null),M('Table plan saved. The Display uses it straight away.')},onCancel:()=>P(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(T,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(S,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function T({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function S(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1342,[796,34,1033,395,102,1107,1108,1293,1316,794,1011,1014,827,840,1100,1015,1343,1344,1035,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1343,[796,34,402,102,794,840,1014,5,1015,846,985,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1344,[34,102,794,1014,1345,828,840,1060,931,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.planReadAfter=function(t,o){return o.ok?o.tables.length?{photo:t,rows:o.tables,note:''}:{photo:t,rows:[],note:'Nothing readable on that photo. The photo is still here.'}:{photo:t,rows:null,note:o.message}},e.cleanFindings=function(o){if(!o||'object'!=typeof o)return[];const n=o.tables;if(!Array.isArray(n))return[];const s=[];for(const o of n.slice(0,80)){if(!o||'object'!=typeof o)continue;const n=t(o.area,40),c=t(o.name,12),l=o.seats;!n||!c||'number'!=typeof l||!Number.isInteger(l)||l<1||l>30||s.push({area:n,name:c,seats:l})}return s};const t=(t,o)=>'string'==typeof t?t.trim().slice(0,o):''},1345,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:n}=(0,l.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[b,h]=(0,t.useState)(String(e.settings.turnMins??'')),[y,v]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[f,k]=(0,t.useState)(!1),M=(e,t,n)=>c(s=>({...s,[e]:0===t?[n,s[e]?.[1]??'']:[s[e]?.[0]??'',n]})),S=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(b)<=360&&Number(y)>=1&&Number(y)<=1e3;return(0,r.jsxs)(s.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(n=>({...n,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>M(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>M(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:b,onChangeText:h,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:y,onChangeText:v,keyboardType:"number-pad"})]}),(0,r.jsx)(i.Button,{label:f?'Saving\u2026':'Save booking times',disabled:!S||f,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{k(!0);try{await(0,o.saveStaffBookingTimes)(n,u,Number(b),Number(y)),j('Booking times saved.')}catch(e){j(e.message)}finally{k(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),n=_r(_d[1]),s=(e=n)&&e.__esModule?e:{default:e},i=_r(_d[2]),l=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1346,[34,102,794,1100,985,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1347,[829,34,102,794,830,836,1131,848,838,840,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1348,[985,34,281,236,102,1226,794,1201,1204,840,1349,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1349,[34,236,102,794,1201,25]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1350,[34,102,794,830,1201,1351,1352,840,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GUEST_CONSENT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PREFERENCE_IDEAS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIT_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"allergyLine",{enumerable:!0,get:function(){return l}}),e.tidyPrefs=function(t){const n=new Set,a=[];for(const o of t){const t=o.trim().slice(0,60),s=t.toLowerCase();t&&!n.has(s)&&(n.add(s),a.push(t))}return a.slice(0,20)},e.toggleAllergy=function(t,n,a="allergy"){return t.some(t=>t.allergen===n)?t.filter(t=>t.allergen!==n):[...t,{allergen:n,severity:a}]},e.exportFileName=function(t,n){const a=t.split(/\s+/).filter(Boolean).map(t=>t[0].toUpperCase()).join('').replace(/[^A-Z]/g,'').slice(0,3)||'G',o=n.toISOString().slice(0,10);return`guest-data-${a}-${o}.json`},e.visitWords=function(t,n){return t?`${t} visit${1===t?'':'s'} \xb7 ${n} Covers`:'No visits yet'};var t=r(_d[0]);const n='Guest agreed we can keep a profile with their visits, preferences and allergies, to look after them when they come back. They can ask to see it or have it erased at any time.',a=['Window table','Quiet corner','Booth','High chair','Step-free access','Dog with them','Still water','Sparkling water','Vegetarian','Vegan'],o={made:'Profile made',details:'Preferences or notes changed',allergies:'Allergies checked and saved',consent:'Consent changed',export:'Data exported','erase-asked':'Asked to erase','erase-approved':'Owner approved erasing','erase-declined':'Owner declined erasing',erased:'Erased'},s={finished:'Visited',seated:'Visited',confirmed:'Booked',pending:'Waiting to confirm',cancelled:'Cancelled',noshow:'No-show'},l=n=>n.length?n.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity)})`).join(', '):'None'},1351,[830]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return u.staffServer}}),Object.defineProperty(e,"guestSearch",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"guestGet",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"guestMake",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"guestUpdate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"guestSignAllergies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"guestConsent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"guestExport",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"guestEraseAsk",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"guestEraseDecide",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"guestEraseApply",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"guestEraseList",{enumerable:!0,get:function(){return j}}),e.saveJsonFile=function(t,n){if('undefined'==typeof document||'undefined'==typeof Blob)return!1;const u=new Blob([JSON.stringify(n,null,2)],{type:'application/json'}),p=URL.createObjectURL(u),o=document.createElement('a');return o.href=p,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(p),2e3),!0};var t=r(d[0]),n=r(d[1]),u=r(d[2]);const p=()=>{const n=t.useSync.getState().venueId;if(!n)throw new Error('Not connected to the venue yet.');return n},o=n=>(0,t.rpc)('guest_search',{p_venue:p(),p_q:n}),c=n=>(0,t.rpc)('guest_profile_get',{p_id:n}),s=(u,o)=>(0,t.rpc)('guest_profile_make',{p_venue:p(),p_name:u.name.trim(),p_phone:u.phone.trim()||null,p_email:u.email.trim()||null,p_consent:u.consent,p_consent_text:n.GUEST_CONSENT,p_by:o}),_=(n,u,p,o)=>(0,t.rpc)('guest_profile_update',{p_id:n,p_preferences:u,p_notes:p,p_by:o}),a=(n,u,p)=>(0,t.rpc)('guest_profile_sign_allergies',{p_id:n,p_allergies:u,p_by:p}),f=(n,u,p,o)=>(0,t.rpc)('guest_profile_consent',{p_id:n,p_marketing:u,p_withdraw:p,p_by:o}),l=(n,u)=>(0,t.rpc)('guest_profile_export',{p_id:n,p_by:u}),b=(n,u,p)=>(0,t.rpc)('guest_erase_request',{p_id:n,p_reason:u,p_by:p}),y=(n,u,p)=>(0,t.rpc)('guest_erase_decide',{p_req:n,p_ok:u,p_by:p}),O=(n,u)=>(0,t.rpc)('guest_erase_apply',{p_req:n,p_by:u}),j=()=>(0,t.rpc)('guest_erase_list',{p_venue:p()})},1352,[985,1351,1204]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=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)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1353,[5,1354,34,102,794,836,1201,1202,1203,985,1204,840,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1354,[34,794,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1355,[34,102,794,840,993,1037,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e}={}){const{rid:C,r:X,now:Z,today:ee,me:se,role:te}=(0,p.useCtx)(1e4),le=(0,v.useBookings)(C),ne=(0,p.useInStaffApp)(),ie=(0,p.useShiftManager)(),ae=(0,v.useWaitlist)(C),[oe,de]=((0,v.useStore)(e=>e.alertAcks),(0,T.useState)(ee)),re=(0,R.useFrontDoor)(oe),ue=(0,k.useBookingWrite)(),[ce,he]=(0,T.useState)(''),[ge,be]=(0,T.useState)(!1),[pe,ke]=(0,T.useState)(2),me=oee.date===oe).sort((e,s)=>e.time.localeCompare(s.time)),ye=ae.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),we=xe.filter(e=>'noshow'===e.status),je=(0,V.useSync)(e=>!!e.venueId&&'guest'!==e.kind),fe=xe.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ie=(0,c.cancelledDayTally)(le,oe),Be=(0,c.cancelledTallyWords)(Ie,oe===ee?'today':'that day'),Se=xe.filter(e=>!e.walkIn),De=xe.filter(e=>e.walkIn),$e=le.filter(e=>'pending'===e.status&&e.date>=ee).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Te,Ce]=(0,T.useState)(null),Le=(0,M.parseYmd)(oe);Le.setHours(12);const Ne=(0,Q.hoursFor)(X,Le),Pe=Ne?.open??new Date(`${oe}T12:00:00`),ve=Ne?.close??new Date(`${oe}T21:00:00`),Oe=Ne||xe.length?me?'No one seated that day':oe===ee?'No bookings yet today':'No bookings yet':oe===ee?'Closed today':'Closed that day';return(0,J.jsxs)(L.default,{style:{gap:12},children:[e&&!ne&&'staff'!==te?(0,J.jsx)(N.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===C)&&!ne&&'staff'!==te?(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"table"}):null,!s.IS_WILDINGS&&!X.settings.hotel?.enabled||ne||'staff'===te?null:(0,J.jsx)(n.VenueRequestList,{rid:C,kind:"room",hotel:X.settings.hotel??l.WILDINGS_HOTEL}),(0,J.jsx)(G.BookingsDayNav,{today:ee,date:oe,onDate:de,count:e=>le.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=le.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,J.jsx)(L.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,J.jsx)(q.DayGraph,{bare:!0,fill:!0,todays:xe,open:Pe,close:ve,now:Z,turnBase:X.settings.turnMins,height:128,past:me,closed:!Ne,emptyText:Oe})}),me?(0,J.jsxs)(L.default,{testID:"bookings-past-totals",style:[N.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,G.longDay)(oe)}: ${Se.length} tables, ${fe} Covers, ${xe.filter(e=>'finished'===e.status).length} finished, ${we.length} no-shows, ${xe.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,J.jsxs)(N.T,{size:17,weight:"semibold",children:["That day: ",Se.length," table",1===Se.length?'':'s',De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']}),(0,J.jsxs)(N.T,{size:16,colour:A.colours.text,children:[xe.filter(e=>'finished'===e.status).length," finished \xb7 ",we.length," no-show",1===we.length?'':'s'," \xb7 ",xe.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,J.jsx)(N.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,J.jsx)(L.default,{testID:"bookings-summary",children:(0,J.jsxs)(N.T,{weight:"semibold",children:[Se.length," table",1===Se.length?'':'s'," booked",De.length?` \xb7 ${De.length} walk-in${1===De.length?'':'s'}`:''," \xb7 ",fe," ",1===fe?'Cover':'Covers']})}),(0,J.jsx)(L.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Be,style:{alignItems:'center'},children:(0,J.jsx)(N.T,{size:15,colour:A.colours.muted,center:!0,children:Be})}),(0,J.jsxs)(L.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[me?null:(0,J.jsx)(I.QuietButton,{label:"New booking",onPress:re.openBooking,testID:"add-booking",disabled:!ue.ok,accessibilityHint:ue.hint}),ne&&ie&&oe===ee?(0,J.jsx)(I.QuietButton,{label:"Walk-in",onPress:re.openWalkIn,testID:"add-walkin",disabled:!ue.ok,accessibilityHint:ue.hint}):null,oe===ee?(0,J.jsx)(B.CloseGardenButton,{quiet:!0,short:!0,rid:C,r:X,now:Z,by:se}):null]}),$e.length?(0,J.jsxs)(L.default,{testID:"pending-requests",style:[N.styles.card,{borderColor:A.colours.amber,gap:8}],children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:A.colours.amber,children:["Needs confirming (",$e.length,")"]}),(0,J.jsx)(N.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),$e.map(e=>(0,J.jsxs)(L.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:A.colours.border},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,J.jsxs)(N.Muted,{children:[(0,M.niceDate)((0,M.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,J.jsxs)(N.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,J.jsx)(S.NeedsPills,{b:e,r:X}),'staff'!==te&&((0,D.needsHoldOk)(e)||e.date===ee&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,D.needsHoldOk)(e)?(0,J.jsx)(N.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,S.confirmHolds)(e.id,se)}):null,e.holdOk&&'seated'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,S.serveHolds)(e,se,'owner')}):null]}):null,Te===e.id?(0,J.jsxs)(L.default,{style:{gap:6},children:[(0,J.jsxs)(N.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{v.repo.bookings.decide(e.id,'declined',se),Ce(null)}}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ce(null)})]})]}):ue.ok?(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(N.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>v.repo.bookings.decide(e.id,'confirmed',se)}),(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ce(e.id)}),(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"change"})]}):(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),(0,J.jsx)(F.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===xe.length?(0,J.jsx)(N.Muted,{children:"No bookings for this day yet."}):null,xe.map(e=>{const s='confirmed'===e.status&&oe===ee&&(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)>15,t=(0,w.depositState)(e),l=(0,w.depositBadge)(e,W.gbp);return(0,J.jsxs)(L.default,{testID:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[N.styles.card,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,$.seatedHighlightStyle)({borderColor:(0,D.hasAllergens)(e)?A.colours.red:A.colours.goldLight}):{borderColor:(0,D.hasAllergens)(e)?A.colours.red:s?A.colours.amber:A.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,J.jsx)(S.AllergenBar,{b:e}),(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,J.jsxs)(N.T,{weight:"semibold",colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?$.SEATED_FG:A.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,R.walkInLabel)(e)]}),(0,D.hasAllergens)(e)?(0,J.jsx)(P.AllergyIcon,{text:(0,D.allergenText)(e),size:20,colour:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?'#7A4A00':A.colours.amber,ink:(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?A.colours.gold:A.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,J.jsx)(N.Badge,{kind:'seated'===(0,D.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,D.shownStatus)(e)[0].toUpperCase()+(0,D.shownStatus)(e).slice(1)})]}),l?(0,J.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,$.isSeatedHighlight)((0,D.shownStatus)(e))?(0,J.jsxs)(N.T,{size:14,colour:$.SEATED_MUTED,children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,J.jsxs)(N.Muted,{children:[e.table?(0,z.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,J.jsxs)(N.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,l?(0,J.jsxs)(N.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[me||!(0,w.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,R.walkInLabel)(e)}`,onPress:()=>v.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:se,depositPaidAt:(new Date).toISOString()})}),me?null:(0,J.jsx)(j.WixDepositLink,{b:e,rid:C}),'paid'===t&&e.depositPaidBy?(0,J.jsx)(N.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,J.jsxs)(N.Muted,{children:[(0,K.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,J.jsx)(N.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,J.jsx)(N.Badge,{kind:"red",label:`${(0,O.allergenLabel)(e.allergen)} \xb7 ${(0,O.severityLabel)(e.severity)}`},e.allergen))}):null,(0,D.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,J.jsx)(U.BookingAllergyChain,{b:e,me:se}):null,e.walkIn?null:(0,J.jsx)(F.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,J.jsxs)(N.T,{size:13,colour:A.colours.amber,children:["Running ",(0,M.minsBetween)(new Date(`${e.date}T${e.time}:00`),Z)," min late. Call them, then mark no-show if needed."]}):null,(0,J.jsxs)(N.Row,{wrap:!0,gap:6,children:[(0,J.jsx)(r.BookingTableButton,{rid:C,booking:e,readOnly:me||!ue.ok,turnBase:X.settings.turnMins}),ue.ok?null:(0,J.jsx)(L.default,{accessible:!0,accessibilityLabel:x.BOOKING_VIEW_ONLY,children:(0,J.jsx)(N.T,{children:x.BOOKING_VIEW_ONLY})}),ue.ok?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u.BookingEditButton,{rid:C,booking:e,who:se,role:te,inStaffApp:ne,shiftManager:ie}),me||e.table||!['seated','confirmed'].includes(e.status)?null:(0,J.jsx)(N.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>re.assignTable(e)}),!me&&['seated','confirmed'].includes(e.status)?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,z.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,R.walkInLabel)(e)}`,onPress:()=>re.combineTables(e)}):null,me||'confirmed'!==e.status?null:(0,J.jsxs)(J.Fragment,{children:[e.date===ee?(0,J.jsx)(N.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,R.walkInLabel)(e)} now`,onPress:()=>(0,R.seatBookingNow)(C,e)}):null,(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>v.repo.bookings.setStatus(e.id,'noshow')})]}),me||e.walkIn?null:(0,J.jsx)(d.CancelBookingButton,{rid:C,b:e,name:(0,R.walkInLabel)(e),small:!0,onDone:()=>{}}),me||e.walkIn?null:(0,J.jsx)(d.ReinstateBookingButton,{b:e,name:(0,R.walkInLabel)(e),today:ee}),me||'seated'!==e.status?null:(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,R.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,R.finishBookingNow)(C,e)}),['confirmed','pending'].includes(e.status)&&e.date>=ee?(0,J.jsx)(Y.WhatsAppGuest,{b:e,rid:C,kind:"auto"}):null,ne?null:(0,J.jsx)(f.CopyReviewLink,{rid:C,bookingId:e.id}),!me&&e.walkIn?(0,J.jsx)(o.CancelWalkInButton,{rid:C,b:e,small:!0}):null,!me&&e.walkIn?(0,J.jsx)(o.ReinstateWalkInButton,{rid:C,b:e,today:ee,small:!0}):null,(0,J.jsx)(H.BookingUndo,{b:e,rid:C,today:ee,who:(0,R.walkInLabel)(e)})]}):null]}),'noshow'===e.status&&'paid'===t?(0,J.jsx)(N.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,J.jsx)(b.CancellationsSection,{testID:"bookings-cancellations",items:(0,h.cancellationsFor)(le,oe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:oe===ee?'today':'that day'}),(0,J.jsxs)(N.Card,{children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsx)(N.T,{weight:"semibold",children:"No-shows"}),(0,J.jsx)(N.Badge,{kind:we.length?'red':'ok',label:`${we.length} ${oe===ee?'today':(0,M.niceDate)((0,M.parseYmd)(oe)).slice(0,6)}${je||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,J.jsx)(N.Muted,{children:we.length?`Marked no-show today: ${we.slice(0,6).map(e=>`${e.time} ${(0,R.walkInLabel)(e)}`).join(', ')}${we.length>6?` and ${we.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,J.jsx)(t.GreensideCashOnly,{}):(0,J.jsxs)(N.Card,{children:[(0,J.jsx)(N.T,{weight:"semibold",children:"Deposits"}),(0,J.jsx)(N.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,w.depositOf)(X.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,W.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,J.jsx)(N.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),ye.length>0||ge?(0,J.jsxs)(L.default,{style:{gap:10},children:[(0,J.jsx)(E.SectionHead,{title:`Waitlist (${ye.length})`,sub:`New party waits about ${(0,_.estimateWait)(ye.length+1,X.settings.turnMins,1)} min (estimate)`}),ye.map((e,s)=>(0,J.jsxs)(L.default,{style:N.styles.card,children:[(0,J.jsxs)(N.Row,{style:{justifyContent:'space-between'},children:[(0,J.jsxs)(N.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,J.jsxs)(N.Muted,{children:[(0,M.minsBetween)(new Date(e.joinedAt),Z)," min \xb7 est. ",(0,_.estimateWait)(s+1,X.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,J.jsx)(N.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,J.jsxs)(N.Row,{gap:6,children:['waiting'===e.status?(0,J.jsx)(N.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>v.repo.waitlist.setStatus(e.id,'notified')}):null,(0,J.jsx)(N.Button,{small:!0,label:"Seat",onPress:()=>v.repo.waitlist.setStatus(e.id,'seated')}),(0,J.jsx)(N.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>v.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,J.jsxs)(N.Row,{gap:6,children:[(0,J.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ce,onChangeText:he,style:[N.styles.input,{flex:1}]}),(0,J.jsx)(N.Stepper,{value:pe,onChange:ke,min:1,max:12,label:"party"})]}),(0,J.jsx)(N.Button,{kind:"secondary",label:"Add to waitlist",disabled:ce.trim().length<2,onPress:()=>{v.repo.waitlist.join(C,ce.trim(),pe),he('')}})]}):(0,J.jsx)(N.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>be(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"}),re.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),S=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=(e=C)&&e.__esModule?e:{default:e},N=_r(_d[27]),P=_r(_d[28]),v=_r(_d[29]),O=_r(_d[30]),W=_r(_d[31]),M=_r(_d[32]),_=_r(_d[33]),A=_r(_d[34]),E=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),U=_r(_d[40]),F=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47])},1356,[5,1354,11,1357,796,806,1112,1113,1091,1115,1114,1328,1329,1100,1282,1012,1089,14,1358,1182,1359,1316,1081,1075,1090,34,102,794,1291,848,830,836,827,1267,840,1147,1096,1014,1360,1361,1136,1362,1173,985,1149,1324,852,25]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1357,[6,34,102,794,985,1213,25]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1358,[796,5,34,379,236,102,794,850,14,836,1017,931,840,1150,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1359,[34,402,1143,794,840,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1360,[34,102,848,1014,794,840,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1361,[34,402,102,794,840,25]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1362,[34,102,853,848,833,840,794,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1363,[34,1317,1100,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1364,[829,34,102,1136,794,848,830,838,827,840,1147,1100,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>x.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[w,b]=(0,n.useState)(!0),[v,S]=(0,n.useState)(null),[_,C]=(0,n.useState)(''),[T,P]=(0,n.useState)(!1),I=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),C('')}catch(e){C(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{I()},[I]),!e||'signin'===s||'local'===s)return(0,j.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,j.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const B=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(P(!1),S({code:s.code,label:e.label,expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}},[R,D]=(0,n.useState)(null),[M,A]=(0,n.useState)(null),[$,N]=(0,n.useState)(!1),F=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),S(null),A(null),I()}catch(e){C(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),I()}catch(e){C(String(e?.message??e))}};return(0,j.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,j.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,j.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,j.jsx)(i.T,{size:14,children:"Code lasts"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,j.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,j.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:w,onChange:b}),(0,j.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:w}))?.[0];s&&(P(!1),S({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),I()}catch(e){C(String(e?.message??e))}}}),v?(0,j.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:[(0,j.jsxs)(i.T,{size:13,colour:y.colours.muted,children:[v.label," \xb7 ",'infinity'!==v.expires&&v.expires?`until ${k(v.expires)}`:'Forever (until used or revoked)']}),(0,j.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:v.code.replace(/(.{5})/,'$1 ')}),(0,j.jsx)(i.Button,{kind:"secondary",label:T?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(f(v.code));P(e),e||C('Copy is not available on this device. Use the pairing code shown above.')}}),(0,j.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),_?(0,j.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:_}):null,(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:I})]}),0===l.length?(0,j.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>$||!e.revoked_at).map(e=>(0,j.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:y.colours.border,gap:4},children:[(0,j.jsxs)(o.default,{style:{gap:4},children:[(0,j.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,j.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?y.colours.red:e.sessions?y.colours.ok:y.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,j.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?M===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,j.jsxs)(i.Row,{wrap:!0,children:[(0,j.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{F(e)}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:R===e.id?(0,j.jsxs)(o.default,{style:{gap:6},children:[(0,j.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{D(null),U(e)}}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>D(null)})]})]}):(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>B(e)}),(0,j.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>D(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:$?"Hide switched-off displays":"Show switched-off displays",onPress:()=>N(!$)}):null,(0,j.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,x]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,j.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>x({...e})}):null]}),(0,j.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,j.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>x(b())}):null,r?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,j.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>x({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,j.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>x({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>x({...r,unit:'whole'})}),'roast'===r.group?null:(0,j.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>x({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,j.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>x({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,j.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;x({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,j.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>x({...r,icon:e.slice(0,4)})}),(0,j.jsx)(i.T,{size:14,children:"Supplier"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>x({...r,supplierId:void 0})}),l.map(e=>(0,j.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>x({...r,supplierId:e.id})},e.id))]}),(0,j.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>x({...r,active:e})}),(0,j.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>x(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),x(null))}}),(0,j.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>x(null)})]}),(0,j.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,w.validGameUrl)(a);return(0,j.jsxs)(o.default,{style:{gap:10},children:[(0,j.jsx)(i.Card,{children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.default,{style:{flex:1},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,j.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,j.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,j.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",w.LENNY_GAME_URL,")."]}),(0,j.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:w.LENNY_GAME_URL}),c?null:(0,j.jsx)(i.T,{size:13,colour:y.colours.red,children:"Use a full https:// address."}),(0,j.jsxs)(i.Row,{gap:6,children:[(0,j.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,w.validGameUrl)(a):void 0})}),t?(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',f=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const b=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1365,[804,982,1366,34,236,102,794,800,865,981,1016,983,985,840,2,1137,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,C.useCtx)(6e4),n=(0,x.useBookings)(t),i=(0,x.useOrders)(t),a=(0,x.useEvents)(t),r=(0,x.useRatings)(t),d=(0,o.useMemo)(()=>(0,R.insights)(s,n,i,a,r,l,64),[s.id,n.length,i.length,r.length]);return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Muted,{children:(0,O.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,L.jsx)(N.FadeIn,{delay:80*s,children:(0,L.jsxs)(p.Card,{highlight:H[t.tone],children:[(0,L.jsxs)(p.Row,{style:{alignItems:'flex-start'},children:[(0,L.jsx)(p.T,{size:22,children:t.icon}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:t.body})]})]}),t.action?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,O.useExamples)()?(0,L.jsx)(W,{}):(0,L.jsx)(F,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,C.useCtx)(6e4),s=(0,O.useExamples)(),{width:l}=(0,g.default)(),n=(0,x.useAllMenu)(e),i=(0,R.dishStats)(n),a=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),r=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:w.colours.ok,'Plough horse':w.colours.amber,Puzzle:w.colours.blue,Dog:w.colours.red},d=i.map(e=>({...e,q:(0,R.quadrant)(e.sold,e.margin,a,r)}));return s?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Margin vs popularity"}),(0,L.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:d.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:a,yMid:r/100}),(0,L.jsx)(p.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,L.jsxs)(p.Row,{gap:4,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,L.jsx)(p.Muted,{children:e})]},e))}),(0,L.jsx)(p.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=d.filter(t=>t.q===e);return t.length?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.Row,{style:{justifyContent:'space-between'},children:(0,L.jsxs)(p.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,L.jsx)(p.Muted,{children:R.QUADRANT_TIP[e]}),t.map(e=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.item.name}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,y.gbp)(e.margin)]}),(0,L.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(x.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,T.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?w.colours.amber:w.colours.border},children:(0,L.jsx)(p.T,{size:11,colour:e.item.soldOut?w.colours.amber:w.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,L.jsxs)(p.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough data yet"}),(0,L.jsx)(p.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,C.useCtx)(6e4),r=(0,b.useOwner)(e=>e.suppliers),d=(0,x.useBookings)(t),c=(0,x.useOrders)(t),u=(0,x.useEvents)(t),g=(0,b.useOwner)(e=>e.checks),m=(0,B.useRealHistory)(t,n),j=(0,o.useMemo)(()=>(0,s.forecastToday)(l,d,c,u,n,m??void 0),[l.id,d.length,c.length,n.getHours(),m]),y=j.restOfDay.high+2*j.restOfDay.takeaway,k=(0,R.stockList)();return(0,L.jsxs)(h.default,{style:{gap:10},children:[j.enough?(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(j.restOfDay.low,j.restOfDay.high)," + about ",j.restOfDay.takeaway," takeaways"]}),(0,L.jsx)(p.Muted,{children:j.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:j.minWeeks,booked:j.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),k.length?null:(0,L.jsx)(p.Card,{children:(0,L.jsx)(p.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),k.map(t=>{const s=Math.ceil(y*t.perCover*10)/10,l=s>t.onHand,o=(0,M.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=g[d];return(0,L.jsxs)(h.default,{style:[p.styles.card,{borderColor:l?w.colours.red:w.colours.border}],children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsx)(p.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,L.jsxs)(p.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,L.jsxs)(p.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,L.jsx)(p.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?b.useOwner.getState().untick(d):b.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,b.useOwner)(e=>e.customerTags),[s,l]=(0,o.useState)(''),[n,i]=(0,o.useState)('All'),[a,r]=(0,o.useState)(null),d=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=d.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:p.styles.input}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,L.jsx)(p.Chip,{label:`${e} (${d.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,L.jsxs)(p.Card,{onPress:()=>r(t.id),children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.name}),(0,L.jsxs)(p.Muted,{children:[t.visits," visits"]})]}),(0,L.jsxs)(p.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,y.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,L.jsxs)(p.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,L.jsx)(p.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,L.jsx)(p.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,L.jsx)(p.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,L.jsxs)(p.Sheet,{visible:!0,onClose:()=>r(null),title:g.name,children:[(0,L.jsxs)(p.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,L.jsxs)(p.T,{children:["Lifetime spend ",(0,y.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,L.jsx)(p.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,L.jsx)(p.Muted,{children:"No allergies on file."}),g.birthday?(0,L.jsxs)(p.Muted,{children:["Birthday: ",g.birthday]}):null,(0,L.jsx)(p.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,L.jsx)(p.T,{weight:"semibold",children:"Tags"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:_.map(t=>(0,L.jsx)(p.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>b.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,L.jsx)(p.Card,{children:(0,L.jsxs)(h.default,{testID:"crm-live",style:{gap:6},children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.gold,children:"No customer list yet"}),(0,L.jsx)(p.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,C.useCtx)(6e4),s=(0,b.useOwner)(e=>e.campaigns),l=(0,x.useStore)((0,m.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,x.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,b.useOwner)(e=>e.marketingDraft),[a,r]=(0,o.useState)(i?.title??''),[d,c]=(0,o.useState)(i?.body??''),[u,g]=(0,o.useState)('All opted-in'),[j,w]=(0,o.useState)('Now'),v=(0,O.useExamples)(),T=v?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,L.jsxs)(h.default,{style:{gap:10},children:[i?(0,L.jsx)(p.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,L.jsx)(p.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,L.jsxs)(p.Row,{gap:8,children:[v?(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Referrals"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"27"}),(0,L.jsx)(p.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Gift card sales"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:(0,y.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,L.jsxs)(p.Muted,{children:[l.length," cards"]})]})]}),(0,L.jsx)(k.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,L.jsx)(S.PostToSocialButtons,{onPick:t=>(0,S.shareToSocial)(e,{group:t})}),(0,L.jsx)(S.QuickLinksSection,{go:e,heading:e=>(0,L.jsx)(k.SectionHead,{title:e})}),(0,L.jsx)(k.SectionHead,{title:"Campaigns"}),s.map(e=>(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,L.jsx)(p.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,L.jsx)(p.Muted,{children:e.body}),(0,L.jsxs)(p.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>b.useOwner.getState().setCampaign(e.id,{status:'draft'})}):v?(0,L.jsx)(p.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"New campaign"}),(0,L.jsx)(p.Field,{label:"Title",value:a,onChangeText:r}),(0,L.jsx)(p.Field,{label:"Message",value:d,onChangeText:c,multiline:!0}),(0,L.jsx)(p.Muted,{children:"Audience"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,L.jsx)(p.Chip,{label:e,sub:null==T[e]?void 0:`${T[e]}`,selected:u===e,onPress:()=>g(e)},e))}),(0,L.jsx)(p.Muted,{children:"When"}),(0,L.jsx)(p.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,L.jsx)(p.Chip,{label:e,selected:j===e,onPress:()=>w(e)},e))}),(0,L.jsx)(p.Button,{label:'Now'===j?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{b.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:u,sendAt:j,status:'draft',reach:T[u]??0}),b.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,L.jsx)(k.SectionHead,{title:"Event promos"}),n.map(t=>(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.title}),(0,L.jsx)(p.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,I.venueInfo)().name}. Book in the app.`)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,S.shareToSocial)(e,(0,S.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsx)(j.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,C.useCtx)(6e4);return(0,L.jsxs)(h.default,{style:{gap:12},children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,L.jsx)(p.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,L.jsx)(p.Card,{children:(0,L.jsx)(j.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,C.useCtx)(3e4),i=(0,b.useOwner)(e=>e.checks),a=(0,x.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,d]=(0,o.useState)({}),c=U.filter(e=>i[`${n}:${e.id}`]).length;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,L.jsx)(p.Badge,{kind:c===U.length?'ok':'amber',label:`${c}/${U.length}`})]}),(0,L.jsx)(h.default,{style:{height:8,backgroundColor:w.colours.border,borderRadius:4},children:(0,L.jsx)(h.default,{style:{height:8,width:c/U.length*100+"%",backgroundColor:w.colours.ok,borderRadius:4}})}),U.map(e=>{const a=`${n}:${e.id}`,o=i[a],c=Number(r[e.id]),u=null!=o?.value&&('freezer'===e.id?Number(o.value)>-18:'hot'===e.id?Number(o.value)<63:Number(o.value)>5);return(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{size:14,children:e.label}),o?(0,L.jsxs)(p.Muted,{children:[null!=o.value?`${o.value}\xb0C \xb7 `:'',o.by," ",o.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!o?(0,L.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>d({...r,[e.id]:t}),style:[p.styles.input,{width:64,paddingVertical:4}]}):null,(0,L.jsx)(p.Chip,{label:o?u?'\u26a0':'\u2713':'Tick',selected:!!o,disabled:!o&&e.temp&&!Number.isFinite(c),onPress:()=>o?b.useOwner.getState().untick(a):b.useOwner.getState().tick(a,l,(0,f.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,L.jsx)(p.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,L.jsx)(k.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,L.jsxs)(p.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,L.jsx)(p.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,C.useCtx)(6e4),l=(0,b.useOwner)(e=>e.lost),n=(0,b.useOwner)(e=>e.lostReports),i=(0,b.useOwner)(e=>e.coats),[a,r]=(0,o.useState)(''),[d,c]=(0,o.useState)(''),[u,g]=(0,o.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(k.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,L.jsx)(p.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>b.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:[p.styles.input,{flex:1}]}),(0,L.jsx)(p.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{b.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,L.jsxs)(p.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:e.item}),(0,L.jsx)(p.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,L.jsxs)(p.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>b.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,L.jsx)(k.SectionHead,{title:"Lost property"}),0===l.length?(0,L.jsx)(p.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,L.jsxs)(p.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:"semibold",children:t.item}),(0,L.jsx)(p.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,L.jsxs)(p.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,L.jsx)(p.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>b.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Log a found item"}),(0,L.jsx)(p.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,L.jsx)(p.Field,{label:"Where",value:d,onChangeText:c,placeholder:"e.g. 7"}),(0,L.jsx)(p.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{b.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=q,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,C.useCtx)(3e4),{list:l,read:g}=q(),[m,j]=(0,o.useState)('all'),y=(0,r.useAlerts)(e=>e.history),f=(0,r.useAlerts)(e=>e.read),k=(0,r.useAlerts)(e=>e.readAllAt[t]??0),v=e=>(0,r.isUnread)({read:f,readAllAt:{[t]:k}},e),[S,T]=(0,o.useState)(''),M=(0,r.useAlerts)(e=>e.cleared),[$,R]=(0,o.useState)(!1),[O,B]=(0,o.useState)({}),[D,P]=(0,o.useState)(null),A=y.filter(e=>e.rid===t&&!(0,r.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),I=(0,x.useBookings)(t).filter(e=>'pending'===e.status).length;d.default.useEffect(()=>{(0,r.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const E=t=>{r.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{b.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,r.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),c.default.announceForAccessibility?.(e)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${K.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,L.jsx)(h.default,{testID:"alerts-select-bar",children:(0,L.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,L.jsx)(p.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,L.jsx)(p.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,L.jsx)(h.default,{testID:"alerts-clear-confirm",children:(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,L.jsx)(p.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,L.jsxs)(p.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,L.jsx)(p.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,r.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),c.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,L.jsx)(p.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,L.jsx)(h.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,L.jsx)(p.Muted,{children:S})}):null,I?(0,L.jsxs)(p.Banner,{kind:"warn",children:[I," booking ",1===I?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===I?'it\u2019s':'they\u2019re'," handled."]}):null,(0,L.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:K.map(e=>{const t='all'===e.id?A.filter(v).length:(s=e.id,A.filter(e=>e.kind===s&&v(e)).length);var s;return(0,L.jsxs)(u.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{j(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour:w.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,L.jsx)(a.KindIcon,{kind:e.id,size:15}):null,(0,L.jsx)(p.T,{size:13,colour:m===e.id?w.colours.text:w.colours.muted,children:e.label}),t?(0,L.jsx)(h.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?w.colours.gold:r.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(p.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||r.CONNECTED_INBOX?null:(0,L.jsx)(p.Card,{children:(0,L.jsxs)(p.Row,{gap:10,children:[(0,L.jsx)(a.KindIcon,{kind:"email"}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsx)(p.T,{weight:"semibold",children:r.INBOX_EMPTY}),(0,L.jsx)(p.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=r.KIND_META[e.kind],s=v(e);return(0,L.jsx)(p.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):E(e),children:(0,L.jsxs)(p.Row,{gap:10,children:[$?(0,L.jsx)(u.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,r.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,L.jsx)(h.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:w.colours.gold,backgroundColor:void 0!==O[e.id]?w.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,L.jsx)(i.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,L.jsx)(n.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,L.jsx)(a.KindChip,{kind:e.kind,size:34}),(0,L.jsxs)(h.default,{style:{flex:1},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,L.jsx)(p.Muted,{children:V(e.at)})]}),(0,L.jsx)(p.T,{weight:s?'semibold':'regular',children:(0,r.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:(0,r.alertText)(e).body})]}),s?(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!r.CONNECTED_INBOX?null:(0,L.jsx)(p.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,L.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,L.jsxs)(p.Card,{highlight:g[t.id]?void 0:t.tone,onPress:()=>{b.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{weight:g[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),g[t.id]?null:(0,L.jsx)(h.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,L.jsx)(p.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,L.jsx)(p.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,C.useCtx)(6e4),[n,i]=(0,o.useState)(''),a=(0,x.useAllMenu)(s),r=(0,x.useOrders)(s),d=(0,x.useBookings)(s),c=(0,b.useOwner)(e=>e.staff),u=(0,o.useMemo)(()=>(0,R.crmCustomers)(),[]),g=n.trim().toLowerCase(),m=g.length<2?[]:[...$.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,y.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...b.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,b.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,b.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,L.jsxs)(h.default,{style:{gap:8},children:[(0,L.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:p.styles.input}),m.map(e=>(0,L.jsxs)(p.Card,{onPress:e.on,children:[(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(p.T,{style:{flex:1},children:e.t}),(0,L.jsx)(p.Badge,{kind:"neutral",label:e.kind})]}),(0,L.jsx)(p.Muted,{children:e.sub})]},e.k)),g.length>=2&&!m.length?(0,L.jsx)(p.Muted,{children:"No matches."}):null,g.length<2?(0,L.jsx)(p.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,x.useStore)(e=>e.clock.mode);const[e,t]=(0,o.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Live venue"}),(0,L.jsx)(p.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsxs)(p.Card,{children:[null,(0,L.jsx)(p.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Reset example data"}),e?(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{x.useStore.getState().resetDemo(),b.useOwner.getState().resetOwner(),t(!1)}}),(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,L.jsx)(p.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=Y,_e.copyText=Q,_e.YourApps=function(){const[e,s]=(0,o.useState)(null);return(0,L.jsxs)(h.default,{style:{gap:8},testID:"your-apps",children:[(0,L.jsx)(p.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),G.map(l=>{const n={...l,name:(0,I.venueInfo)().name+l.name},i=Y(n.path);return(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:n.name}),(0,L.jsx)(p.Muted,{children:n.who}),(0,L.jsx)(p.Row,{gap:10,children:(0,L.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:w.fonts.medium,fontSize:14,lineHeight:20,color:w.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,L.jsx)(p.Row,{gap:6,children:(0,L.jsx)(p.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await Q(Y(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=e(n),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=e(o),c=e(_r(_d[7]));_r(_d[8]),_r(_d[9]);var u=e(_r(_d[10])),h=e(_r(_d[11])),g=e(_r(_d[12])),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),I=_r(_d[35]),L=_r(_d[36]);const E={'Dine-in':w.colours.gold,Takeaway:w.colours.blue,'Table QR':w.colours.ok},H={gold:w.colours.gold,red:w.colours.red,amber:w.colours.amber,ok:w.colours.ok,blue:w.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function F(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useBookings)(e),a=(0,D.useCashUp)(e=>e.cashUps),[r,d]=(0,o.useState)(28),c=Math.min(n,900)-60,u=(0,f.ymd)(new Date(s.getTime()-864e5*r)),m=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,P.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=m.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,w=(0,A.clampWeeks)(t.settings.forecastMinWeeks);return(0,L.jsxs)(h.default,{style:{gap:10},testID:"analytics-live",children:[(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),m.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["Takings from your cash-ups (",m.length," day",1===m.length?'':'s',")"]}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),m.length>1?(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,L.jsx)(N.LineChart,{width:c,series:[m.map(e=>e.t)],labels:m.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,L.jsx)(B.NotEnoughHistory,{weeks:w,what:"Sales figures",testID:"analytics-not-enough"}),(0,L.jsxs)(p.Card,{children:[(0,L.jsxs)(p.Muted,{children:["No-show rate (",r," days)"]}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,L.jsx)(p.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,L.jsx)(p.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function W(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(6e4),{width:n}=(0,g.default)(),i=(0,x.useAllMenu)(e),a=(0,x.useBookings)(e),[r,d]=(0,o.useState)(28),c=(0,o.useMemo)(()=>(0,R.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),m=c.reduce((e,t)=>e+t.covers,0),j=R.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,R.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),f=j.find(e=>'Takeaway'===e.c).v+j.find(e=>'Table QR'===e.c).v,k=Math.min(n,900)-60;return(0,L.jsxs)(h.default,{style:{gap:10},children:[(0,L.jsx)(p.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(p.Chip,{label:"7 days",selected:7===r,onPress:()=>d(7)}),(0,L.jsx)(p.Chip,{label:"28 days",selected:28===r,onPress:()=>d(28)})]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Revenue"}),(0,L.jsx)(N.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Avg spend per Cover"}),(0,L.jsx)(N.CountUp,{value:m?u/m/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Daily revenue"}),(0,L.jsx)(N.LineChart,{width:k,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Revenue by channel"}),(0,L.jsxs)(p.Row,{gap:14,children:[(0,L.jsx)(N.Donut,{parts:j.map(e=>({value:e.v,colour:E[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,L.jsx)(h.default,{style:{gap:4,flex:1},children:j.map(e=>(0,L.jsxs)(p.Row,{gap:6,children:[(0,L.jsx)(h.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:E[e.c]}}),(0,L.jsx)(p.T,{size:14,style:{flex:1},children:e.c}),(0,L.jsxs)(p.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,L.jsxs)(p.Card,{children:[(0,L.jsx)(p.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,L.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(p.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,L.jsxs)(p.Muted,{children:[e.sold," sold \xb7 ",(0,y.gbp)(e.revenue)]})]},e.item.id))]}),(0,L.jsxs)(p.Row,{gap:8,children:[(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"Repeat customers"}),(0,L.jsx)(p.T,{size:20,weight:"bold",children:"38%"}),(0,L.jsx)(p.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,L.jsxs)(p.Card,{style:{flex:1},children:[(0,L.jsx)(p.Muted,{children:"No-show rate"}),(0,L.jsxs)(p.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,L.jsxs)(p.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,L.jsxs)(p.Card,{highlight:w.colours.ok,children:[(0,L.jsx)(p.T,{weight:"semibold",colour:w.colours.ok,children:"Commission saved vs delivery apps"}),(0,L.jsx)(N.CountUp,{value:.3*f/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:w.colours.ok}),(0,L.jsxs)(p.Muted,{children:[(0,y.gbp)(f)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const _=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const U=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function q(){const{rid:e,r:t,now:s,today:l}=(0,C.useCtx)(1e4),n=(0,x.useOrders)(e),i=(0,x.useBookings)(e),a=(0,x.useRatings)(e),r=(0,x.useWaitlist)(e),o=(0,b.useOwner)(e=>e.leave),d=(0,b.useOwner)(e=>e.swaps),c=(0,b.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,k.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,y.gbp)(e.total)}`,tone:w.colours.amber})),...n.filter(e=>(0,k.LIVE)(e)&&(0,v.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:w.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,v.bookingNeedsAction)(e,n.filter(k.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:w.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:w.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:w.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:w.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:w.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const K=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],V=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const G=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function Y(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function Q(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1366,[796,1120,985,900,1171,1173,34,281,379,236,402,102,426,853,794,848,1182,865,836,827,840,1147,1100,838,1367,1135,1370,1371,1119,1126,1125,1024,13,1123,1372,1167,25]); +__d(function(_g,_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,"PLATFORM",{enumerable:!0,get:function(){return w}}),_e.Mark=R,_e.shareToSocial=function(e,t){g.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=F,_e.validate=A,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return U}}),_e.openQuickLink=G,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return Q}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks);return Q(l,i).length?(0,k.jsxs)(h.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,k.jsx)(K,{go:e,compact:!0})]}):null},_e.QuickLinksRow=K,_e.QuickLinksSettings=function(){const{rid:e}=(0,j.useCtx)(6e4),l=(0,g.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,a.useState)(()=>l.map(e=>({...e}))),[r,d]=(0,a.useState)(s),[u,p]=(0,a.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[b,f]=(0,a.useState)(null),y=o.filter(e=>!e.builtIn).length,w=(e,t)=>{f(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),f(null))};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,k.jsx)(m.Field,{label:"Work email address",value:r,onChangeText:e=>{d(e),f(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,k.jsxs)(m.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",r.trim()?` for ${r.trim()}`:'',"."]})]}),(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(m.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25b2"})}),(0,k.jsx)(c.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,k.jsx)(m.T,{colour:t===o.length-1?'#555':x.colours.gold,children:"\u25bc"})})]})]}),(0,k.jsx)(m.Field,{label:"Label",value:e.label,onChangeText:t=>w(e.id,{label:t})}),'gmail'===e.kind?(0,k.jsxs)(m.Muted,{children:["Email: ",r]}):(0,k.jsx)(m.Field,{label:"Web address",value:e.url,onChangeText:t=>w(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(t=>(0,k.jsx)(m.Chip,{label:t,selected:e.icon===t,onPress:()=>w(e.id,{icon:t})},t))}),(0,g.isWixLink)(e)||'gmail'===e.kind?(0,k.jsx)(m.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,k.jsx)(m.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>w(e.id,{staff:t})}),e.builtIn?null:(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),f(null)}})]},e.id)),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.T,{weight:"semibold",children:["Add your own link (",y," / ",g.MAX_CUSTOM_LINKS,")"]}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,k.jsx)(m.Chip,{label:e.label,onPress:()=>p({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,k.jsx)(m.Field,{label:"New link label",value:u.label,onChangeText:e=>p({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,k.jsx)(m.Field,{label:"New link web address",value:u.url,onChangeText:e=>p({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:X.map(e=>(0,k.jsx)(m.Chip,{label:e,selected:u.icon===e,onPress:()=>p({...u,icon:e})},e))}),(0,k.jsx)(m.Button,{kind:"secondary",label:"Add link",disabled:y>=g.MAX_CUSTOM_LINKS,onPress:()=>{const e=J(u.url);u.label.trim()&&ee(e)?(n(t=>[...t,{id:$('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),p({label:'',url:'',icon:'\ud83c\udf10'}),f({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):f({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),b?(0,k.jsx)(m.Banner,{kind:b.ok?'success':'danger',title:b.ok?'Done':'Check these',children:b.text}):null,(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{label:"Save quick links",onPress:()=>{const t=[];te(r)||t.push('The work email doesn\'t look like an email address.');const l=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':J(e.url)}));l.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||ee(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?f({ok:!1,text:[...new Set(t)].join('\n')}):(g.useOwner.getState().setOwner({quickLinks:l}),i.useStore.getState().updateRestaurant(e,{contactEmail:r.trim()}),n(l),f({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,k.jsx)(m.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(g.DEFAULT_QUICK_LINKS.map(e=>({...e}))),f({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return le}}),_e.SocialPage=function(e){return s.LIVE_VENUE_BUILD?(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsx)(m.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,k.jsx)(m.Muted,{children:"Open your social account directly to publish."})]}):(0,k.jsx)(V,{...e})},_e.SocialAccounts=function(){return s.LIVE_VENUE_BUILD?(0,k.jsx)(m.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,k.jsx)(_,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[5]));_r(_d[6]);var a=_r(_d[7]),r=_r(_d[8]),d=e(_r(_d[9])),u=e(_r(_d[10]));_r(_d[11]);var c=e(_r(_d[12])),h=e(_r(_d[13])),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]);const w={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},v=()=>(0,y.venueInfo)().name,T=100,C=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},S=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],$=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,P=e=>e.toLocaleString('en-GB');function R({p:e,size:t=22}){const i=w[e];return(0,k.jsx)(h.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function F({onPick:e}){const t=(0,g.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:e?x.colours.goldTint:x.colours.surface,padding:14,gap:6}),children:[(0,k.jsxs)(m.Row,{gap:6,children:[o.map(e=>(0,k.jsx)(R,{p:e,size:26},e)),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.T,{colour:x.colours.gold,size:20,children:"\u203a"})]}),(0,k.jsx)(m.T,{weight:"bold",size:18,children:l}),(0,k.jsx)(m.Muted,{children:s}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:o.map(e=>(0,k.jsx)(m.Badge,{kind:t[e]?'ok':'neutral',label:`${w[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(0,k.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,k.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const L=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:$('md')})),when:'now',day:0,time:'17:00',source:t?.source}),O=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),I=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},M={feed:'Feed',reel:'Reel',story:'Story'},B={short:'YouTube Shorts',video:'YouTube video'};function A(e,t,i){const l=[],s=O(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>T&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${T}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>w[t].limit&&l.push(`The text is too long for ${w[t].name} (${P(e.text.length)} / ${w[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${w[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&I(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function D({m:e,size:t=84}){const[i,l]=(0,a.useState)(!1);return(0,k.jsxs)(h.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,k.jsx)(d.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,k.jsx)(m.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,k.jsx)(m.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function E({p:e,n:t,title:i}){const l='yt-title'===e?T:w[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':w[e].name;return(0,k.jsx)(m.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${P(t)} / ${'yt-title'===e?T:w[e].limitLabel}`})}function z({p:e,d:t}){const i=t.media[0],s=t.text.trim()||'Your text appears here.',o=(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(R,{p:e,size:20}),(0,k.jsx)(m.T,{weight:"semibold",size:14,children:v()}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsx)(m.Muted,{children:'instagram'===e?M[t.igFormat]:'youtube'===e?B[t.ytFormat]:w[e].name})]}),n=(e,l="100%")=>i?(0,k.jsxs)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,k.jsx)(d.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,k.jsx)(m.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,k.jsx)(m.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,k.jsx)(h.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,k.jsxs)(m.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,k.jsx)(h.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(m.Muted,{children:"No media yet"})});return(0,k.jsxs)(h.default,{accessibilityLabel:`${w[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,l.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:x.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.T,{size:14,numberOfLines:5,children:s}),t.media.length?n(1.25):null,(0,k.jsx)(m.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,k.jsxs)(k.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,k.jsx)(m.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,k.jsx)(h.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,k.jsxs)(m.T,{size:13,numberOfLines:3,children:[(0,k.jsx)(m.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),s]}):(0,k.jsx)(m.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,k.jsxs)(h.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,k.jsx)(m.T,{size:12,numberOfLines:3,style:{marginTop:4},children:s})]}):null,'youtube'===e?(0,k.jsxs)(k.Fragment,{children:['short'===t.ytFormat?(0,k.jsx)(h.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,k.jsx)(m.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,k.jsxs)(m.Muted,{children:[v()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function Y({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,j.useCtx)(6e4),n=(0,g.useOwner)(e=>e.offers),a=(0,g.useOwner)(e=>e.quickLinks),r=(0,p.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,b.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=n.find(e=>'special'===e.kind&&e.live),h=(0,o.kitchenHoursOn)(l,s),f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,o.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${f[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:h?`Kitchen today ${h[0]}\u2013${h[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,b.niceDate)((0,b.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,k.jsx)(m.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,k.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.border,backgroundColor:e?x.colours.goldTint:x.colours.surface,opacity:i.disabled?.4:1}),children:[(0,k.jsx)(m.T,{weight:"medium",children:i.label}),(0,k.jsx)(m.Muted,{children:i.sub})]},i.label))})}function N({initial:e,onClose:t,onDone:i}){const{now:l,role:s,me:o}=(0,j.useCtx)(3e4),r=(0,g.useOwner)(e=>e.socialAccounts),[d,u]=(0,a.useState)(e),[p,T]=(0,a.useState)(!1),[F,L]=(0,a.useState)(!1),[N,W]=(0,a.useState)(!1),[V,_]=(0,a.useState)(!1),[q,U]=(0,a.useState)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>u(t=>({...t,...e})),Q=O(d),K=A(d,r,l),X=g.CAN.publishSocial(s),Z='meta'===d.group,J=e=>{const t=d.media.length,i={id:$('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:S[t%S.length],duration:'video'===e?24:void 0};H({media:Z?[...d.media,i].slice(0,10):[i]})},ee=(e,t)=>{const i=[...d.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],H({media:i}))},te=e=>H({text:d.text.includes(e)?d.text.replace(new RegExp(`\\s?${e}\\b`),''):`${d.text.trimEnd()}${d.text.trim()?' ':''}${e}`}),ie=(e,t)=>{const i='later'===d.when;g.useOwner.getState().addSocialPost({group:d.group,platforms:Q,igFormat:d.igFormat,ytFormat:d.ytFormat,ytTitle:d.ytTitle.trim(),ytVisibility:d.ytVisibility,text:d.text.trim(),media:d.media,scheduleAt:i?I(d,l).toISOString():void 0,createdAt:l.toISOString(),by:o,byRole:s,status:t,results:e})};return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,k.jsx)(m.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(R,{p:e},e))})]}),(0,k.jsx)(m.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),d.source?(0,k.jsx)(m.Banner,{kind:"info",title:"Prefilled",children:`From ${d.source}. Edit anything before publishing.`}):null,X?null:(0,k.jsx)(m.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"Where to post"}),Z?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"Facebook Page",value:d.fb,onChange:e=>H({fb:e})}),(0,k.jsx)(m.Toggle,{label:"Instagram",value:d.ig,onChange:e=>H({ig:e})}),(0,k.jsx)(m.Muted,{children:d.fb&&d.ig?'Both':d.fb?'Facebook only':d.ig?'Instagram only':'Nothing selected'}),d.ig?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Muted,{children:"Instagram as"}),(0,k.jsx)(m.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,k.jsx)(m.Chip,{label:M[e],selected:d.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Toggle,{label:"TikTok",value:d.tt,onChange:e=>H({tt:e})}),(0,k.jsx)(m.Toggle,{label:"YouTube",value:d.yt,onChange:e=>H({yt:e})}),d.yt?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{gap:6,children:['short','video'].map(e=>(0,k.jsx)(m.Chip,{label:B[e],selected:d.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,k.jsx)(m.Field,{label:"YouTube title",value:d.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(0,k.jsx)(E,{p:"yt-title",n:d.ytTitle.length})}),(0,k.jsx)(m.Muted,{children:"Visibility"}),(0,k.jsx)(m.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,k.jsx)(m.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,k.jsx)(m.Muted,{children:Z?`${d.media.length} / 10`:d.media.length?'1 video':'none'})]}),(0,k.jsx)(m.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await n.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:$('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${d.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...d.media,...t].slice(0,10):t.slice(0,1)})}}),(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:[Z?(0,k.jsx)(m.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,k.jsx)(m.Chip,{label:"Example video",onPress:()=>J('video')})]}),d.media.length?(0,k.jsx)(m.Row,{wrap:!0,gap:8,children:d.media.map((e,t)=>(0,k.jsxs)(h.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,k.jsx)(D,{m:e}),(0,k.jsxs)(m.Row,{gap:4,children:[Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:0===t?'#555':x.colours.gold,children:"\u25c0"})}):null,(0,k.jsx)(c.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:d.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,k.jsx)(m.T,{colour:x.colours.red,children:"\u2715"})}),Z?(0,k.jsx)(c.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===d.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,k.jsx)(m.T,{colour:t===d.media.length-1?'#555':x.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,k.jsx)(m.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>L(!0)})]}),(0,k.jsx)(m.Field,{label:"Text",value:d.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,k.jsx)(E,{p:e,n:d.text.length},e))}),(0,k.jsx)(m.Muted,{children:"Hashtags"}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:C().map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.text.includes(e),onPress:()=>te(e)},e))})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"When"}),(0,k.jsxs)(m.Row,{gap:6,children:[(0,k.jsx)(m.Chip,{label:"Post now",selected:'now'===d.when,onPress:()=>H({when:'now'})}),(0,k.jsx)(m.Chip,{label:"Schedule",selected:'later'===d.when,onPress:()=>H({when:'later',day:d.day||1})})]}),'later'===d.when?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(l);return i.setDate(i.getDate()+t),(0,k.jsx)(m.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,b.niceDate)(i),selected:d.day===t,onPress:()=>H({day:t})},t)})}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,k.jsx)(m.Chip,{label:e,selected:d.time===e,onPress:()=>H({time:e})},e))}),(0,k.jsxs)(m.Muted,{children:["Goes out ",(0,b.niceDate)(I(d,l))," at ",d.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,k.jsx)(f.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,k.jsxs)(m.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,k.jsx)(z,{p:e,d:d},e)),Q.length?null:(0,k.jsx)(m.Muted,{children:"Choose at least one platform to see a preview."})]}),p&&K.length?(0,k.jsx)(m.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{T(!0),K.length||W(!0)}}),F?(0,k.jsx)(Y,{onClose:()=>L(!1),onInsert:e=>H({text:`${d.text.trimEnd()}${d.text.trim()?'\n':''}${e}`})}):null,N?(0,k.jsxs)(m.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,k.jsx)(m.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,k.jsxs)(m.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,k.jsx)(R,{p:e}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"medium",children:[w[e].account," \xb7 ",v()]}),(0,k.jsx)(m.Muted,{children:'instagram'===e?`${M[d.igFormat]}${'feed'===d.igFormat&&d.media.length>1?` (carousel of ${d.media.length})`:''}`:'youtube'===e?`${B[d.ytFormat]} \xb7 "${d.ytTitle.trim()}" \xb7 ${d.ytVisibility}`:'facebook'===e?"Page post"+(d.media.length?` with ${d.media.length} item${d.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,backgroundColor:x.colours.border,marginTop:4},children:(0,k.jsx)(h.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:x.colours.gold}})}):null]})]},e)),(0,k.jsxs)(m.Muted,{children:['later'===d.when?`Scheduled for ${(0,b.niceDate)(I(d,l))} at ${d.time}.`:'Posts now.'," ",d.media.length," media item",1===d.media.length?'':'s'," \xb7 ",P(d.text.length)," characters."]}),X?(0,k.jsx)(m.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,k.jsxs)(m.T,{colour:x.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,k.jsxs)(m.Row,{gap:8,children:[(0,k.jsx)(m.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,k.jsx)(m.Button,{label:X?'later'===d.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return ie({},'awaiting approval'),W(!1),void i('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===d.when,t=Object.fromEntries(Q.map((t,i)=>[t,V&&i===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return ie(t,'done'),setTimeout(()=>{W(!1),U(null),i(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,b.niceDate)(I(d,l))} ${d.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function W({onDuplicate:e}){const{role:t,me:i,now:l}=(0,j.useCtx)(3e4),s=(0,g.useOwner)(e=>e.socialPosts),o=(0,g.useOwner)(e=>e.setSocialPost),n=g.CAN.publishSocial(t);return s.length?(0,k.jsx)(h.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,k.jsxs)(m.Card,{highlight:'awaiting approval'===t.status?x.colours.amber:void 0,children:[(0,k.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(m.Row,{gap:4,children:t.platforms.map(e=>(0,k.jsx)(R,{p:e,size:18},e))}),(0,k.jsxs)(m.Muted,{children:[t.scheduleAt?'For ':'',(0,b.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,k.jsx)(m.T,{weight:"semibold",children:t.ytTitle}):null,(0,k.jsx)(m.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,k.jsxs)(m.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${M[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${B[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,k.jsx)(m.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,k.jsx)(m.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,k.jsx)(m.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,k.jsx)(m.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${w[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,k.jsx)(m.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,k.jsxs)(m.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,k.jsx)(m.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,k.jsxs)(m.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,k.jsx)(m.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function V({go:e}){const{role:t}=(0,j.useCtx)(6e4),i=(0,g.useOwner)(e=>e.socialDraft),l=(0,g.useOwner)(e=>e.socialPosts),[s,o]=(0,a.useState)(null),[n,r]=(0,a.useState)(null),[d,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i&&(o(L(i.group,i)),r(null),g.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,p=g.CAN.publishSocial(t);return s?(0,k.jsx)(N,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),r(e)}},d):(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,k.jsx)(m.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&p?(0,k.jsx)(m.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,p?null:(0,k.jsx)(m.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,k.jsx)(f.SectionHead,{title:"Post to social"}),(0,k.jsx)(F,{onPick:e=>{r(null),u(e=>e+1),o(L(e))}}),p?(0,k.jsx)(m.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,k.jsx)(f.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,k.jsx)(W,{onDuplicate:e=>{r(null),u(e=>e+1),o(L(e.group,{...e,source:'a previous post'}))}})]})}function _(){const e=(0,g.useOwner)(e=>e.socialAccounts),t=(e,t)=>g.useOwner.getState().setOwner({socialAccounts:{...g.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,k.jsxs)(m.Row,{gap:10,children:[(0,k.jsx)(R,{p:i,size:30}),(0,k.jsxs)(h.default,{style:{flex:1},children:[(0,k.jsxs)(m.T,{weight:"semibold",children:[w[i].account,l?` (${l})`:'']}),(0,k.jsx)(m.Muted,{children:e[i]?`Connected as ${v()} (mock)`:'Not connected'})]}),(0,k.jsx)(m.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${w[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsx)(m.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Meta"}),(0,k.jsx)(i,{p:"facebook",via:"via Meta"}),(0,k.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",colour:x.colours.gold,children:"Video"}),(0,k.jsx)(i,{p:"tiktok"}),(0,k.jsx)(i,{p:"youtube"})]}),(0,k.jsxs)(m.Card,{children:[(0,k.jsx)(m.T,{weight:"semibold",children:"For real posting"}),(0,k.jsx)(m.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const q=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',U=(e,t)=>'gmail'===e.kind?q(t):e.url;async function G(e,t){return e.kind,await u.default.openURL(U(e,t)),'web'}const H=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},Q=(e,t)=>'chef'!==t||(0,r.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,g.isWixLink)(e)&&'gmail'!==e.kind):[];function K({go:e,compact:i}){const{role:l,rid:s}=(0,j.useCtx)(6e4),o=(0,g.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[r,d]=(0,a.useState)(null),u=Q(o,l),p=[];u.forEach(e=>{const t=e.group??e.id,i=p.find(e=>e.key===t);i?i.items.push(e):p.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const b=async e=>{const t=await G(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':H(U(e,n))}`:`Couldn't open ${e.label}`)};return p.length?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(m.Row,{wrap:!0,gap:10,children:p.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(h.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,k.jsxs)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,k.jsx)(m.T,{size:22,children:s}),t?(0,k.jsx)(m.T,{colour:x.colours.gold,size:18,children:"\u2197"}):null]}),(0,k.jsx)(m.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,k.jsx)(m.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':H(t?t.url:e.items[0].url)}),t?null:(0,k.jsx)(h.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,k.jsx)(m.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>b(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:x.colours.surface,padding:12,gap:6};return t?(0,k.jsx)(c.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>b(t),style:({pressed:e})=>[a,e&&{backgroundColor:x.colours.goldTint}],children:o},e.key):(0,k.jsx)(h.default,{style:a,children:o},e.key)})}),r?(0,k.jsx)(m.Muted,{children:r}):null,e&&g.CAN.manage(l)?(0,k.jsx)(m.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const X=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],Z=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],J=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},ee=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),te=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ie=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,b.niceDate)((0,b.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,T)}},le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,T)}}},1367,[925,800,798,806,852,1061,1368,34,988,336,379,236,402,102,794,848,865,827,840,1147,1100,1167,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ActivityAction",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"ResultCode",{enumerable:!0,get:function(){return N}}),_e.startActivityAsync=async function(T,S={}){if(!_.default.startActivity)throw new E.UnavailabilityError('IntentLauncher','startActivityAsync');if(!T||'string'!=typeof T)throw new TypeError("'activityAction' argument must be a non-empty string!");return _.default.startActivity(T,S)},_e.openApplication=function(T){if(!_.default.openApplication)throw new E.UnavailabilityError('IntentLauncher','openApplication');return _.default.openApplication(T)},_e.getApplicationIconAsync=async function(T){if(!_.default.getApplicationIcon)throw new E.UnavailabilityError('IntentLauncher','getApplicationIconAsync');return _.default.getApplicationIcon(T)};var T,E=r(d[0]),S=r(d[1]),_=(T=S)&&T.__esModule?T:{default:T},I=(function(T){return T.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS="android.settings.ACCESSIBILITY_COLOR_CONTRAST_SETTINGS",T.ACCESSIBILITY_COLOR_MOTION_SETTINGS="android.settings.ACCESSIBILITY_COLOR_MOTION_SETTINGS",T.ACCESSIBILITY_COLOR_SPACE_SETTINGS="com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS",T.ACCESSIBILITY_DETAILS_SETTINGS="android.settings.ACCESSIBILITY_DETAILS_SETTINGS",T.ACCESSIBILITY_SETTINGS="android.settings.ACCESSIBILITY_SETTINGS",T.ACCESSIBILITY_SETTINGS_FOR_SUW="android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW",T.ACCESSIBILITY_SHORTCUT_SETTINGS="android.settings.ACCESSIBILITY_SHORTCUT_SETTINGS",T.ACCOUNT_SYNC_SETTINGS="android.settings.ACCOUNT_SYNC_SETTINGS",T.ADAPTIVE_BRIGHTNESS_SETTINGS="android.settings.ADAPTIVE_BRIGHTNESS_SETTINGS",T.ADD_ACCOUNT_SETTINGS="android.settings.ADD_ACCOUNT_SETTINGS",T.ADVANCED_CONNECTED_DEVICE_SETTINGS="com.android.settings.ADVANCED_CONNECTED_DEVICE_SETTINGS",T.ADVANCED_MEMORY_PROTECTION_SETTINGS="android.settings.ADVANCED_MEMORY_PROTECTION_SETTINGS",T.AIRPLANE_MODE_SETTINGS="android.settings.AIRPLANE_MODE_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS="android.settings.ALL_APPS_NOTIFICATION_SETTINGS",T.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW="android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW",T.APN_SETTINGS="android.settings.APN_SETTINGS",T.APP_LOCALE_SETTINGS="android.settings.APP_LOCALE_SETTINGS",T.APP_MEMORY_USAGE="android.settings.APP_MEMORY_USAGE",T.APP_NOTIFICATION_BUBBLE_SETTINGS="android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS",T.APP_NOTIFICATION_REDACTION="android.settings.ACTION_APP_NOTIFICATION_REDACTION",T.APP_NOTIFICATION_SETTINGS="android.settings.APP_NOTIFICATION_SETTINGS",T.APP_OPEN_BY_DEFAULT_SETTINGS="android.settings.APP_OPEN_BY_DEFAULT_SETTINGS",T.APP_STORAGE_SETTINGS="com.android.settings.APP_STORAGE_SETTINGS",T.APPLICATION_DETAILS_SETTINGS="android.settings.APPLICATION_DETAILS_SETTINGS",T.APPLICATION_DEVELOPMENT_SETTINGS="android.settings.APPLICATION_DEVELOPMENT_SETTINGS",T.APPLICATION_SETTINGS="android.settings.APPLICATION_SETTINGS",T.AUDIO_STREAM_DIALOG="android.settings.AUDIO_STREAM_DIALOG",T.AUTO_ROTATE_SETTINGS="android.settings.AUTO_ROTATE_SETTINGS",T.AUTOMATIC_ZEN_RULE_SETTINGS="android.settings.AUTOMATIC_ZEN_RULE_SETTINGS",T.BACKUP_SETTINGS="com.android.settings.BACKUP_SETTINGS",T.BATTERY_POWER_USAGE_ADVANCED="com.android.settings.battery.action.POWER_USAGE_ADVANCED",T.BATTERY_SAVER_SCHEDULE_SETTINGS="com.android.settings.BATTERY_SAVER_SCHEDULE_SETTINGS",T.BATTERY_SAVER_SETTINGS="android.settings.BATTERY_SAVER_SETTINGS",T.BIOMETRIC_ENROLL="android.settings.BIOMETRIC_ENROLL",T.BIOMETRIC_SETTINGS_PROVIDER="com.android.settings.biometrics.BIOMETRIC_SETTINGS_PROVIDER",T.BLUETOOTH_AUDIO_SHARING_SETTINGS="com.android.settings.BLUETOOTH_AUDIO_SHARING_SETTINGS",T.BLUETOOTH_DASHBOARD_SETTINGS="android.settings.BLUETOOTH_DASHBOARD_SETTINGS",T.BLUETOOTH_DEVICE_DETAIL_SETTINGS="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS",T.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER="android.settings.BLUETOOTH_LE_AUDIO_QR_CODE_SCANNER",T.BLUETOOTH_PAIRING_SETTINGS="android.settings.BLUETOOTH_PAIRING_SETTINGS",T.BLUETOOTH_SETTINGS="android.settings.BLUETOOTH_SETTINGS",T.BLUTOOTH_FIND_BROADCASTS_ACTIVITY="android.settings.BLUTOOTH_FIND_BROADCASTS_ACTIVITY",T.BUGREPORT_HANDLER_SETTINGS="android.settings.BUGREPORT_HANDLER_SETTINGS",T.BUTTON_NAVIGATION_SETTINGS="com.android.settings.BUTTON_NAVIGATION_SETTINGS",T.CAPTIONING_SETTINGS="android.settings.CAPTIONING_SETTINGS",T.CAST_SETTINGS="android.settings.CAST_SETTINGS",T.CELLULAR_NETWORK_SECURITY="android.settings.CELLULAR_NETWORK_SECURITY",T.CHANNEL_NOTIFICATION_SETTINGS="android.settings.CHANNEL_NOTIFICATION_SETTINGS",T.COLOR_INVERSION_SETTINGS="android.settings.COLOR_INVERSION_SETTINGS",T.COMBINED_BIOMETRICS_SETTINGS="android.settings.COMBINED_BIOMETRICS_SETTINGS",T.COMMUNAL_SETTINGS="android.settings.COMMUNAL_SETTINGS",T.CONDITION_PROVIDER_SETTINGS="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS",T.CONVERSATION_SETTINGS="android.settings.CONVERSATION_SETTINGS",T.CREDENTIAL_PROVIDER="android.settings.CREDENTIAL_PROVIDER",T.DARK_THEME_SETTINGS="android.settings.DARK_THEME_SETTINGS",T.DATA_ROAMING_SETTINGS="android.settings.DATA_ROAMING_SETTINGS",T.DATA_SAVER_SETTINGS="android.settings.DATA_SAVER_SETTINGS",T.DATA_USAGE_SETTINGS="android.settings.DATA_USAGE_SETTINGS",T.DATE_SETTINGS="android.settings.DATE_SETTINGS",T.DEVELOPMENT_START_DSU_LOADER="android.settings.development.START_DSU_LOADER",T.DEVICE_INFO_SETTINGS="android.settings.DEVICE_INFO_SETTINGS",T.DEVICE_NAME="android.settings.DEVICE_NAME",T.DISPLAY_SETTINGS="android.settings.DISPLAY_SETTINGS",T.DREAM_SETTINGS="android.settings.DREAM_SETTINGS",T.ENTERPRISE_PRIVACY_SETTINGS="android.settings.ENTERPRISE_PRIVACY_SETTINGS",T.FACE_ENROLL="android.settings.FACE_ENROLL",T.FACE_SETTINGS="android.settings.FACE_SETTINGS",T.FACTORY_RESET="com.android.settings.action.FACTORY_RESET",T.FINGERPRINT_ENROLL="android.settings.FINGERPRINT_ENROLL",T.FINGERPRINT_SETTINGS="android.settings.FINGERPRINT_SETTINGS",T.FINGERPRINT_SETTINGS_V2="android.settings.FINGERPRINT_SETTINGS_V2",T.FINGERPRINT_SETUP="android.settings.FINGERPRINT_SETUP",T.FIRST_DAY_OF_WEEK_SETTINGS="android.settings.FIRST_DAY_OF_WEEK_SETTINGS",T.GESTURE_NAVIGATION_SETTINGS="com.android.settings.GESTURE_NAVIGATION_SETTINGS",T.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS="android.settings.HARD_KEYBOARD_LAYOUT_PICKER_SETTINGS",T.HARD_KEYBOARD_SETTINGS="android.settings.HARD_KEYBOARD_SETTINGS",T.HEARING_DEVICES_PAIRING_SETTINGS="android.settings.HEARING_DEVICES_PAIRING_SETTINGS",T.HEARING_DEVICES_SETTINGS="android.settings.HEARING_DEVICES_SETTINGS",T.HOME_SETTINGS="android.settings.HOME_SETTINGS",T.IA_SETTINGS="com.android.settings.action.IA_SETTINGS",T.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS="android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS",T.IGNORE_BATTERY_OPTIMIZATION_SETTINGS="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS",T.INPUT_METHOD_SETTINGS="android.settings.INPUT_METHOD_SETTINGS",T.INPUT_METHOD_SUBTYPE_SETTINGS="android.settings.INPUT_METHOD_SUBTYPE_SETTINGS",T.INTERNAL_STORAGE_SETTINGS="android.settings.INTERNAL_STORAGE_SETTINGS",T.LANGUAGE_SETTINGS="android.settings.LANGUAGE_SETTINGS",T.LICENSE="android.settings.LICENSE",T.LOCALE_SETTINGS="android.settings.LOCALE_SETTINGS",T.LOCATION_SCANNING_SETTINGS="android.settings.LOCATION_SCANNING_SETTINGS",T.LOCATION_SOURCE_SETTINGS="android.settings.LOCATION_SOURCE_SETTINGS",T.LOCK_SCREEN_SETTINGS="android.settings.LOCK_SCREEN_SETTINGS",T.MANAGE_ADAPTIVE_NOTIFICATIONS="android.settings.MANAGE_ADAPTIVE_NOTIFICATIONS",T.MANAGE_ALL_APPLICATIONS_SETTINGS="android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS",T.MANAGE_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_ALL_SIM_PROFILES_SETTINGS="android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS",T.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION="android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",T.MANAGE_APP_LONG_RUNNING_JOBS="android.settings.MANAGE_APP_LONG_RUNNING_JOBS",T.MANAGE_APP_OVERLAY_PERMISSION="android.settings.MANAGE_APP_OVERLAY_PERMISSION",T.MANAGE_APP_USE_FULL_SCREEN_INTENT="android.settings.MANAGE_APP_USE_FULL_SCREEN_INTENT",T.MANAGE_APPLICATIONS_SETTINGS="android.settings.MANAGE_APPLICATIONS_SETTINGS",T.MANAGE_CLONED_APPS_SETTINGS="android.settings.MANAGE_CLONED_APPS_SETTINGS",T.MANAGE_CROSS_PROFILE_ACCESS="android.settings.MANAGE_CROSS_PROFILE_ACCESS",T.MANAGE_DEFAULT_APPS_SETTINGS="android.settings.MANAGE_DEFAULT_APPS_SETTINGS",T.MANAGE_DOMAIN_URLS="android.settings.MANAGE_DOMAIN_URLS",T.MANAGE_OVERLAY_PERMISSION="android.settings.action.MANAGE_OVERLAY_PERMISSION",T.MANAGE_UNKNOWN_APP_SOURCES="android.settings.MANAGE_UNKNOWN_APP_SOURCES",T.MANAGE_USER_ASPECT_RATIO_SETTINGS="android.settings.MANAGE_USER_ASPECT_RATIO_SETTINGS",T.MANAGE_WRITE_SETTINGS="android.settings.action.MANAGE_WRITE_SETTINGS",T.MANAGED_PROFILE_SETTINGS="android.settings.MANAGED_PROFILE_SETTINGS",T.MEDIA_BROADCAST_DIALOG="android.settings.MEDIA_BROADCAST_DIALOG",T.MEDIA_CONTROLS_SETTINGS="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS",T.MEMORY_CARD_SETTINGS="android.settings.MEMORY_CARD_SETTINGS",T.MMS_MESSAGE_SETTING="android.settings.MMS_MESSAGE_SETTING",T.MOBILE_DATA_USAGE="android.settings.MOBILE_DATA_USAGE",T.MOBILE_NETWORK_LIST="android.settings.MOBILE_NETWORK_LIST",T.MODULE_LICENSES="android.settings.MODULE_LICENSES",T.MONITORING_CERT_INFO="com.android.settings.MONITORING_CERT_INFO",T.MORE_SECURITY_PRIVACY_SETTINGS="com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS",T.NAVIGATION_MODE_SETTINGS="com.android.settings.NAVIGATION_MODE_SETTINGS",T.NETWORK_OPERATOR_SETTINGS="android.settings.NETWORK_OPERATOR_SETTINGS",T.NETWORK_PROVIDER_SETTINGS="android.settings.NETWORK_PROVIDER_SETTINGS",T.NFC_SETTINGS="android.settings.NFC_SETTINGS",T.NIGHT_DISPLAY_SETTINGS="android.settings.NIGHT_DISPLAY_SETTINGS",T.NOTIFICATION_ASSISTANT_SETTINGS="android.settings.NOTIFICATION_ASSISTANT_SETTINGS",T.NOTIFICATION_HISTORY="android.settings.NOTIFICATION_HISTORY",T.NOTIFICATION_LISTENER_DETAIL_SETTINGS="android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS",T.NOTIFICATION_LISTENER_SETTINGS="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_DETAIL_SETTINGS",T.NOTIFICATION_POLICY_ACCESS_SETTINGS="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS",T.NOTIFICATION_SETTINGS="android.settings.NOTIFICATION_SETTINGS",T.ONE_HANDED_SETTINGS="android.settings.action.ONE_HANDED_SETTINGS",T.OPEN_PRIVATE_SPACE_SETTINGS="com.android.settings.action.OPEN_PRIVATE_SPACE_SETTINGS",T.OTHER_SOUND_SETTINGS="android.settings.ACTION_OTHER_SOUND_SETTINGS",T.PANEL_INTERNET_CONNECTIVITY="android.settings.panel.action.INTERNET_CONNECTIVITY",T.PANEL_NFC="android.settings.panel.action.NFC",T.PANEL_VOLUME="android.settings.panel.action.VOLUME",T.PANEL_WIFI="android.settings.panel.action.WIFI",T.PICTURE_IN_PICTURE_SETTINGS="android.settings.PICTURE_IN_PICTURE_SETTINGS",T.POWER_MENU_SETTINGS="android.settings.ACTION_POWER_MENU_SETTINGS",T.PREMIUM_SMS_SETTINGS="android.settings.PREMIUM_SMS_SETTINGS",T.PREVIOUSLY_CONNECTED_DEVICE="com.android.settings.PREVIOUSLY_CONNECTED_DEVICE",T.PRINT_SETTINGS="android.settings.ACTION_PRINT_SETTINGS",T.PRIVACY_ADVANCED_SETTINGS="android.settings.PRIVACY_ADVANCED_SETTINGS",T.PRIVACY_CONTROLS="android.settings.PRIVACY_CONTROLS",T.PRIVACY_SETTINGS="android.settings.PRIVACY_SETTINGS",T.PROCESS_WIFI_EASY_CONNECT_URI="android.settings.PROCESS_WIFI_EASY_CONNECT_URI",T.REDUCE_BRIGHT_COLORS_SETTINGS="android.settings.REDUCE_BRIGHT_COLORS_SETTINGS",T.REGIONAL_PREFERENCES_SETTINGS="android.settings.REGIONAL_PREFERENCES_SETTINGS",T.REMOTE_AUTHENTICATOR_ENROLL="android.settings.REMOTE_AUTHENTICATOR_ENROLL",T.REQUEST_ENABLE_CONTENT_CAPTURE="android.settings.REQUEST_ENABLE_CONTENT_CAPTURE",T.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS="android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",T.REQUEST_MANAGE_MEDIA="android.settings.REQUEST_MANAGE_MEDIA",T.REQUEST_MEDIA_ROUTING_CONTROL="android.settings.REQUEST_MEDIA_ROUTING_CONTROL",T.REQUEST_SCHEDULE_EXACT_ALARM="android.settings.REQUEST_SCHEDULE_EXACT_ALARM",T.REQUEST_SET_AUTOFILL_SERVICE="android.settings.REQUEST_SET_AUTOFILL_SERVICE",T.SATELLITE_SETTING="android.settings.SATELLITE_SETTING",T.SCREEN_TIMEOUT_SETTINGS="android.settings.SCREEN_TIMEOUT_SETTINGS",T.SEARCH_RESULT_TRAMPOLINE="com.android.settings.SEARCH_RESULT_TRAMPOLINE",T.SECURITY_ADVANCED_SETTINGS="com.android.settings.security.SECURITY_ADVANCED_SETTINGS",T.SECURITY_SETTINGS="android.settings.SECURITY_SETTINGS",T.SETTINGS="android.settings.SETTINGS",T.SETTINGS_EMBED_DEEP_LINK_ACTIVITY="android.settings.SETTINGS_EMBED_DEEP_LINK_ACTIVITY",T.SETUP_LOCK_SCREEN="com.android.settings.SETUP_LOCK_SCREEN",T.SHOW_ADMIN_SUPPORT_DETAILS="android.settings.SHOW_ADMIN_SUPPORT_DETAILS",T.SHOW_MANUAL="android.settings.SHOW_MANUAL",T.SHOW_REGULATORY_INFO="android.settings.SHOW_REGULATORY_INFO",T.SHOW_REMOTE_BUGREPORT_DIALOG="android.settings.SHOW_REMOTE_BUGREPORT_DIALOG",T.SHOW_RESTRICTED_SETTING_DIALOG="android.settings.SHOW_RESTRICTED_SETTING_DIALOG",T.SIM_PREFERENCE_SETTINGS="android.settings.SIM_PREFERENCE_SETTINGS",T.SIM_SUB_INFO_SETTINGS="com.android.settings.sim.SIM_SUB_INFO_SETTINGS",T.SOUND_SETTINGS="android.settings.SOUND_SETTINGS",T.SPA_SEARCH_LANDING="android.settings.SPA_SEARCH_LANDING",T.STORAGE_MANAGER_SETTINGS="android.settings.STORAGE_MANAGER_SETTINGS",T.STYLUS_USI_DETAILS_SETTINGS="com.android.settings.STYLUS_USI_DETAILS_SETTINGS",T.SUGGESTION_STATE_PROVIDER="com.android.settings.action.SUGGESTION_STATE_PROVIDER",T.SUPPORT_SETTINGS="com.android.settings.action.SUPPORT_SETTINGS",T.SYNC_SETTINGS="android.settings.SYNC_SETTINGS",T.TEMPERATURE_UNIT_SETTINGS="android.settings.TEMPERATURE_UNIT_SETTINGS",T.TETHER_PROVISIONING_UI="android.settings.TETHER_PROVISIONING_UI",T.TETHER_SETTINGS="android.settings.TETHER_SETTINGS",T.TETHER_UNSUPPORTED_CARRIER_UI="android.settings.TETHER_UNSUPPORTED_CARRIER_UI",T.TEXT_READING_SETTINGS="android.settings.TEXT_READING_SETTINGS",T.TRUSTED_CREDENTIALS="com.android.settings.TRUSTED_CREDENTIALS",T.TRUSTED_CREDENTIALS_USER="com.android.settings.TRUSTED_CREDENTIALS_USER",T.TTS_SETTINGS="com.android.settings.TTS_SETTINGS",T.TURN_SCREEN_ON_SETTINGS="android.settings.TURN_SCREEN_ON_SETTINGS",T.USAGE_ACCESS_SETTINGS="android.settings.USAGE_ACCESS_SETTINGS",T.USER_DICTIONARY_INSERT="android.settings.USER_DICTIONARY_INSERT",T.USER_DICTIONARY_SETTINGS="android.settings.USER_DICTIONARY_SETTINGS",T.USER_SETTINGS="android.settings.USER_SETTINGS",T.VIEW_ADVANCED_POWER_USAGE_DETAIL="android.settings.VIEW_ADVANCED_POWER_USAGE_DETAIL",T.VOICE_CONTROL_AIRPLANE_MODE="android.settings.VOICE_CONTROL_AIRPLANE_MODE",T.VOICE_CONTROL_BATTERY_SAVER_MODE="android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE",T.VOICE_CONTROL_DO_NOT_DISTURB_MODE="android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE",T.VOICE_INPUT_SETTINGS="android.settings.VOICE_INPUT_SETTINGS",T.VPN_SETTINGS="android.settings.VPN_SETTINGS",T.VR_LISTENER_SETTINGS="android.settings.VR_LISTENER_SETTINGS",T.WALLPAPER_SETTINGS="android.settings.WALLPAPER_SETTINGS",T.WEBVIEW_SETTINGS="android.settings.WEBVIEW_SETTINGS",T.WIFI_ADD_NETWORKS="android.settings.WIFI_ADD_NETWORKS",T.WIFI_CALLING_SETTINGS="android.settings.WIFI_CALLING_SETTINGS",T.WIFI_DETAILS_SETTINGS="android.settings.WIFI_DETAILS_SETTINGS",T.WIFI_DIALOG="com.android.settings.WIFI_DIALOG",T.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR",T.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER",T.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER="android.settings.WIFI_DPP_ENROLLEE_QR_CODE_SCANNER",T.WIFI_IP_SETTINGS="android.settings.WIFI_IP_SETTINGS",T.WIFI_NETWORK_REQUEST="com.android.settings.wifi.action.NETWORK_REQUEST",T.WIFI_SAVED_NETWORK_SETTINGS="android.settings.WIFI_SAVED_NETWORK_SETTINGS",T.WIFI_SCANNING_SETTINGS="android.settings.WIFI_SCANNING_SETTINGS",T.WIFI_SETTINGS="android.settings.WIFI_SETTINGS",T.WIFI_TETHER_SETTINGS="com.android.settings.WIFI_TETHER_SETTINGS",T.WIRELESS_SETTINGS="android.settings.WIRELESS_SETTINGS",T.ZEN_MODE_AUTOMATION_SETTINGS="android.settings.ZEN_MODE_AUTOMATION_SETTINGS",T.ZEN_MODE_EVENT_RULE_SETTINGS="android.settings.ZEN_MODE_EVENT_RULE_SETTINGS",T.ZEN_MODE_PRIORITY_SETTINGS="android.settings.ZEN_MODE_PRIORITY_SETTINGS",T.ZEN_MODE_SCHEDULE_RULE_SETTINGS="android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS",T.ZEN_MODE_SETTINGS="android.settings.ZEN_MODE_SETTINGS",T})({}),N=(function(T){return T[T.Success=-1]="Success",T[T.Canceled=0]="Canceled",T[T.FirstUser=1]="FirstUser",T})({})},1368,[499,1369]); +__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 t}});var t={}},1369,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1370,[796,34,1194,1041,839,379,402,102,794,865,836,827,840,1147,1100,1167,25]); +__d(function(_g,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1371,[1042,34,402,102,794,865,840,1100,985,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1372,[798,34,283,364,236,102,426,900,794,796,840,1325,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1373,[829,34,102,794,865,1014,827,1103,1101,985,1102,5,994,840,25]); +__d(function(g,_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 w}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=N,_e.signInWithText=H,_e.SignInWithLink=z,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return v.includes(h.APP_VARIANT)&&!T.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,E]=(0,u.useState)(p.useSession.persist.hasHydrated()),[N,H]=(0,u.useState)(p.START_INVITE?'checking':'done'),[F,V]=(0,u.useState)(null),[W,D]=(0,u.useState)(0),[L,K]=(0,u.useState)(!1),[U,G]=(0,u.useState)(null),Y=(0,p.useSession)(e=>e.meId),$=(0,p.useSession)(e=>!Y||!!e.welcomed[Y]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>E(!0));return p.useSession.persist.hasHydrated()&&E(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&V(e)});if(!t)return;if('refused'===e.kind)return V(e.message),void H('done');if('offline'===e.kind)return K(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(K(!1),'bad'===e.kind)return void H('bad')}const o=R(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),G(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?'This link cannot be used here. Ask your authorised manager.':L?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Y)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Y){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=F?`This link can\u2019t be used here. ${F}`:L?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==N?'bad'===N?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t,{app:s,message:l})})}if(L)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===N)return(0,x.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!Y&&!T.PITCH)return F&&/already been used/i.test(F)?j(w,'invite-app-used'):F&&(0,S.isPhoneLinked)(F)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):F?j(F,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===N)return(0,x.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(b.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)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,x.jsx)(b.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!Y&&(0,S.isPhoneLinked)(F))return(0,x.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:24,weight:"bold",center:!0,colour:k.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,x.jsx)(b.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,x.jsx)(b.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(b.Muted,{center:!0,children:F}),(0,x.jsx)(b.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,x.jsx)(b.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V(null)})]});if(U&&!Y)return(0,x.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(b.Muted,{center:!0,children:U}),(0,x.jsx)(z,{})]});if(!Y&&!T.PITCH&&!M())return(0,x.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,x.jsx)(b.Muted,{center:!0,children:F}):null,(0,x.jsx)(b.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,x.jsx)(z,{})]});const B=(0,p.rosterPerson)(Y);return B&&!$&&_(B)?(0,x.jsx)(m.LaunchWelcome,{p:B,onDone:()=>p.useSession.getState().markWelcomed(B.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),b=_r(d[14]),I=_r(d[15]),T=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]);const w='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,x.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(b.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function E(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function N(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 R=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?N(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return E(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=R(e.id.staffRef);n&&E(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=R(o.id.staffRef)??N({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return E(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,x.jsxs)(f.default,{style:{gap:6},children:[(0,x.jsx)(b.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)(b.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('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)(b.T,{size:13,colour:k.colours.red,children:t}):null]})}const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1374,[5,1375,1376,1377,1378,1379,34,236,41,102,846,997,840,1380,794,985,2,1072,996,865,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1375,[34,102,847,794,5,6,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1376,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1377,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AbbotsfordStaffHome=function({app:e,message:t}){return(0,l.jsxs)(n.default,{testID:"abbotsford-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:"abbotsford",size:240}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:t||'An authorised manager must be added first. No staff or personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"To confirm: first manager, staff, Covers and table plan, deposit, Copper Bar hours, dog policy and allergens. Dining and room requests need a manager decision. No payment is taken."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),l=r(d[4])},1378,[34,102,847,794,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.KirktonStaffHome=function({app:e,message:t}){return(0,c.jsxs)(n.default,{testID:"kirkton-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,c.jsx)(s.RestaurantHero,{rid:"kirkton",size:240}),(0,c.jsx)(o.T,{size:24,weight:"bold",center:!0,style:{width:'100%',flexShrink:1},children:e.replace('CoverCharge for ','')}),(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,c.jsx)(o.Muted,{children:t||'No manager or staff access has been set up. An authorised manager must be added first. No personal links have been created.'})]}),(0,c.jsx)(o.Muted,{center:!0,children:"To confirm: phone, current opening and kitchen hours, table plan, capacity, takeaway, deposits and current menus. Archived 2019 menus are provisional, not current stock."})]})},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4])},1379,[34,102,847,794,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!z||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(z)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[O,N]=(0,r.useState)('main'),[W,H]=(0,r.useState)(''),[M,_]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),V=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),G=(0,x.useOwner)(t=>t.hourly[e.id]),K=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),q='live'===$||'offline'===$,J=K?.salaried||e.salaried?'Salaried':null!=G?`\xa3${(G/100).toFixed(2)} an hour${K?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,j.appUrl)('staff'):null,X=`AN-${String(v.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=j.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(E,{colour:w.colours.muted,children:[V," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(E,{children:"GETTING YOU ON BOARD"})]}):'selfie'===O?(0,C.jsx)(F,{p:e,onClose:e=>{N('main'),e?(H('Avatar saved. Looking good!'),_(e=>e+1)):H('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(E,{children:[V," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},M),W?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:W}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(E,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(Y,{k:"NAME",v:e.name}),(0,C.jsx)(Y,{k:"ROLE",v:(0,j.levelJob)(e.level,e.job)}),(0,C.jsx)(Y,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(Y,{k:"PAY",v:J})}):null,(0,C.jsx)(Y,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:"Signed in on this phone"})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(E,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),z?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(E,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(D,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{H(''),N('selfie')}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.muted,children:"Your photo stays on this phone. It\u2019s turned into your avatar here; only the finished avatar is shared with your team."})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(D,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{z&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:q?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),j=_r(d[15]),v=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),z='undefined'!=typeof document,P=()=>z&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,O=()=>{try{z&&navigator.vibrate?.(12)}catch{}};function D({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{O(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const E=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting, plus the Assistant for quick answers'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=z?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const Y=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function F({p:e,onClose:s}){const[u,p]=(0,r.useState)('choose'),[x,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(null),[v,I]=(0,r.useState)(!1),[z,L]=(0,r.useState)(''),U=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{U.current&&URL.revokeObjectURL(U.current)},[]);const Y=async e=>{L('');const t=await(0,k.pickPhoto)(e);if(!t)return;U.current&&URL.revokeObjectURL(U.current);const n=URL.createObjectURL(t);U.current=n,b(n),I(!1),p('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),p('reveal'),O()},n)}catch{L("That photo couldn't be opened. Try another one (JPEG or PNG)."),p('choose')}},F=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(E,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsx)(T.T,{size:16,center:!0,colour:w.colours.muted,children:"Take a selfie or pick a photo. Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept."}),(0,C.jsx)(D,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>Y(!0)}),(0,C.jsx)(D,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>Y(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):L('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(F,{children:[x?(0,C.jsx)(o.default,{source:{uri:x},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(E,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:y?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:y},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:v},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{O(),I(!v)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:v?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:v?A:'transparent',alignItems:'center',justifyContent:'center'},children:v?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(D,{label:"Use this avatar",testID:"avatar-save",disabled:!v,onPress:()=>{if(!y)return;f.useAvatars.getState().setOwn(e.id,e.id,y,e.name)?(U.current&&URL.revokeObjectURL(U.current),U.current=null,s(!0)):L("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(D,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),p('choose')}})]}),z?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:z}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{O(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1380,[927,798,34,1072,336,236,402,295,41,102,846,924,865,800,985,997,15,793,840,899,794,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const L=(0,m.useInStaffApp)(),{now:N,meId:A,me:O,r:R,today:z}=(0,m.useCtx)(3e4),H=(0,s.useTravelDay)('staff',z),P=(0,h.useOwner)(e=>e.shifts),F=(0,h.useOwner)(e=>e.attendance),_=(0,h.useOwner)(e=>e.staffCanViewSuppliers),E=(0,h.useOwner)(e=>e.quickLinks),W=(0,h.useOwner)(e=>e.chat),q=(0,h.useOwner)(e=>e.swaps),V=(0,h.useOwner)(e=>e.leave),G=P.filter(e=>e.staffId===A&&e.published&&e.date>=z).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),U=G.find(e=>e.date===z),Y=F.filter(e=>e.staffId===A&&e.in&&!e.out&&N.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Q=(0,x.usePay)(A,0),K=(0,b.useOrders)(R.id),J=(0,b.useBookings)(R.id),X=K.filter(e=>(0,T.LIVE)(e)&&e.allergies.length&&(0,k.nextStep)(e,(0,k.linkedBooking)(e,J))),Z=J.filter(e=>e.date===z&&['confirmed','seated'].includes(e.status)&&(0,k.bookingNeedsAction)(e,K.filter(T.LIVE))),ee=J.filter(e=>(0,S.undoKind)(e,z)||e.walkIn&&'cancelled'===e.status&&e.date===z).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),se=W.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],te=q.filter(e=>e.fromId===A&&'open'===e.status).length+V.filter(e=>e.staffId===A&&'pending'===e.status).length,ie=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],..._?[['Suppliers',()=>e('more','suppliers')]]:[]];return!L&&H?(0,v.jsxs)(o.default,{style:{gap:10},children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(s.DayView,{rid:R.id,day:H,today:z,app:"staff"})]}):(0,v.jsxs)(o.default,{style:{gap:10},children:[L?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.DayBar,{app:"staff",today:z}),(0,v.jsx)(t.CoversToday,{rid:R.id})]}),(0,v.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,v.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,v.jsx)(C.StaffAvatar,{id:A,size:52})}),(0,v.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",O.replace(' (example)','').split(' ')[0]]})]}),(0,v.jsx)(r.Badge,{kind:"gold",label:L?R.name:'Staff app preview'})]}),(0,v.jsx)(r.Muted,{children:L?`${N.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,v.jsx)(M.StaffTipsTile,{rid:R.id,today:z,onPress:()=>e('more','mytips')}),(0,v.jsxs)(r.Card,{highlight:Y?u.colours.ok:void 0,children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{weight:"semibold",children:Y?`On shift since ${(0,c.hm)(new Date(Y.in))}`:'Not clocked in'}),Y?(0,v.jsx)(r.Badge,{kind:"ok",label:(0,m.hmDur)(Math.max(0,Math.round((N.getTime()-new Date(Y.in).getTime())/6e4)))}):null]}),U?(0,v.jsxs)(r.Muted,{children:["Today on the rota: ",(0,m.fmtH)(U.start),"\u2013",(0,m.fmtH)(U.end)]}):G[0]?(0,v.jsxs)(r.Muted,{children:["Next on the rota: ",m.DAY3[G[0].day]," ",Number(G[0].date.slice(8))," ",(0,m.fmtH)(G[0].start),"\u2013",(0,m.fmtH)(G[0].end)]}):(0,v.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,v.jsx)(r.Button,{small:!0,kind:Y?'secondary':'success',label:Y?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),A?(0,v.jsx)($.RequestTimeOff,{meId:A,me:O,testID:"staff-home-time-off"}):null,(0,v.jsx)(p.ShellfishTile,{rid:R.id,by:O.replace(' (example)',''),app:"staff"}),ee.length?(0,v.jsx)(r.Card,{children:(0,v.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ee.length,")"]}),(0,v.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),ee.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,v.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,v.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,v.jsxs)(r.Muted,{children:[e.table?(0,I.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,v.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,B.finishBookingNow)(R.id,e)}):null,e.walkIn?(0,v.jsx)(a.CancelWalkInButton,{rid:R.id,b:e,small:!0}):null,e.walkIn?(0,v.jsx)(a.ReinstateWalkInButton,{rid:R.id,b:e,today:z,small:!0}):null,(0,v.jsx)(S.BookingUndo,{b:e,rid:R.id,today:z,who:s})]})]},e.id)})]})}):null,X.length+Z.length?(0,v.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,v.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",X.length+Z.length,")"]}),(0,v.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),X.map(e=>(0,v.jsx)(j.AllergyChain,{o:e,me:O},e.id)),Z.map(e=>(0,v.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,D.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,v.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,I.tablesLabel)(e.table)}`:'']}),(0,v.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,v.jsx)(j.BookingAllergyChain,{b:e,me:O}),(0,v.jsx)(o.default,{style:{flexDirection:'row'},children:(0,v.jsx)(w.WhatsAppGuest,{b:e,rid:R.id,kind:"auto"})})]},e.id))]}):null,se?(0,v.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,v.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,v.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,v.jsx)(r.T,{size:14,children:se.text})]}):null,(0,v.jsxs)(r.Card,{children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,v.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,m.hmDur)(Q.paid)," paid hours"]})]}),te?(0,v.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,v.jsxs)(r.T,{size:14,children:["You have ",te," request",te>1?'s':''," waiting for a manager \u203a"]})}):null,(0,y.visibleLinks)(E,'staff').length?(0,v.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,v.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,v.jsx)(y.QuickLinksRow,{compact:!0})]}):null,L?null:(0,v.jsx)(o.default,{style:{gap:6},children:ie.map(([e,s])=>(0,v.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),S=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),M=_r(d[26]),$=_r(d[27]),v=_r(d[28])},1381,[1148,1073,1112,1089,34,402,102,794,865,827,840,1090,1142,1100,1145,1367,1136,850,1149,838,1147,899,1360,1014,829,1096,1154,1159,25]); +__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]})}},1382,[30,34,846,25]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var t=r(_d[0]),s=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),_=r(_d[16]),O=r(_d[17]),P=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),x=r(_d[22]),A=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]);r(_d[27]);var I=r(_d[28]),k=r(_d[29]),R=r(_d[30]),H=r(_d[31]),T=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]);const G=r(_d[37]),L=r(_d[38]),M=r(_d[39]),U=r(_d[40]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:G,Poppins_500Medium:L,Poppins_600SemiBold:M,Poppins_700Bold:U}),[t,E]=(0,d.useState)(v.useStore.persist.hasHydrated()),[T,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=t&&T;(0,d.useEffect)(()=>{const e=v.useStore.persist.onFinishHydration(()=>E(!0)),t=x.useOwner.persist.onFinishHydration(()=>F(!0));return v.useStore.persist.hasHydrated()&&E(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),t()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(v.useStore.persist.getOptions().name??'')&&(0,C.quietly)(()=>v.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(b.useFloor.persist.getOptions().name??'')&&(0,C.quietly)(()=>b.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,C.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,s.startAppSync)()},[B]);const V=e&&B,q=(0,w.useSignedOutGate)(),D=(0,u.usePathname)(),K=V&&!(0,O.isAllowedPath)(D||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(O.ENTRY[O.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,D]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,N.jsxs)(j.SafeAreaProvider,{children:[(0,N.jsx)(c.StatusBar,{style:"light"}),q?(0,N.jsx)(h.default,{style:{flex:1,backgroundColor:A.colours.bg}}):(0,N.jsx)(h.default,{style:{flex:1},children:(0,N.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:A.colours.bg}}})}),K&&!q?(0,N.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:A.colours.bg}]}):null,K||q||O.IS_CAR?null:(0,N.jsx)(R.VoiceHost,{}),q?null:(0,N.jsx)(I.SyncBadge,{}),K||q||O.IS_CAR?null:(0,N.jsx)(k.PushPrompt,{}),O.IS_CAR?(0,N.jsx)(P.CarGate,{}):(0,N.jsx)(w.InviteGate,{}),K||q?null:(0,N.jsx)(H.SliderHost,{})]}):(0,N.jsxs)(h.default,{style:{flex:1,backgroundColor:A.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[_.HERO_LOGOS[S.VENUE_RID]?(0,N.jsx)(p.default,{source:_.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,N.jsx)(f.default,{color:A.colours.gold})]})}T.PITCH&&(globalThis.__pitch={useSaverCfg:V.useSaverCfg,useSync:s.useSync,seedInvitePairsForQA:t.seedInvitePairsForQA,appVariant:O.APP_VARIANT,useStore:v.useStore,useOwner:x.useOwner,useFloor:b.useFloor,useBlocks:o.useBlocks,useSession:E.useSession,useCashUp:F.useCashUp,seedPitch:B.seedPitch},setTimeout(()=>{try{(0,B.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),E.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1383,[1384,985,795,1335,1386,1011,30,1413,496,34,385,336,236,41,102,5,847,846,1415,36,848,1014,865,840,1374,997,1010,1418,1419,1420,1421,1099,2,1024,1441,1304,25,1442,1443,1444,1445]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return j}}),_e.refreshLinkPhones=P,_e.linkedSinceText=I,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return v.add(n),A(),()=>{v.delete(n)}},[]),x},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,s),S()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return D}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,u.useSync)(e=>e.venueId),b=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),x=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),j=b&&e.active&&!e.name.includes('(example)')&&('owner'===s||x||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,B=(0,f.useSession)(e=>e.meId),T=(0,y.useOwner)(e=>B?e.staff.find(e=>e.id===B):void 0),E=!B||!!T&&(0,k.ownJobManagesLinks)(T),[,z]=(0,t.useState)(0),[O,_]=(0,t.useState)(''),[W,U]=(0,t.useState)(!1),[Z,F]=(0,t.useState)(null),[G,N]=(0,t.useState)(null),[Q,Y]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!j)return;const n=()=>z(e=>e+1);v.add(n),P(),M(A,e.id);const t=setInterval(()=>{M(A,e.id)},3e4),s=()=>{M(A,e.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{v.delete(n),clearInterval(t),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[j,A,e.id]),!j)return null;const J=w.get(A),q=async n=>{try{await(0,u.revokeStaffAppLink)(n),w.delete(A),N(null),_('Link revoked. Existing signed-in sessions are unchanged.'),await M(A,e.id),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=I(L[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:h.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),E?Q?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,u.resetStaffLinkPhone)(e.id),await P(),_(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){_(String(e.message))}finally{Y(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>Y(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>Y(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),['android','iphone'].map(t=>{const s='android'===t?'Android app':'iPhone web app',o=J?.[t],u=(0,c.currentAppLink)(o)&&o?(0,c.personalAppUrl)(t,o):null;return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:h.colours.gold,backgroundColor:h.colours.bg},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),u&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:h.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:H(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>_(await(0,p.copyText)(D(u,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>_(await R(u,e.name,t))}),E?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>N(o.id)}):null]})]}):(0,m.jsx)(d.Muted,{children:$.has(A)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},t)}),G&&E?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{q(G)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>N(null)})]}):null,O?(0,m.jsx)(d.T,{center:!0,size:14,children:O}):null,(0,m.jsx)(d.Button,{label:W?"Making new links\u2026":"Make new app links",testID:`invite-new-${e.id}`,accessibilityLabel:`Make new Android and iPhone app links for ${e.name}`,disabled:W,onPress:async()=>{if(!W){U(!0);try{const n=await(0,u.refreshStaffAppLinks)(e.id);w.set(A,n),$.delete(A),S(),_('New links ready. Links already sent keep working. Signed-in phones stay signed in.'),Z&&F(await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}finally{U(!1)}}}}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Z?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{F(Z?null:await(0,u.staffAppLinkHistory)(e.id))}catch(e){_(String(e.message))}}}),Z?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&E?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>N(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]),p=r(_d[10]),f=r(_d[11]),y=r(_d[12]),k=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,v=new Set,$=new Map,S=()=>v.forEach(e=>e());let x=null;const j=()=>x;let L={};async function P(){return L=await(0,u.staffLinkPhones)(),S(),L}function I(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return x=await(0,u.readInviteStatus)(),S(),x}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH&&w.has(n))return;if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,u.ensureStaffAppLinks)(t)),$.delete(n)}catch(e){w.delete(n),$.set(n,String(e.message||e))}finally{b.delete(n),S()}})();return b.set(n,s),s}const H=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',D=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${H(t)}`;async function R(e,n,t){const s=D(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1384,[2,796,34,236,383,102,794,1385,985,840,1151,997,865,988,25]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1385,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1386,[1387,1410,1412]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1387,[215,1388,1391,1405,1406,1407,1408,1409]); +__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 p}}),e._matchesFontFaceOptions=l,e._fontFaceRuleSrcMatches=f,e._createWebFontTemplate=R;var t=r(d[0]),n=r(d[1]);function s(){if('undefined'==typeof window)return null;const t=S();return t.sheet?t.sheet:null}function o(){const t=s();if(t){const n=[...t.cssRules],s=[];for(let t=0;t=2&&('"'===s||"'"===s)&&n.endsWith(s)?n.slice(1,-1).replace(/\\(.)/g,'$1'):n}function u(t){if(null==t||''===t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const s=Number(n);return Number.isFinite(s)?s:n}function l(t,n,s){return i(t.style.fontFamily)===n&&((!s?.display||s.display===t.style.fontDisplay)&&((null==s?.weight||u(s.weight)===u(t.style.fontWeight))&&(null==s?.style||s.style===t.style.fontStyle)))}function c(t,n){return o().filter(({rule:s})=>l(s,t,n))}function f(t,n){const s=t.style.getPropertyValue('src').match(/url\((['"]?)([^'")]*)\1\)/);if(!s)return!0;let o=s[2]??'';try{o=decodeURIComponent(o)}catch{}return o===String(n)}const a={async unloadAllAsync(){if('undefined'==typeof window)return;const t=document.getElementById(w);t&&t instanceof HTMLStyleElement&&document.removeChild(t)},async unloadAsync(t,n){const o=s();if(!o)return;const i=[...c(t,n)].sort((t,n)=>n.index-t.index);for(const t of i)o.deleteRule(t.index)},getServerResources:()=>(0,n.getServerResourceDescriptors)().map(t=>{switch(t.type){case'style':return``;case'link':return``;default:return''}}).filter(Boolean),getServerResourceDescriptors:()=>(0,n.getServerResourceDescriptors)(),getLoadedFonts(){if('undefined'==typeof window)return(0,n.getLoadedServerFonts)();const t=new Set,s=[];for(const{rule:n}of o()){const o=i(n.style.fontFamily);t.has(o)||(t.add(o),s.push(o))}return s},isLoaded:(t,s={})=>'undefined'==typeof window?(0,n.isServerFontLoaded)(t):c(t,s)?.length>0,loadAsync(s,o){if('undefined'==typeof window)return(0,n.addServerFont)({name:s,css:R(s,o),resourceId:o.uri}),Promise.resolve();if(!(document.head&&'function'==typeof document.head.appendChild))throw new t.CodedError('ERR_WEB_ENVIRONMENT',"The browser's `document.head` element doesn't support injecting fonts.");const i=S();i.isConnected||document.head.appendChild(i);if(c(s,o).some(({rule:t})=>f(t,o.uri))||b(s,o),'function'!=typeof document.fonts?.load)return Promise.resolve();let u='';return'string'==typeof o.style&&$.test(o.style)&&(u+=`${o.style} `),('number'==typeof o.weight&&Number.isFinite(o.weight)||'string'==typeof o.weight&&($.test(o.weight)||F.test(o.weight)&&!o.weight.includes(' ')))&&(u+=`${o.weight} `),h(document.fonts.load(`${u}1em ${JSON.stringify(s)}`),s)}},y=12e3;function h(n,s){let o;const i=new Promise((n,i)=>{o=setTimeout(()=>{i(new t.CodedError('ERR_DOWNLOAD',`Fetching the font family "${s}" timed out after ${y}ms. Check that the font URL is reachable and served with CORS headers.`))},y)});return Promise.race([n,i]).finally(()=>clearTimeout(o)).then(()=>{})}var p='undefined'==typeof window?a:(0,t.registerWebModule)(function(){return a},'ExpoFontLoader');const w='expo-generated-fonts';function S(){const t=document.getElementById(w);if(t&&t instanceof HTMLStyleElement)return t;const n=document.createElement('style');return n.id=w,n}const $=/^[a-zA-Z_-][\w-]*$/,F=/^(1000|[1-9]\d{0,2})( (1000|[1-9]\d{0,2}))?$/;function R(t,n){const s=[`font-family:${JSON.stringify(t)}`,`src:url(${JSON.stringify(n.uri)})`];return'string'==typeof n.display&&$.test(n.display)&&s.push(`font-display:${n.display}`),('number'==typeof n.weight&&Number.isFinite(n.weight)||'string'==typeof n.weight&&($.test(n.weight)||F.test(n.weight)))&&s.push(`font-weight:${n.weight}`),'string'==typeof n.style&&$.test(n.style)&&s.push(`font-style:${n.style}`),`@font-face{${s.join(';')}}`}function b(t,n){const s=R(t,n),o=S();if(o.styleSheet){const t=o;t.styleSheet.cssText=t.styleSheet.cssText?t.styleSheet.cssText+s:s}else if(o.sheet)o.sheet.insertRule(s,o.sheet.cssRules.length);else{const t=document.createTextNode(s);o.appendChild(t)}return o}},1388,[215,1389]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.withServerContext=function(n){if('undefined'!=typeof window)return n();return s().run(new Map,n)},e.addServerFont=function(n){const t=u();t.has(n.css)||t.set(n.css,n)},e.getServerResourceDescriptors=function(){const n=[...u().values()];if(!n.length)return[];const o=n.map(({css:n})=>n).join('\n'),s=[...new Set(n.map(({resourceId:n})=>n))];return[{css:o,id:t,type:'style'},...s.map(n=>({as:'font',crossOrigin:'',href:n,rel:'preload',type:'link'}))]},e.getLoadedServerFonts=function(){const n=s().getStore();if(!n)return[];return[...new Set([...n.values()].map(({name:n})=>n))]},e.isServerFontLoaded=function(n){const t=s().getStore();if(!t)return!1;for(const o of t.values())if(o.name===n)return!0;return!1};var n=r(d[0]);const t='expo-generated-fonts';let o=null;function s(){if('undefined'!=typeof window)throw new Error('expo-font server context is server-only and cannot be used in the browser.');return o||(o=new n.AsyncLocalStorage),o}function u(){const n=s().getStore();if(!n)throw new Error("expo-font server context accessed outside of withServerContext(). Wrap your server-side font usage in withServerContext(() => /* server code */).");return n}},1389,[1390]); +__d(function(g,r,i,a,m,e,d){},1390,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getAssetForSource=p,_e.loadFontFamilyAsync=async function(t,e){await Promise.all(e.map(e=>{const o=p((0,f.fontSourceFromFace)(e));return j(t,o)}))},_e.loadSingleFontAsync=j;var t,e=r(d[0]),o=r(d[1]),n=r(d[2]),u=(t=n)&&t.__esModule?t:{default:t};r(d[3]);var f=r(d[4]);function s(t){return'string'==typeof t?t||null:'number'==typeof t?s(e.Asset.fromModule(t)):'object'==typeof t&&'number'==typeof t.uri?s(t.uri):'object'==typeof t&&(t.uri||t.localUri||t.default)||null}function c(t){if('object'==typeof t&&'display'in t)return t.display??void 0}function l(t){if('object'==typeof t&&'weight'in t)return t.weight??void 0}function y(t){if('object'==typeof t&&'style'in t)return t.style??void 0}function p(t){const e=s(t),o=c(t),n=l(t),u=y(t);return e&&'string'==typeof e||b(e),{uri:e,display:o,weight:n,style:u}}function b(t){let e=typeof t;throw'object'===e&&(e=JSON.stringify(t,null,2)),new o.CodedError("ERR_FONT_SOURCE",`Expected font asset of type \`string | FontResource | Asset\` instead got: ${e}`)}function j(t,e){return('object'!=typeof e||'string'!=typeof e.uri||e.downloadAsync)&&b(e),u.default.loadAsync(t,e)}},1391,[1392,215,1388,1405,1406]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),r(d[0]);var t=r(d[1]);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[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]}})})},1392,[1393,1394,1404]); +__d(function(g,r,i,a,m,_e,d){"use strict";var e,t=r(d[0]),s=r(d[1]),u=r(d[2]),o=(e=u)&&e.__esModule?e:{default:e};if(s.IS_ENV_WITH_LOCAL_ASSETS){(o.default.setCustomSourceTransformer||u.setCustomSourceTransformer)(function(e){try{if('fileHashes'in e.asset&&e.asset.fileHashes){const s=t.Asset.fromMetadata(e.asset);return s.uri.startsWith(t.ANDROID_EMBEDDED_URL_BASE_RESOURCE)?e.resourceIdentifierWithoutScale():e.fromSource(s.downloaded?s.localUri:s.uri)}return e.defaultAsset()}catch{return e.defaultAsset()}})}},1393,[1394,1398,1403]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANDROID_EMBEDDED_URL_BASE_RESOURCE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"Asset",{enumerable:!0,get:function(){return w}}),r(_d[0]);var s=t(r(_d[1])),n=r(_d[2]),h=e(r(_d[3])),o=r(_d[4]),l=e(r(_d[5])),u=r(_d[6]),d=r(_d[7]),c=t(r(_d[8]));function f(t){return!!t&&'object'==typeof t&&'uri'in t&&'string'==typeof t.uri}const y='file:///android_res/';class w{static byHash={};static byUri={};hash=null;localUri=null;width=null;height=null;downloading=!1;downloaded=!1;_downloadCallbacks=[];constructor({name:t,type:e,hash:s=null,uri:n,width:o,height:l}){this.name=t,this.type=e,this.hash=s,this.uri=n,'number'==typeof o&&(this.width=o),'number'==typeof l&&(this.height=l),s&&(this.localUri=(0,u.getLocalAssetUri)(s,e),this.localUri?.startsWith(y)?(this.uri=this.localUri,this.localUri=null):this.localUri&&(this.downloaded=!0)),t||(this.name=h.getFilename(n)),e||(this.type=h.getFileExtension(n))}static loadAsync(t){const e=Array.isArray(t)?t:[t];return Promise.all(e.map(t=>w.fromModule(t).downloadAsync()))}static fromModule(t){if('string'==typeof t)return w.fromURI(t);if(f(t)){const e=h.getFileExtension(t.uri);return new w({name:'',type:e.startsWith('.')?e.substring(1):e,hash:null,uri:t.uri,width:t.width,height:t.height})}const e=s.default.getAssetByID(t);if(!e)throw new Error(`Module "${t}" is missing from the asset registry`);if(!d.IS_ENV_WITH_LOCAL_ASSETS){const{uri:s}=(0,c.default)(t),n=new w({name:e.name,type:e.type,hash:e.hash,uri:s,width:e.width,height:e.height});return w.byHash[e.hash]=n,n}return w.fromMetadata(e)}static fromMetadata(t){const e=t.hash,s=w.byHash[e];if(s)return s;const{uri:h,hash:o}=(0,n.selectAssetSource)(t),l=new w({name:t.name,type:t.type,hash:o,uri:h,width:t.width,height:t.height});return w.byHash[e]=l,l}static fromURI(t){if(w.byUri[t])return w.byUri[t];let e='';if(t.indexOf(';base64')>-1)e=t.split(';')[0]?.split('/')[1]??'';else{const s=h.getFileExtension(t);e=s.startsWith('.')?s.substring(1):s}const s=new w({name:'',type:e,hash:null,uri:t});return w.byUri[t]=s,s}async downloadAsync(){if(this.downloaded)return this;if(this.downloading)return await new Promise((t,e)=>{this._downloadCallbacks.push({resolve:t,reject:e})}),this;this.downloading=!0;try{if(l.isImageType(this.type)){const{width:t,height:e,name:s}=await l.getImageInfoAsync(this.uri);this.width=t,this.height=e,this.name=s}else this.name=h.getFilename(this.uri);this.localUri=await(0,o.downloadAsync)(this.uri,this.hash,this.type),this.downloaded=!0,this._downloadCallbacks.forEach(({resolve:t})=>t())}catch(t){throw this._downloadCallbacks.forEach(({reject:e})=>e(t)),t}finally{this.downloading=!1,this._downloadCallbacks=[]}return this}}},1394,[215,372,1395,1399,1400,1401,1402,1398,1403]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.selectAssetSource=function(e){const t=o.default.pickScale(e.scales,s.default.get()),f=e.scales.findIndex(e=>e===t),l=e.fileHashes?.[f]??e.fileHashes?.[0]??e.hash,p=e.fileUris?e.fileUris[f]??e.fileUris[0]:e.uri;if(p)return{uri:c(p),hash:l};const U=1===t?'':`@${t}x`,v=e.type?`.${encodeURIComponent(e.type)}`:'',x=`/${encodeURIComponent(e.name)}${U}${v}`,L=new URLSearchParams({platform:"web",hash:e.hash});if(/^https?:\/\//.test(e.httpServerLocation)){return{uri:e.httpServerLocation+x+'?'+L,hash:l}}const R=(0,h.getManifest2)(),S=R?.extra?.expoGo?.developer?u(R):null;if(S){const t=new URL(e.httpServerLocation+x,S);return t.searchParams.set('platform',"web"),t.searchParams.set('hash',e.hash),{uri:t.href,hash:l}}if(n.default.ExponentKernel)return{uri:`https://classic-assets.eascdn.net/~assets/${encodeURIComponent(l)}`,hash:l};return{uri:'',hash:l}},_e.resolveUri=c,r(d[0]);var t=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),h=r(d[5]);function u(e){const s=(0,t.getBundleOrigin)();if(s)return s;const n=e.extra?.expoGo?.debuggerHost;if(!n)return null;return(h.manifestBaseUrl?.startsWith('https://')?'https://':'http://')+n}function c(e){return h.manifestBaseUrl?new URL(e,h.manifestBaseUrl).href:e}},1395,[215,1396,339,280,1397,1398]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"getBundleUrl",{enumerable:!0,get:function(){return t.getBundleUrl}}),e.getBundleOrigin=function(n=(0,t.getBundleUrl)()){if(!n)return null;try{const{protocol:t,origin:u}=new URL(n);return'http:'===t||'https:'===t?u:null}catch{return null}};var t=r(d[0])},1396,[504]); +__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}}),r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e};function c(e){const t=n.pickScale(e.scales,s.default.get()),c=1===t?'':'@'+t+'x',o=e.type?`.${e.type}`:'';return e.httpServerLocation.replace(/\.\.\//g,'_')+'/'+e.name+c+o}class n{constructor(e,t,s){this.serverUrl=e||'https://expo.dev',this.jsbundleUrl=null,this.asset=s}isLoadedFromServer(){return!0}isLoadedFromFileSystem(){return!1}defaultAsset(){return this.assetServerURL()}assetServerURL(){const e=new URL(c(this.asset),this.serverUrl);return e.searchParams.set('platform',"web"),e.searchParams.set('hash',this.asset.hash),this.fromSource(e.toString().replace(e.origin,''))}fromSource(e){return{__packager_asset:!0,width:this.asset.width??void 0,height:this.asset.height??void 0,uri:e,scale:n.pickScale(this.asset.scales,s.default.get())}}static pickScale(e,t){for(const s of e)if(s>=t)return s;return e[e.length-1]||1}}},1397,[215,339]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_ENV_WITH_LOCAL_ASSETS",{enumerable:!0,get:function(){return t}}),e.getLocalAssets=function(){return{}},e.getManifest2=function(){return{}},Object.defineProperty(e,"manifestBaseUrl",{enumerable:!0,get:function(){return n}});const t=!1;const n=null},1398,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const{pathname:s,searchParams:o}=new URL(t,'https://e');return n(s)}function n(t){return t.substring(t.lastIndexOf('/')+1)}Object.defineProperty(e,'__esModule',{value:!0}),e.getFilename=t,e.getFileExtension=function(n){const s=t(n),o=s.lastIndexOf('.');return o>0?s.substring(o):''},e.getManifestBaseUrl=function(t){const n=new URL(t);let s=n.protocol;'exp:'===s?s='http:':'exps:'===s&&(s='https:');n.protocol=s;const o=n.pathname.substring(0,n.pathname.lastIndexOf('/')+1);return n.pathname=o,n.search='',n.hash='',n.protocol!==s?n.href.replace(n.protocol,s):n.href}},1399,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.downloadAsync=async function(n,t,c){return n}},1400,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isImageType=function(n){return/^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(n)},e.getImageInfoAsync=function(t){if('undefined'==typeof window)return Promise.resolve({name:(0,n.getFilename)(t),width:0,height:0});return new Promise((o,u)=>{const s=new Image;s.onerror=u,s.onload=()=>{o({name:(0,n.getFilename)(t),width:s.naturalWidth,height:s.naturalHeight})},s.src=t})};var n=r(d[0])},1401,[1399]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1402,[]); +__d(function(g,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}}),_e.setCustomSourceTransformer=o,Object.defineProperty(_e,"pickScale",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),n=e(r(d[1]));let u;function o(e){u=e}function c(e){if('object'==typeof e)return e;const o=t.default.getAssetByID(e);if(!o)return null;const c=new n.default('https://expo.dev',null,o);return u?u(c):c.defaultAsset()}Object.defineProperty(c,'setCustomSourceTransformer',{get:()=>o});var f=c;const{pickScale:l}=n.default},1403,[372,1397]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useAssets=function(u){const[c,n]=(0,t.useState)(),[o,f]=(0,t.useState)();return(0,t.useEffect)(()=>{s.Asset.loadAsync(u).then(n).catch(f)},[]),[c,o]};var t=r(d[0]),s=r(d[1])},1404,[34,1394]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeWeight=o,e.normalizeStyle=f,e.resolveFaceWeight=l,e.resolveFaceStyle=c,e.assertValidFontFaces=function(t,s){if('string'!=typeof t||0===t.length)throw new n.CodedError("ERR_FONT_API",`Expected a non-empty string for \`fontFamily\`, instead got ${JSON.stringify(t)}. Set \`fontFamily\` to the name to use as the \`fontFamily\` style prop.`);if(!Array.isArray(s)||0===s.length)throw new n.CodedError("ERR_FONT_API",`No font faces were provided for font family "${t}". Set \`fontDefinitions\` to a non-empty array of \`FontFaceDefinition\`s.`);const y=new Set;for(const u of s){if('object'!=typeof u||null===u||null==u.path)throw new n.CodedError("ERR_FONT_API",`A face of font family "${t}" has no \`path\`. Set the face's \`path\` to a \`FontSource\`.`);const s=o(l(u)),h=f(c(u));if(void 0===s||void 0===h)continue;const F=`${s}/${h}`;if(y.has(F))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" declares two faces with weight ${s} and style "${h}". Give each face a distinct weight or style so the correct face is selected at render time.`);y.add(F)}},e.assertValidFontFamilyDefinitions=function(t){const o=new Set;for(const f of t){if('object'!=typeof f||null===f||Array.isArray(f)||!('fontFamily'in f)||!('fontDefinitions'in f))throw new n.CodedError("ERR_FONT_API",`Expected an object with \`fontFamily\` and \`fontDefinitions\`, instead got ${JSON.stringify(f)}. Set each array element to \`{ fontFamily, fontDefinitions }\`.`);const{fontFamily:t}=f;if(o.has(t))throw new n.CodedError("ERR_FONT_API",`Font family "${t}" is declared more than once in this \`loadAsync\` call. Declare each \`fontFamily\` once, with all of its faces in one \`fontDefinitions\` array.`);o.add(t)}};var t=r(d[0]),n=r(d[1]);function o(t){if(null==t)return;if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.trim().toLowerCase();if('normal'===n)return 400;if('bold'===n)return 700;const o=Number(n);return Number.isFinite(o)?o:void 0}function f(t){if(null==t)return;const n=t.trim().toLowerCase();return'italic'===n||'oblique'===n?'italic':'normal'}function s(n){if(!(n instanceof t.Asset||'string'==typeof n||'number'==typeof n))return n}function l(t){return t.weight??s(t.path)?.weight}function c(t){return t.style??s(t.path)?.style}},1405,[1392,215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fontSourceFromFace=function(n){const{path:o,display:s}=n,u=(0,l.resolveFaceWeight)(n),c=(0,l.resolveFaceStyle)(n);if(o instanceof t.Asset)return{uri:o.uri,...void 0!==u?{weight:u}:null,...void 0!==c?{style:c}:null,...void 0!==s?{display:s}:null};const y='string'==typeof o||'number'==typeof o?{uri:o}:o;return{...y,weight:u,style:c,display:s??y.display}};var t=r(d[0]),l=r(d[1])},1406,[1392,1405]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"loadPromises",{enumerable:!0,get:function(){return o}}),_e.markLoaded=function(e){u[e]=!0},_e.isLoadedInCache=c,_e.isLoadedNative=function(e){if(c(e))return!0;{const n=t.default.getLoadedFonts();return!!n?.length&&(n.forEach(e=>{u[e]=!0}),e in u)}},_e.purgeFontFamilyFromCache=function(e){delete u[e]},_e.purgeCache=function(){u={}};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o={};let u={};function c(e){return e in u}},1407,[1388]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"withServerContext",{enumerable:!0,get:function(){return u.withServerContext}}),_e.getServerResources=function(){if(!n.default.getServerResources)throw new t.UnavailabilityError('expo-font','getServerResources');return n.default.getServerResources()},_e.getServerResourceDescriptors=function(){if(!n.default.getServerResourceDescriptors)throw new t.UnavailabilityError('expo-font','getServerResourceDescriptors');return n.default.getServerResourceDescriptors()},_e.registerStaticFont=function(e,o){if(!o)throw new t.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${o} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);const n=(0,s.getAssetForSource)(o);(0,s.loadSingleFontAsync)(e,n)};var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),u=r(d[3])},1408,[215,1388,1391,1389]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FontDisplay",{enumerable:!0,get:function(){return t}});var t=(function(t){return t.AUTO="auto",t.SWAP="swap",t.BLOCK="block",t.FALLBACK="fallback",t.OPTIONAL="optional",t})({})},1409,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.renderToImageAsync=async function(e,l){if(!t.default)throw new o.UnavailabilityError('expo-font','ExpoFontUtils.renderToImageAsync');return await t.default.renderToImageAsync(e,{...l,color:l?.color?(0,n.default)(l.color):void 0})};var o=r(d[0]),n=e(r(d[1])),t=e(r(d[2]))},1410,[215,54,1411]); +__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 o}});var t=r(d[0]);class n extends t.NativeModule{async renderToImageAsync(n,o){throw new t.UnavailabilityError('expo-font','renderToImageAsync')}}var o=(0,t.registerWebModule)(n,'ExpoFontUtils')},1411,[215]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return u}});var t=r(d[0]),n=r(d[1]);function o(t){return'string'==typeof t?(0,n.isLoaded)(t):Array.isArray(t)?t.every(t=>{const o=t?.fontFamily;return'string'==typeof o&&(0,n.isLoaded)(o)}):Object.keys(t).every(t=>(0,n.isLoaded)(t))}const u='undefined'==typeof window?function(t){return(0,n.loadAsync)(t),[!0,null]}:function(u){const[s,c]=(0,t.useState)(o(u)),[f,y]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let t=!0;return(0,n.loadAsync)(u).then(()=>{t&&c(!0)}).catch(n=>{t&&y(n)}),()=>{t=!1}},[]),[s,f]}},1412,[34,1387]); +__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]}})})},1413,[1414]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.preventAutoHideAsync=async function(){return!1},e.setOptions=function(n){},e.hide=function(){},e.hideAsync=async function(){}},1414,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CarGate=function(){const e=(0,c.useSession)(e=>e.meId),[s,o]=(0,t.useState)(c.useSession.persist.hasHydrated());return(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>o(!0));return c.useSession.persist.hasHydrated()&&o(!0),e},[]),s?e||h.PITCH?null:(0,j.jsx)(I,{}):(0,j.jsx)(n.default,{style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),r=e(_r(d[1])),n=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),f=_r(d[10]),p=_r(d[11]),y=_r(d[12]),j=_r(d[13]);let b=null,w=null;async function M(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:b||(b=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{b=null}),b)}function I(){const{width:e,height:c}=(0,s.default)(),[h,b]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,D]=(0,t.useState)(''),[k,C]=(0,t.useState)(0),z=(0,t.useRef)(!1),S=(0,t.useCallback)(async(e=!0)=>{if(z.current)return;z.current=!0,I('starting'),D('');const t=await M(e);if(z.current=!1,!t.ok)return I('error'),void D(t.error);b({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{S(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{C(Math.max(0,Math.round((h.until-Date.now())/1e3)));('expired'===await(0,u.carPairPoll)(h.id)||Date.now()>h.until)&&I('expired')},3e3);return()=>clearInterval(e)},[h,w]);const P=Math.min(120,Math.max(64,Math.round(Math.min(e/9,c/7)))),H=h?.code??'',v=H?`${H.slice(0,3)} ${H.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,j.jsx)(n.default,{testID:"car-pairing",style:[r.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,j.jsxs)(n.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,j.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,j.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,j.jsx)(y.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:18,colour:f.colours.muted,children:"Sign this car in from your phone"}),(0,j.jsx)(n.default,{testID:"car-code",accessible:!0,accessibilityLabel:H?`Car code ${(0,p.spokenCode)(H)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,j.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:f.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:v})}),H?(0,j.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((k||600)/60))} more minute${1===Math.ceil((k||600)/60)?'':'s'}.`}):null,(0,j.jsxs)(n.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,j.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve car."})]}),(0,j.jsx)(n.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,j.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{S()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:f.colours.goldLight,children:"That code has run out"}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{S()},style:{minHeight:64,minWidth:280}})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:f.colours.amber,children:"Couldn\u2019t make a code"}),(0,j.jsx)(o.Muted,{center:!0,children:T}),(0,j.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{S()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,j.jsx)(o.T,{center:!0,colour:f.colours.amber,children:T}):null,(0,j.jsx)(o.Muted,{center:!0,style:{maxWidth:640},children:"Don\u2019t open your personal app link in the car: it stays on your phone. Use this screen only when the car is in Park."})]})})}},1415,[34,41,102,426,794,847,997,985,2,5,840,1416,1417,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"RAIL_TITLE",{enumerable:!0,get:function(){return o}}),e.railSizes=function(s,l){const t=l>=1e3?13:11,n=Math.round(1.45*t),c=48+n+8,b=Math.floor((l-o-12)/12)>=c?1:2,h=12/b,p=Math.floor((l-o-12)/h),u=1===b?s>=1600?168:s>=1200?136:120:s>=1600?128:s>=1100?100:88,f=Math.max(44,Math.min(1===b?72:64,p-n-12,u-24));return{railW:u*b,colW:u,cols:b,per:p,circle:f,label:t,lineH:n,icon:Math.round(.46*f)}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return l}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'Food safety log'},{id:'compliance',label:'Daily checks'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}],o=32;const l=s=>s.split('').join(' ')},1416,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1417,[34,102,794,840,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"sharedRecipeCards",{enumerable:!0,get:function(){return l}});var c=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]);const o=()=>{const c=n.useSync.getState();return'live'===c.mode&&'guest'!==c.kind&&!!c.venueId};function t(c){if(o()&&!(0,n.can)(c))throw new Error('recipes.signoff'===c?'Only the Head Chef, an owner or a manager can sign off a recipe card.':'Only the head chef, managers and owners can change recipe cards.')}const l={mode:'shared',list:c=>r.localRecipeCards.list(c),get:c=>r.localRecipeCards.get(c),byMenuItem:c=>r.localRecipeCards.byMenuItem(c),subscribe:c=>r.localRecipeCards.subscribe(c),create:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.create(c,s,n)),update:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.update(c,s,n)),signOff:async(c,s)=>(t('recipes.signoff'),r.localRecipeCards.signOff(c,s)),remove:async(s,n)=>{t('recipes.edit');const o=await r.localRecipeCards.remove(s,n);return c.useGpCalc.getState().removeCardCost(s),o},savePhoto:async(c,s,n)=>(t('recipes.edit'),r.localRecipeCards.savePhoto(c,s,n)),photoSource:c=>r.localRecipeCards.photoSource(c)};function p(){const c=o()?l:r.localRecipeCards;(0,s.recipeCards)()!==c&&(0,s.setRecipeCardRepository)(c)}p(),n.useSync.subscribe((c,r)=>{c.mode===r.mode&&c.kind===r.kind&&c.venueId===r.venueId||p()})},1418,[986,857,856,985]); +__d(function(g,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,"STRIP",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return P}}),_e.syncTone=R,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return z}}),_e.SyncBadge=function(){const e=(0,y.useSync)(),[P,k]=(0,s.useState)(!1),[N,W]=(0,s.useState)(e.refused?.at??''),$=e.refused&&e.refused.at!==N?e.refused:void 0,[A,H]=(0,s.useState)(!1),[L,O]=(0,s.useState)(''),_=(0,p.useDisplaySettings)(f.VENUE_RID),E=(0,v.useScreensaverAsleep)(e=>e.asleep),V='off'===e.mode&&(C.PITCH||!(0,j.isSupabaseConfigured)());if('customer'===h.APP_VARIANT||'off'===e.mode&&!V)return null;if(E)return(0,I.jsx)(u.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:D,backgroundColor:x.colours.bg}});const M='live'===e.mode,Y='display'===h.APP_VARIANT,K=e.waiting??0,U=`${K} change${1===K?'':'s'} waiting to save`,B=V?C.PITCH?'Demo \xb7 this device only':'This device only':M?K?U:e.pending?`Live \xb7 sending ${e.pending}`:'Live':'offline'===e.mode?"Offline"+(e.pending?` \xb7 ${e.pending} waiting`:''):'connecting'===e.mode?'Connecting\u2026':'unpaired'===e.mode?'Not paired':'On this device',F=R(e.mode,V,K),G=S(F),Q=V?C.PITCH?'Demo mode. Nothing is shared or sent: everything you do stays in this browser.':'This copy isn\u2019t connected to a shared system. Everything stays on this device.':M?`Shared live with ${e.venueName??'your venue'}${e.lastSyncAt?`. Last update ${new Date(e.lastSyncAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:''}.`:'offline'===e.mode?'No connection. Changes are saved on this device and sent when you\u2019re back online.':'signin'===e.mode?'Not connected to the shared system. Open your personal invite link once on this device to connect.':'unpaired'===e.mode?'This display isn\u2019t paired. Use a pairing code from Managers \u2192 Displays.':'connecting'===e.mode?'Connecting to the shared system\u2026':'The shared system can\u2019t be reached, so this device is using its own data.';return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.default,{testID:"sync-strip",style:{height:D,paddingHorizontal:10,justifyContent:'center',alignItems:'flex-start',backgroundColor:x.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:(0,I.jsxs)(c.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:K&&M?`${U}, ${z(F)}. Kept on this device and tried again by itself. Tap for details.`:`${B}, ${z(F)}. Tap for details.`,accessibilityLiveRegion:"polite",onPress:()=>k(e=>!e),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:14,minHeight:44,borderRadius:999,backgroundColor:(0,t.soutersSurface)('rgba(16,14,11,0.92)'),borderWidth:1,borderColor:`${G}80`,maxWidth:320},children:[(0,I.jsx)(u.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:G}}),(0,I.jsx)(T.T,{size:12,weight:"semibold",children:B})]})}),P?(0,I.jsxs)(u.default,{testID:"sync-detail",style:{position:'absolute',left:10,bottom:52,zIndex:900,maxWidth:320,padding:12,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#15120E'),borderWidth:1,borderColor:'rgba(255,255,255,0.14)',gap:4},children:[(0,I.jsx)(T.T,{size:13,children:Q}),K?(0,I.jsxs)(u.default,{testID:"sync-waiting",style:{gap:4},children:[(0,I.jsxs)(T.T,{size:12,colour:x.colours.gold,children:[U,". ",1===K?'It is':'They are'," kept on this device and tried again by ",1===K?'itself':'themselves'," until the shared system takes ",1===K?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,I.jsx)(c.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{b.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:x.colours.gold},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,I.jsxs)(T.T,{size:12,colour:x.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,I.jsx)(T.T,{size:12,colour:x.colours.muted,children:e.message}):null,e.venueId&&(M||'offline'===e.mode)?A?(0,I.jsxs)(u.default,{style:{gap:6,marginTop:6},children:[(0,I.jsx)(T.T,{size:12,children:Y?'Unpair this display? It goes back to the pairing screen and needs a new code from Managers \u2192 Displays.':'Disconnect this device? Your changes stay on it; open your personal invite link to connect again.'}),Y&&_.pinOn?(0,I.jsx)(n.TextInput,{testID:"unpair-pin",value:L,onChangeText:O,placeholder:"Display PIN",placeholderTextColor:x.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:x.colours.text}}):null,(0,I.jsxs)(u.default,{style:{flexDirection:'row',gap:8},children:[(0,I.jsx)(c.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:Y?'Yes, unpair':'Yes, disconnect',disabled:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L),onPress:()=>{H(!1),k(!1),O(''),Y?(0,y.unpairDisplay)():(0,y.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:Y&&_.pinOn&&!(0,l.wakePinMatches)(_,L)?'rgba(255,255,255,0.08)':x.colours.red},children:(0,I.jsx)(T.T,{size:12,weight:"semibold",children:Y?'Yes, unpair':'Yes, disconnect'})}),(0,I.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>{H(!1),O('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,I.jsx)(T.T,{size:12,children:"Keep"})})]})]}):(0,I.jsx)(c.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:Y?'Unpair this display':'Disconnect this device',onPress:()=>H(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,I.jsx)(T.T,{size:12,colour:x.colours.gold,children:Y?'Unpair this display\u2026':'Disconnect this device\u2026'})}):null,(0,I.jsx)(o.WipeDevice,{compact:!0})]}):null,$?(0,I.jsx)(u.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:D+w+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,I.jsxs)(u.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:x.colours.red,maxWidth:460,gap:8},children:[(0,I.jsx)(T.T,{size:13,children:`Not saved: ${$.what}. Why: ${$.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,I.jsx)(c.default,{testID:"sync-toast-ok",accessibilityRole:"button",accessibilityLabel:"OK, dismiss this message",onPress:()=>W($.at),style:{minHeight:44,minWidth:64,justifyContent:'center',alignItems:'center',alignSelf:'flex-end',paddingHorizontal:14,borderRadius:8,backgroundColor:x.colours.red},children:(0,I.jsx)(T.T,{size:13,weight:"semibold",children:"OK"})})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=r(d[4]),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),y=r(d[8]),b=r(d[9]),p=r(d[10]),f=r(d[11]),x=r(d[12]),T=r(d[13]),v=r(d[14]),j=r(d[15]),C=r(d[16]),I=r(d[17]);const D=48,w='display'===h.APP_VARIANT?0:57,P='#3DD68C';function R(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const S=e=>'connected'===e?P:'pending'===e?x.colours.amber:x.colours.red,z=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1419,[798,796,34,1343,1015,402,102,846,985,1007,1014,5,840,794,1287,974,2,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PushPrompt=function(){const e=(0,l.useSync)(e=>e.kind),b=(0,l.useSync)(e=>e.staffRef),x=(0,l.useSync)(e=>e.venueId),[p,S]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(u.PITCH||y()||'staff'!==e||!b||!x)return;let t=!0;return(async()=>{const e=await(0,c.pushState)();if(!t)return;if('undefined'!=typeof Notification&&'granted'===Notification.permission&&('on'===e||'off'===e))return void(0,c.turnOnPush)();if('off'!==e)return;const o=Number(localStorage.getItem(h)||0);Date.now()-o>2592e5&&S(!0)})(),()=>{t=!1}},[e,b,x]),!p)return null;const w={minHeight:48,borderRadius:12,justifyContent:'center',paddingHorizontal:18};return(0,f.jsxs)(r.default,{accessibilityRole:"alert",style:{position:'absolute',left:12,right:12,bottom:72,backgroundColor:s.colours.surface2,borderColor:s.colours.gold,borderWidth:1,borderRadius:14,padding:16,zIndex:50},children:[(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:18,fontWeight:'700',marginBottom:6},children:"Get notifications on this phone"}),(0,f.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,marginBottom:12},children:j??'So you hear about rota changes, swaps and reminders even when the app is closed.'}),(0,f.jsxs)(r.default,{style:{flexDirection:'row',gap:12},children:[(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Turn on notifications",style:[w,{backgroundColor:s.colours.gold,flex:1}],onPress:async()=>{const e=await(0,c.turnOnPush)();e.ok?S(!1):v(e.message)},children:(0,f.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:17,fontWeight:'700',textAlign:'center'},children:"Turn on"})}),(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Not now",style:[w,{borderColor:s.colours.gold,borderWidth:1}],onPress:()=>{try{localStorage.setItem(h,String(Date.now()))}catch{}S(!1)},children:(0,f.jsx)(t.Text,{style:{color:s.colours.goldLight,fontSize:17,textAlign:'center'},children:"Not now"})})]})]})};var t=_r(d[0]),o=_r(d[1]);_r(d[2]);var n=e(_r(d[3])),r=e(_r(d[4])),s=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]);const h='cc-push-later-v1',y=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent)},1420,[796,34,236,402,102,840,985,1045,2,25]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceHost=function(){const e=(0,f.useVoiceTarget)(),t=(0,f.useVoiceSlot)(e=>e.rect);g.PITCH&&(globalThis.__voiceExpect={app:e?.app??null,on:!!e?.on,slot:!!t});if(!e?.on||!t)return null;const n=(0,P.jsx)(X,{app:e.actions,ui:e.app},e.actions);if('undefined'!=typeof document){const{createPortal:e}=_r(d[33]);return e(n,document.body)}return n};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),i=e(_r(d[5])),a=e(_r(d[6]));_r(d[7]);var l=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=e(_r(d[11])),p=_r(d[12]),f=_r(d[13]),g=_r(d[14]),y=_r(d[15]),m=e(y),w=_r(d[16]),x=_r(d[17]),b=_r(d[18]),v=_r(d[19]),k=_r(d[20]),j=_r(d[21]),T=_r(d[22]),R=_r(d[23]),C=_r(d[24]),S=_r(d[25]),I=_r(d[26]),M=_r(d[27]),E=_r(d[28]),H=_r(d[29]),z=_r(d[30]),D=_r(d[31]),P=_r(d[32]);const A='How many people?',$=['covers','partySize'],W=200,_=16e3,B=31e3,O='That took too long, so I stopped waiting. Hold the button and try again, or tap Type instead.',V='Something went wrong there. Hold the button and try again, or tap Type instead.',F='The microphone is blocked. Allow it in the browser\u2019s site settings, or tap the button to type instead.';function L(e,t){return'cap'===e?t?.message||E.REACHED_TEXT:'identity'===e||'app'===e?'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.':'not-allowed'===e?F:'audio-capture'===e?'I couldn\u2019t use the microphone on this device. Check nothing else is using it, then hold the button again, or tap Type instead.':'busy'===e?'Speech to text is busy just now. Hold the button and try again in a moment, or tap Type instead.':'soon'===e?'Speech to text is switching on soon. For now, tap the button to type instead.':'long'===e?'That was longer than 30 seconds. Hold the button and say it more briefly, or tap Type instead.':'I couldn\u2019t turn that into text just now. Hold the button and try again, or tap Type instead.'}function N({colour:e,size:t=34}){return(0,P.jsxs)(m.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,P.jsx)(y.Rect,{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:e}),(0,P.jsx)(y.Path,{d:"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7",stroke:e,strokeWidth:2,strokeLinecap:"round",fill:"none"})]})}const G={owner:['\u201cWalk-in fridge 3 degrees\u201d','\u201cMark the lobster sold out\u201d','\u201cHow many Covers tonight?\u201d','\u201cAdd blue roll to the Booker list\u201d'],staff:['\u201cMessage the team: running 10 minutes late\u201d','\u201cRead my messages\u201d','\u201cWhen\u2019s my next shift?\u201d','\u201cWhat are today\u2019s specials?\u201d','\u201cDoes the fish supper contain gluten?\u201d'],chef:['\u201cFreezer minus 19\u201d','\u201cMark the soup sold out\u201d','\u201cRead the orders\u201d','\u201cAdd onions to the Bidfood list\u201d'],display:['\u201cWalk-in fridge 3 degrees\u201d','\u201cRead the orders\u201d','\u201cAny room for 6 at 8?\u201d','\u201cRead the shift notes\u201d']};function X({app:e,ui:g}){const y=(0,w.useCtx)(6e4),m=(0,b.useOwner)(e=>e.staff),X=(0,I.useVoiceNav)(e=>e.go),{height:U}=(0,u.default)(),q=(0,f.useVoiceSlot)(e=>e.rect),K=q.size,Y=x.ROSTER.find(e=>'chef'===e.app),J='display'===e?'Main Display':'chef'===e?m.find(e=>e.id===Y?.id)?.name??'Head Chef':y.me,Q='display'===e?'display':'chef'===e?Y?.id??'chef':y.meId,Z={rid:y.rid,today:y.today,go:(e,t)=>X?.(e,t),app:e,who:J.replace(' (example)',''),whoId:Q,role:'owner'===g?y.role:e};(0,o.useEffect)(()=>{try{(0,T.setVenueWords)((0,R.venueKeyterms)(y.rid))}catch{}},[y.rid,m]);const[ee,te]=(0,o.useState)('idle'),[ne,oe]=(0,o.useState)(''),[re,se]=(0,o.useState)(0),[ie,ae]=(0,o.useState)(null),[le,de]=(0,o.useState)(!1),[ce,ue]=(0,o.useState)(''),[he,pe]=(0,o.useState)(!1),fe=(0,o.useRef)(null),ge=(0,o.useRef)(0),ye=(0,o.useRef)(null),me=(0,o.useRef)(Z);me.current=Z;const we=(0,o.useRef)(ie);we.current=ie;const xe=(0,o.useRef)(y.now);xe.current=y.now;const be=e=>{ae(e),te('answer')},ve=be,ke=async e=>{const t=++ge.current;let n;te('working');try{n=await(0,j.runAction)(e.id,e.params,me.current,!0)}catch{n={status:'error',message:V}}t===ge.current&&((0,H.buzz)([20,40,20]),ve({text:'needs_confirmation'===n.status?n.preview:n.message,tone:'error'===n.status?'warn':'ok'}))},je=()=>ve({text:'Cancelled. Nothing was changed.',tone:'info'}),Te=async(e,t,n)=>{const o=++ge.current,r={...e.params,[e.field]:t};let s;te('working');try{s=await(0,j.runAction)(e.id,r,me.current,!1)}catch{s={status:'error',message:V}}o===ge.current&&('needs_confirmation'===s.status?ve({heard:n,text:s.preview,pending:{id:e.id,params:r,preview:s.preview}}):ve({heard:n,text:s.message,tone:'error'===s.status?'warn':'ok'}))},Re=async(e,t)=>{const n=ge.current,o=e=>{n===ge.current&&be(e)};try{await Ce(e,o,t)}catch{o({heard:e.trim()||void 0,text:V,tone:'warn'})}},Ce=async(t,n,o)=>{const r=t.trim(),s=me.current;if(!r)return void n({text:'I didn\u2019t catch that. Hold the button while you speak, then let go.',tone:'info'});const i=we.current?.pending;if(i){const e=(0,H.yesNo)(r);if('yes'===e)return void await ke(i);if('no'===e)return void je()}const a=we.current?.ask;if(a){const e=(0,D.coversAnswer)(r);if(e&&e<=30)return void await Te(a,e,r)}te('working');const l=(0,j.matchIntent)(r,s.today,{app:e,rid:s.rid,whoId:s.whoId}),c=xe.current;if(!E.voiceUsage.allowed(s.rid,'action'===l.kind?l.action.id:null,c))return void n({heard:r,text:E.REACHED_TEXT,tone:'info'});E.voiceUsage.record(s.rid,c);const u=E.voiceUsage.get(s.rid,c),h=u.reached?E.REACHED_TEXT:u.warn?(0,E.WARN_TEXT)(u):void 0,p=e=>n({...e,note:h});if('action'===l.kind){const e=l.action,t=e.params.filter(e=>e.required&&(void 0===l.params[e.name]||''===l.params[e.name]||'[]'===l.params[e.name]));if(1===t.length&&$.includes(t[0].name))return void p({heard:r,text:A,ask:{id:e.id,params:l.params,field:t[0].name},tone:'info'});if(t.length)return void p({heard:r,text:e.preview(l.params,s)+(/\?$/.test(e.preview(l.params,s))||/couldn|didn/.test(e.preview(l.params,s))?'':` I still need: ${t.map(e=>e.description.toLowerCase()).join('; ')}.`)+' Hold the button and try again.',tone:'warn'});const n=await(0,j.runAction)(e.id,l.params,s,!1);return void('needs_confirmation'===n.status?p({heard:r,text:n.preview,pending:{id:e.id,params:l.params,preview:n.preview}}):p({heard:r,text:n.message,tone:'error'===n.status?'warn':'ok'}))}const f=` ${r.toLowerCase()} `,g=e=>{const t=(0,j.actionById)(e);if(!t)return 0;try{return t.match?t.match(f):t.keywords.filter(e=>f.includes(e)).length}catch{return 0}},y=()=>(0,j.toolSpecs)().filter(t=>{const n=(0,j.actionById)(t.function.name);return!!n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))}).map((e,t)=>({t:e,i:t,s:g(e.function.name)})).sort((e,t)=>t.s-e.s||e.i-t.i).slice(0,60).map(e=>e.t),m=async t=>{if('call'===t.kind){const n=(0,j.actionById)(t.name);if(n&&(!n.apps||n.apps.includes(e))&&('staff'!==e||(0,j.staffMay)(n))){const e=n.params.filter(e=>e.required&&(void 0===t.args[e.name]||''===t.args[e.name]));if(1===e.length&&$.includes(e[0].name))return p({heard:r,text:A,ask:{id:n.id,params:t.args,field:e[0].name},tone:'info'}),!0;const o=await(0,j.runAction)(n.id,t.args,s,!1);return'needs_confirmation'===o.status?p({heard:r,text:o.preview,pending:{id:n.id,params:t.args,preview:o.preview}}):p({heard:r,text:o.message,tone:'error'===o.status?'warn':'ok'}),!0}}return'text'===t.kind&&(p({heard:r,text:(0,j.moneySafe)(e,s.role)?(0,j.noMoney)(t.text):t.text,tone:'info'}),!0)};if('help'===l.kind){const t=l.ids.map(C.helpById).filter(Boolean)[0];if(!(((0,S.searchHelp)(C.HELP,r,1)[0]?.score??0)>=2.5)){const n=await(0,T.askServer)(e,r,y(),o);if(await m(n))return;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(`${t.title}. ${t.body}`)?void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}.`,tone:'info'}):void p({heard:r,text:`${T.SOON_TEXT} ${G[e].slice(0,2).join(' or ')}. This guide might help: ${t.title}.`,help:l.ids,tone:'info'})}const n=`${t.title}. ${t.body}`;return(0,j.moneySafe)(e,s.role)&&(0,j.hasMoney)(n)?void p({heard:r,text:'That isn\u2019t shown here. Ask a manager in the Managers app.',tone:'info'}):void p({heard:r,text:n,help:l.ids,tone:'info'})}await m(await(0,T.askServer)(e,r,y(),o))||p({heard:r,text:T.SOON_TEXT+' '+G[e].slice(0,2).join(' or ')+'.',tone:'info'})},Se=()=>{fe.current?.abort(),fe.current=null,ye.current?.(),ye.current=null,se(0)};(0,o.useEffect)(()=>()=>{fe.current?.abort(),ye.current?.()},[]);const Ie=async()=>{if(!(0,H.canListen)())return de(!0),void ve({text:(0,H.tabletWithoutMic)()?'This Display tablet app needs an update before it can use the microphone. For now, type below.':'This browser can\u2019t record speech. Type instead below.',tone:'info'});if((0,H.desktopStt)()){if(!(0,M.micExplainedFor)(g))return void pe(!0)}else{const e=await(0,H.micPermission)();if('granted'===e)(0,M.setMicExplainedFor)(g);else{if('denied'===e)return de(!0),void ve({text:F,tone:'warn'});if(!(0,M.micExplainedFor)(g))return void pe(!0)}}if(!He.current.holding&&!Ee.current)return;const t=++ge.current;(0,H.buzz)(35),oe(''),ae(null),de(!1),te('listening');if(fe.current=(0,H.listen)(oe,(e,n,o)=>{if(ye.current?.(),ye.current=null,se(0),fe.current=null,t===ge.current){if('not-allowed'!==n&&'service-not-allowed'!==n)return'stt-failed'===n?(ve({text:'Speech to text didn\u2019t start on this Mac. Type instead below; restarting the app usually fixes it.',tone:'warn'}),void de(!0)):void(n?ve({text:L(n,o),tone:'cap'===n?'info':'warn'}):Re(e,o?.receipt));ve({text:(0,H.desktopStt)()?'The microphone is blocked for CoverCharge. Open System Settings \u203a Privacy & Security \u203a Microphone, switch on CoverCharge for Mac, then try again. Or type instead.':F,tone:'warn'})}},e,se),!fe.current)return te('idle'),void de(!0);if((0,H.desktopStt)()){const e=await(0,H.levelMeter)(se);fe.current?ye.current=e:e()}},Me=()=>{fe.current&&(te('working'),fe.current.stop(),ye.current?.(),ye.current=null,se(0))},Ee=(0,o.useRef)(!1),He=(0,o.useRef)({timer:0,holding:!1}),ze=(0,o.useRef)(Ie);ze.current=Ie;const De=(0,o.useRef)(Me);De.current=Me;const Pe=(0,o.useMemo)(()=>a.default.create({onStartShouldSetPanResponder:()=>!0,onMoveShouldSetPanResponder:()=>!0,onPanResponderTerminationRequest:()=>!1,onPanResponderGrant:()=>{const e=He.current;e.holding=!1,(0,M.micExplainedFor)(g)&&(0,H.warmMic)(),e.timer=setTimeout(()=>{e.holding=!0,ze.current()},W)},onPanResponderRelease:()=>{const e=He.current;if(clearTimeout(e.timer),e.holding)return e.holding=!1,void De.current();(0,H.disarmMic)(),de(!0),te(e=>'idle'===e?'answer':e)},onPanResponderTerminate:()=>{const e=He.current;clearTimeout(e.timer),e.holding&&(e.holding=!1,De.current())}}),[e]);(0,o.useRef)(ee).current=ee,(0,o.useEffect)(()=>z.useVoiceKeys.subscribe((e,t)=>{const n=e.last;if(!n||n.n===t.last?.n)return;const o=!!fe.current;'start'!==n.cmd||o?'stop'===n.cmd?(Ee.current=!1,o&&De.current()):'toggle'===n.cmd?o?(Ee.current=!1,De.current()):(Ee.current=!0,ze.current()):'type'===n.cmd&&(de(!0),te(e=>'idle'===e?'answer':e)):(Ee.current=!0,ze.current())}),[]);const Ae=K>=64,$e=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{if('listening'!==ee)return $e.stopAnimation(),void $e.setValue(0);const e=s.default.loop(s.default.timing($e,{toValue:1,duration:1100,easing:i.default.out(i.default.quad),useNativeDriver:!1}));return e.start(),()=>e.stop()},[ee]);const We='listening'===ee,Be='answer'===ee&&(ie||le)||'working'===ee||We,Oe=()=>{ge.current++,Se(),ae(null),de(!1),ue(''),te('idle')};(0,o.useEffect)(()=>{if('working'!==ee&&'listening'!==ee)return;const e=ge.current,t=setTimeout(()=>{e===ge.current&&('listening'!==ee?(ge.current++,Se(),de(!0),be({heard:ne&&!/\u2026$/.test(ne)?ne:void 0,text:O,tone:'warn'})):De.current())},'working'===ee?_:B);return()=>clearTimeout(t)},[ee]);const Ve=()=>{const e=ce.trim();e&&(ue(''),oe(e),ge.current++,Re(e))},Fe='fixed',Le={top:q.y+K+8},Ne=$e.interpolate({inputRange:[0,1],outputRange:[1,1.7]}),Ge=$e.interpolate({inputRange:[0,1],outputRange:[.6,0]}),Xe='warn'===ie?.tone?k.colours.amber:ie?.pending?k.colours.gold:k.colours.border;return(0,P.jsxs)(P.Fragment,{children:[Be?(0,P.jsx)(h.default,{testID:"voice-panel",style:[{position:Fe,left:12,right:12,alignItems:'flex-end',zIndex:60},Le],pointerEvents:"box-none",children:(0,P.jsxs)(h.default,{style:{width:'100%',maxWidth:Ae?720:520,backgroundColor:k.colours.surface,borderRadius:16,borderWidth:2,borderColor:Xe,padding:Ae?20:14,gap:10,maxHeight:U*(Ae?.78:.6)},children:[(0,P.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.gold,accessibilityRole:"header",children:We?Ae?'Listening\u2026 let go (or press \u2318\u21e7G) to send':'Listening\u2026 let go to send':'working'===ee?'Working on it\u2026':ie?.pending?'Please confirm':'Voice assistant'}),(0,P.jsx)(l.default,{testID:"voice-close",accessibilityRole:"button",accessibilityLabel:"Close voice assistant",hitSlop:12,onPress:Oe,style:{minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:20,colour:k.colours.muted,children:"\u2715"})})]}),(0,P.jsx)(v.T,{testID:"voice-reply-mode",size:14,colour:k.colours.muted,children:"Text replies only"}),We?(0,P.jsxs)(h.default,{style:{gap:8},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(h.default,{testID:"voice-level",style:{width:`${Math.round(8+92*re)}%`,height:10,backgroundColor:k.colours.ok}})}),(0,P.jsx)(v.T,{size:16,children:ne||'Say it now\u2026'})]}):null,'working'===ee?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(r.default,{color:k.colours.gold}),(0,P.jsx)(v.T,{size:15,colour:k.colours.muted,children:ne?/\u2026$/.test(ne)?ne:`\u201c${ne}\u201d`:''})]}):null,'working'===ee||We?(0,P.jsx)(v.Button,{testID:"voice-stop",kind:"secondary",label:"Cancel",onPress:()=>{ge.current++,Se(),de(!1),be({text:'Stopped. Nothing was changed.',tone:'info'})},style:{minHeight:48}}):null,'answer'===ee&&ie?(0,P.jsxs)(c.default,{style:{maxHeight:U*(Ae?.55:.36)},contentContainerStyle:{gap:8},children:[ie.heard?(0,P.jsx)(h.default,{testID:"voice-heard",accessible:!0,accessibilityLabel:`I heard: ${ie.heard}`,children:(0,P.jsxs)(v.T,{size:Ae?16:14,colour:k.colours.muted,children:["I heard: \u201c",ie.heard,"\u201d"]})}):null,ie.note?(0,P.jsx)(h.default,{testID:"voice-usage-note",children:(0,P.jsx)(v.T,{size:13,colour:k.colours.amber,children:ie.note})}):null,(0,P.jsx)(h.default,{testID:"voice-answer",children:(0,P.jsx)(v.T,{size:Ae?24:18,weight:ie.pending?'semibold':'regular',children:ie.text})}),ie.help&&'owner'===e&&X?ie.help.slice(0,3).map(e=>{const t=(0,C.helpById)(e);return t?(0,P.jsx)(v.Button,{small:!0,kind:"secondary",label:`Open help: ${t.title}`,onPress:()=>{X('more','help'),Oe()}},e):null}):null]}):null,'answer'===ee&&ie?.ask?(0,P.jsx)(h.default,{testID:"voice-how-many",style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:[1,2,3,4,5,6,7,8].map(e=>(0,P.jsx)(l.default,{testID:`voice-covers-${e}`,accessibilityRole:"button",accessibilityLabel:1===e?'1 person':`${e} people`,onPress:()=>{Te(ie.ask,e)},style:{width:Ae?96:72,height:Ae?96:72,borderRadius:14,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(v.T,{size:Ae?40:32,weight:"semibold",colour:k.colours.onGold,children:e})},e))}):null,'answer'===ee&&ie?.pending?(0,P.jsxs)(v.Row,{gap:10,children:[(0,P.jsx)(v.Button,{testID:"voice-confirm",kind:"success",label:"Confirm",onPress:()=>{ke(ie.pending)},style:{flex:1,minHeight:56}}),(0,P.jsx)(v.Button,{testID:"voice-cancel",kind:"secondary",label:"Cancel",onPress:je,style:{flex:1,minHeight:56}})]}):null,'answer'!==ee||ie?.pending?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[le||!(0,H.canListen)()?(0,P.jsxs)(v.Row,{gap:8,children:[(0,P.jsx)(n.TextInput,{testID:"voice-type",value:ce,onChangeText:ue,onSubmitEditing:Ve,placeholder:"Type instead\u2026",placeholderTextColor:k.colours.muted,autoFocus:!0,returnKeyType:"send",style:{flex:1,minWidth:0,width:0,minHeight:48,borderRadius:10,borderWidth:1,borderColor:k.colours.border,backgroundColor:k.colours.surface2,color:k.colours.text,paddingHorizontal:12,fontFamily:k.fonts.regular,fontSize:16}}),(0,P.jsx)(v.Button,{testID:"voice-send",kind:"success",label:"Ask",onPress:Ve,disabled:!ce.trim()})]}):(0,P.jsx)(l.default,{accessibilityRole:"button",onPress:()=>de(!0),children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"Type instead"})}),ie?null:(0,P.jsxs)(v.T,{size:Ae?15:13,colour:k.colours.muted,children:[Ae?'Hold Space (or the gold button) and speak, or press \u2318\u21e7G to start and again to send. ':'Hold the gold button and speak, for example ',Ae?`For example ${G[e].join(', ')}.`:`${G[e].join(', ')}.`]}),'owner'===g&&'owner'===e?(0,P.jsx)(l.default,{testID:"voice-open-assistant",accessibilityRole:"button",onPress:()=>{Oe(),p.useAssistantUi.getState().setOpen(!0)},style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(v.T,{size:14,colour:k.colours.gold,children:"\u2726 Open the Assistant (ideas, history and longer requests) \u203a"})}):null]})]})}):null,(0,P.jsxs)(h.default,{style:{position:Fe,left:`clamp(0px, ${q.x}px, calc(100vw - ${K}px))`,top:q.y,width:K,height:K,zIndex:61},pointerEvents:"box-none",children:[We?(0,P.jsx)(s.default.View,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,width:K,height:K,borderRadius:K/2,borderWidth:4,borderColor:k.colours.ok,opacity:Ge,transform:[{scale:Ne}]}}):null,We?(0,P.jsx)(h.default,{pointerEvents:"none",style:{position:'absolute',left:-6,top:-6,width:K+12,height:K+12,borderRadius:(K+12)/2,borderWidth:3+Math.round(7*re),borderColor:k.colours.ok}}):null,(0,P.jsx)(h.default,{testID:"voice-button",accessible:!0,accessibilityRole:"button",accessibilityLabel:'owner'===g&&'owner'===e?'Voice assistant and Assistant. Hold to talk, let go to send. Tap to type or open the Assistant.':'Voice assistant. Hold to talk, let go to send. Tap to type instead.',...Pe.panHandlers,style:[{width:K,height:K,borderRadius:K/2,alignItems:'center',justifyContent:'center',backgroundColor:We?k.colours.ok:k.colours.gold,borderWidth:2,borderColor:k.colours.bg},{userSelect:'none',WebkitUserSelect:'none',WebkitTouchCallout:'none',touchAction:'none',cursor:'pointer'}],children:['kirkton','abbotsford'].includes(t.VENUE_RID)?(0,P.jsx)(v.T,{size:16,weight:"semibold",colour:k.colours.onGold,children:'working'===ee?'Wait':'Talk'}):'working'===ee?(0,P.jsx)(r.default,{color:k.colours.onGold,size:"large"}):(0,P.jsx)(N,{colour:k.colours.onGold,size:Math.round(.5*K)})})]}),(0,P.jsx)(v.Sheet,{visible:he,onClose:()=>{(0,M.setMicExplainedFor)(g),pe(!1)},title:"Talk to CoverCharge",testID:"voice-explain",children:(0,P.jsxs)(h.default,{style:{gap:10},children:[(0,P.jsxs)(v.T,{children:["Hold the gold button, say what you need, then let go. For example ",G[e].slice(0,3).join(', '),"."]}),(0,P.jsx)(v.T,{children:(0,H.desktopStt)()?'Your Mac will now ask once to let CoverCharge use the microphone. It only listens while you hold the button.':'Your device will now ask once to use the microphone. It only listens while you hold the button, for up to 30 seconds.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:(0,H.desktopStt)()?'On this Mac, speech is turned into text on the Mac itself, so what you say isn\u2019t sent anywhere. CoverCharge doesn\u2019t keep the audio.':'What you say while holding is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio.'}),(0,P.jsx)(v.T,{size:14,colour:k.colours.muted,children:"The helper replies in text only, never aloud. Any change is shown in text first, with Confirm and Cancel buttons; you can also say \u201cyes\u201d. Orders to suppliers, messages and payments are only ever saved as drafts for the owner."}),(0,P.jsx)(v.Button,{testID:"voice-allow",kind:"success",label:"Allow microphone",onPress:async()=>{(0,M.setMicExplainedFor)(g),pe(!1);const e=!!(0,H.desktopStt)()||await(0,H.askMic)();if((0,H.desktopStt)()){(await(0,H.levelMeter)(()=>{}))()}ve(e?{text:'Ready. Now hold the button and speak.',tone:'ok'}:{text:F,tone:'warn'})}}),(0,P.jsx)(v.Button,{kind:"secondary",label:"Type instead",onPress:()=>{(0,M.setMicExplainedFor)(g),pe(!1),de(!0),te('answer')}})]})})]})}},1421,[5,796,34,385,283,364,380,236,402,295,426,102,1422,1116,2,900,1100,15,865,794,840,1423,930,1437,1433,1434,1438,1117,1439,929,1440,1436,25,277]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"useAssistantUi",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AssistantFab",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AssistantSheet",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"AssistantPage",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AssistantSettings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"AssistantPlanCard",{enumerable:!0,get:function(){return c}});const t=!1,n={getState:()=>({open:!1,setOpen:t=>{}})},u=()=>null,s=()=>null,l=()=>null,o=()=>null,c=()=>null},1422,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${$[t.risk]}${O(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if(O(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(u.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const u=(0,l.searchHelp)(p.HELP,e,3);return u.length?{kind:'help',ids:u.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,$={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},O=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);if(!(e.staffId&&e.date&&a>t))return'That shift isn\u2019t complete.';const s=(0,n.leaveOn)(n.useOwner.getState().leave,String(e.staffId),String(e.date));return s?`${_(e.staffId)} has time off then (${N(s.from)} to ${N(s.to)}). Add the shift on the Rota yourself if they\u2019ve agreed to work.`:(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`)}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...c.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1423,[1424,1098,829,1427,1428,865,848,1014,1432,1433,1434,1430,1429,1435,1436,1012,1013]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_VOICE_ACTIONS",{enumerable:!0,get:function(){return t}});var o=r(d[0]);const t=[{id:'look_back_bookings',title:'Look back at bookings',apps:['owner'],risk:'look',description:'Read booking times, party sizes, recorded tables and Booked covers for one exact past date. Incomplete supplementary previous booking system history; text only.',params:[{name:'date',type:'date',required:!0,description:'Exact past date YYYY-MM-DD, with explicitly supplied four-digit year'}],keywords:['look back','booked covers','historical bookings'],match:o=>/\b(open|go to)\s+(?:the\s+)?look back\b/.test(o)&&!/\b\d{4}\b/.test(o)?0:/\b(look back|booked covers|historical bookings)\b/.test(o)||/\b(bookings|reservations|covers)\b/.test(o)&&/\b\d{4}\b/.test(o)&&!/\b(add|create|new|book a|reserve|move|change|cancel)\b/.test(o)?10:0,parse:(t,s)=>({date:(0,o.exactHistoryDate)(t,s.today)}),preview:o=>`Look up Booked covers and bookings for ${o.date??'an exact past date'}`,run:async(t,s)=>{const n=(0,o.exactHistoryDate)(String(t.date??''),s.today);if(!n)return'Give an exact past date with day, month and four-digit year, for example 5 November 2025.';const{lookupBookingDay:c}=await r(d[2])(d[1],d.paths);return(0,o.bookingDayText)(await c(s.rid,n))}}]},1424,[1425,1426,1038]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s} ${n} ${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1425,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1426,[34,846,1425,827,985,931]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return L}}),e.resolveTable=q,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return x}}),e.findBooking=A,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return ye}});var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]);const f=t=>{const[n,r,a]=t.split('-').map(Number);return new Date(n,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},y=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},k=(t,n)=>n.test(t),w=t=>t.who??('display'===t.app?'Main Display':'Assistant'),v={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,twenty:20,half:.5},S=t=>null==t||''===t?void 0:'number'==typeof t?t:v[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),$=['owner','staff','display'],C=['owner','staff','chef','display'],I=['staff'],N=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,L=t=>{const n=t.match(N);return n?String(S(n[1])??n[1]).toUpperCase():void 0};function q(t,n){const r=String(n??'').replace(/^tables?\s+/i,'').trim();if(!r)return;const a=String(S(r)??r).toLowerCase(),o=(0,s.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(s.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===a)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===a)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===a.replace(/[^0-9a-z]/g,''))}const O=(t,n)=>s.useFloor.getState().live[t]?.[n]??{},_=new Set(['the','and','for','table','booking','party','seat','seated','cancel','move','mark','finished','show','arrived','here','has','have','they','them','who','with','from','tonight','today','please','change','confirm','decline','request','people','covers','guests','their','into','onto','done','left','gone']),D=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!_.has(t)),x=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let r=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&r<12&&(r+=12),!n[3]&&r>=1&&r<=11&&(r+=12),`${String(r).padStart(2,'0')}:${n[2]??'00'}`};function A(t,n,r,a,o){const d=String(r??'').toLowerCase(),l=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status)&&!/walk-?in/i.test(r.name??'')),c=i.useStore.getState().bookings.filter(r=>r.restaurantId===t&&r.date===n&&a.includes(r.status));if(!d&&!o)return;const u=c.find(t=>t.ref&&d.includes(t.ref.toLowerCase()));if(u)return u;const b=D(d),p=l.filter(t=>D(t.name).some(t=>b.includes(t)));if(1===p.length)return p[0];if(o){const t=c.filter(t=>(0,s.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=p.length?t.filter(t=>p.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const h=/\d/.test(d.replace(N,''))?x(d.replace(N,'')):null;if(h){const t=(p.length?p:l).filter(t=>t.time===h);if(1===t.length)return t[0]}return p.length?p.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const j=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,M=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],T=t=>({booking:t,table:L(t)}),P='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function z(t,n,r,a,i,s,d,l=""){return{id:t,apps:$,title:n,risk:'change',params:M,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${l}`,match:t=>k(t,i)?7:0,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return r?`${s}: ${j(r)}?${l}`:P},run:async(t,n)=>{const i=A(n.rid,n.today,t.booking,a,q(n.rid,t.table)??(t.table?String(t.table):void 0));return i?(await o.repo.bookings.setStatus(i.id,r),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===r?'marked as a no-show':'cancelled'===r?'cancelled':'finished'===r?'finished':r}.`):"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const F=(t,n)=>(0,s.tablesOf)(n).forEach(n=>s.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),B={id:'seat_booking',apps:$,title:'Seat a booking',risk:'change',params:M,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!k(t,/\b(seat|sit)\b/)||k(t,/\b(walk.?in|walkin|no booking)\b/)||k(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?k(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:T,preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']),o=q(n.rid,t.table)??r?.table;if(!r)return P;const i=o?O(n.rid,(0,s.tablesOf)(o)[0]):{};return`Seat ${r.name}, ${r.partySize} at ${r.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,a.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,a.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,a.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const a=q(n.rid,t.table);return t.table&&!a?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(a&&a!==r.table&&await o.repo.bookings.update(r.id,{table:a}),await o.repo.bookings.setStatus(r.id,'seated'),F(n.rid,a??r.table),`Done: ${r.name} seated${a??r.table?` at table ${a??r.table}`:''}.`)}},E=z('finish_booking','Finish a table (party left)','finished',['seated'],/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/,'Mark finished',(t,n)=>{(0,s.tablesOf)(t.table).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0}))},' The table is then marked as needing clearing.'),R=z('no_show','Mark a no-show','noshow',['confirmed','pending'],/\b(no.?show|didn'?t (turn up|show|come)|not (turned|turning) up)\b/,'Mark as a no-show'),H=z('cancel_booking','Cancel a booking','cancelled',['confirmed','pending'],/^(?!.*\b(shifts?|orders?|rota)\b).*(\bcancel+(ed)?\b.*\b(booking|reservation|table for|party)\b|\bcancel\s+(?!that\b|it\b|this\b|now\b|please\b)[a-z]{3,})/,'Cancel the booking',void 0,' The guest is not messaged from here.'),W={id:'move_booking',apps:$,title:'Move a booking to another table',risk:'change',params:[M[0],{name:'table',type:'string',required:!0,description:'New table'}],keywords:[],description:'Give a booking today a different table (seated parties move too).',match:t=>k(t,/\b(move|put|switch|change)\b/)&&k(t,/\btables?\b/)&&!k(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(N.source,'gi'))],r=n[n.length-1];return{booking:t,table:r?String(S(r[1])??r[1]).toUpperCase():void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),o=q(n.rid,t.table);return r?o?`Move ${j(r)} to table ${o}?${O(n.rid,o).stage||O(n.rid,o).blocked?` ${(0,a.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:P},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending','seated']),a=q(n.rid,t.table);if(!r)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!a)return'Nothing changed: I couldn\u2019t find that table on the plan.';const i=r.table;return await o.repo.bookings.update(r.id,{table:a,tableSetHere:!0}),'seated'===r.status&&((0,s.tablesOf)(i).forEach(t=>s.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),F(n.rid,a)),`Done: ${r.name} moved to table ${a}.`}},G={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[M[0],{name:'time',type:'time',description:'New time HH:mm'},{name:'covers',type:'integer',description:'New party size'}],keywords:[],description:'Change the time or the number of people on a booking today. The guest is not messaged from here.',match:t=>k(t,/\b(change|make it|now|instead|update|actually)\b/)&&k(t,/\b(booking|reservation|party)\b/)&&k(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),r=n.match(/\b(?:to|for|now|of)\s+(\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s*(?:people|covers|guests|pax)?\b(?!\s*[:.]\d)(?!\s*(?:am|pm|o'?clock))/),a=n.match(/\b(?:to|at)\s+(\d{1,2}(?::\d{2})?\s*(?:am|pm)|\d{1,2}:\d{2}|\d{1,2}\s*o'?clock)/);return{booking:t,covers:r&&/people|covers|guests|pax|party|for/.test(n)&&!a?.[1]?.startsWith(r[1])?S(r[1]):void 0,time:a?x(a[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['confirmed','pending']);return r?t.time||t.covers?`Change ${j(r)} to ${[t.covers?`${t.covers} people`:'',t.time?`${t.time}`:''].filter(Boolean).join(' at ')}? The guest is not messaged from here.`:`What should change on ${r.name}\u2019s booking? Say the new time or number of people.`:P},run:async(t,r)=>{const a=A(r.rid,r.today,t.booking,['confirmed','pending']);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";const i=S(t.covers);if(!(null==t.covers||i&&(0,n.validParty)(i)))return`Nothing changed: ${n.PARTY_RULE}`;const s=t.time?x(String(t.time)):null;return i||s?(await o.repo.bookings.update(a.id,{...i?{partySize:i}:{},...s?{time:s}:{}}),`Done: ${a.name} is now ${i??a.partySize} at ${s??a.time}.`):'Nothing changed.'}},U={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[M[0],{name:'outcome',type:'string',required:!0,description:'confirmed or declined',enum:['confirmed','declined']}],keywords:[],description:'Accept or decline a booking request that is waiting (the same as the Accept / Decline buttons).',match:t=>k(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&k(t,/\b(booking|request|reservation)\b/)?7:0,parse:t=>({booking:t,outcome:/\b(decline|reject|turn down)\b/i.test(t)?'declined':'confirmed'}),preview:(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${r.name}, ${r.partySize} on ${f(r.date)} at ${r.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const r=A(n.rid,n.today,t.booking,['pending'])??i.useStore.getState().bookings.find(r=>r.restaurantId===n.rid&&'pending'===r.status&&D(r.name).some(n=>D(String(t.booking)).includes(n)));return r?(await o.repo.bookings.decide(r.id,'declined'===t.outcome?'declined':'confirmed',w(n)),`Done: ${r.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},V=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Y={id:'table_cleared',apps:$,title:'Mark a table cleared',risk:'change',params:V,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} cleared and free?${O(n.rid,r).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!1,stage:void 0}),`Done: table ${r} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},J={id:'table_needs_clearing',apps:$,title:'Mark a table as needing clearing',risk:'change',params:V,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>k(t,/\btables?\b/)&&k(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:L(t)}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Mark table ${r} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{dirty:!0,stage:void 0}),`Done: table ${r} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},K={id:'block_table',apps:$,title:'Block or unblock a table',risk:'change',params:[...V,{name:'blocked',type:'string',required:!0,description:'yes to block, no to unblock',enum:['yes','no']}],keywords:[],description:'Block a table (not used tonight) or unblock it.',match:t=>k(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&k(t,/\btables?\b/)&&!k(t,/\barea\b/)?8:0,parse:t=>({table:L(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const r=q(n.rid,t.table);return r?`${'no'===t.blocked?'Unblock':'Block'} table ${r}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table);return r?(s.useFloor.getState().setLive(n.rid,r,{blocked:'no'!==t.blocked}),`Done: table ${r} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},Q={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},X={id:'table_stage',apps:$,title:'Set a table\u2019s course',risk:'change',params:[...V,{name:'stage',type:'string',required:!0,description:'seated, mains, dessert or bill',enum:['seated','mains','dessert','bill']}],keywords:[],description:'Set where a seated table is: seated (starters), mains, dessert or bill.',match:t=>k(t,/\btables?\b/)&&k(t,/\b(on|at|having|wants?|asked for|ready for|onto)\b.*\b(mains?|desserts?|pudding|bill|check)\b/)?8:0,parse:t=>{const n=t.toLowerCase().match(/\b(mains?|desserts?|pudding|bill|check|starters)\b/);return{table:L(t),stage:n?Q[n[1]]:void 0}},preview:(t,n)=>{const r=q(n.rid,t.table);return r?`Set table ${r} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const r=q(n.rid,t.table),a=Q[String(t.stage??'').toLowerCase()];return r&&a?(s.useFloor.getState().setLive(n.rid,r,{stage:a,dirty:!1}),`Done: table ${r} is on ${a}.`):'Nothing changed: say the table and mains, dessert or bill.'}},Z=t=>/\b(how many|how much|what'?s|what is|what are|any|have we got|do we have|are there|is there)\b|\?\s*$/.test(t),ee=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(d.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,l.isRoastItem)(t))),te=t=>(d.useShellStore.getState().items[t]??[]).filter(t=>t.active),ne=(t,n)=>{const r=String(n??'').toLowerCase();return te(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(r)))},re={id:'shellfish_count',apps:C,title:'Shellfish count: sold, delivery or recount',risk:'change',params:[{name:'item',type:'string',required:!0,description:'Item, e.g. lobster'},{name:'qty',type:'string',required:!0,description:'How many (\xbd allowed for half items)'},{name:'mode',type:'string',required:!0,description:'sold, delivery or count',enum:['sold','delivery','count']}],keywords:[],description:'Record shellfish (or other counted stock) sold, a delivery in, or a recount (sets the count).',match:t=>!k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!ee(t)||k(t,/\b(allerg|contain|chat|message|tell|text|post)/)||Z(t)||!k(t,/\b(\d+|\xbd|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|sold|deliver(ed|y)?|came in|arrived|got in|count(ed)?|recount)\b/)?0:7,parse:(n,r)=>{const a=n.toLowerCase(),o=a.match(/\b(\d+(?:\.5)?|\xbd|a half|half|an?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty)\b/),i=/\b(deliver(ed|y)?|came in|arrived|got in|received)\b/.test(a)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(a)?'count':'sold',s=ne(r.rid,a);return s&&(0,t.fishInStone)(r.rid,s)?{item:s.name,qty:(0,t.parseStoneAmount)(n),mode:i}:{item:s?.name??n,qty:o?'\xbd'===o[1]||/half/.test(o[1])?.5:S(o[1]):1,mode:i}},preview:(n,a)=>{const o=ne(a.rid,n.item);if(!o||'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||!Number.isInteger(2*r))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,s=(0,t.fromStone)(r,o.unit),l='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(r)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,l),o.unit))}?`}const i=S(n.qty)??0,s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,l.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,l.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,l.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,l.fmtCount)(s)}, after ${(0,l.fmtCount)(Math.max(0,c))})?`},run:(n,a)=>{const o=ne(a.rid,n.item);if(o&&'chef'===a.app&&!(0,r.chefCanSee)(a.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(a.rid,o)){const r=(0,t.parseStoneAmount)(n.qty??'');if(null==r||r<0||r>500||!Number.isInteger(2*r))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(r,o.unit),s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,l='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+l<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(l&&d.shellfish.append({rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner',delta:l,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+l,o.unit))} left.`)}const i=S(n.qty);if(!o||null==i||!(i>=0)||i>500)return'Nothing changed: say the item and how many.';if('half'!==o.unit&&i%1)return`Nothing changed: ${o.plural||o.name} are counted whole.`;const s=(0,d.venueCounts)(d.useShellStore.getState(),a.rid)[o.key]??0,c={rid:a.rid,kind:o.key,by:w(a),app:a.app??'owner'};return'count'===n.mode?(i!==s&&d.shellfish.append({...c,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,l.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(d.shellfish.append({...c,delta:i,reason:'delivery'}),`Done: ${(0,l.fmtCount)(i)} in. ${(0,l.fmtCount)(s+i)} now.`):s(k(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||ee(t))&&Z(t)&&!k(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:ne(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,a)=>{const o=(0,d.venueCounts)(d.useShellStore.getState(),a.rid),i=ne(a.rid,n.item),s=(i?[i]:te(a.rid).filter(t=>!(0,l.isRoastItem)(t)||(0,l.isSundayIn)(new Date))).filter(t=>'chef'!==a.app||(0,r.chefCanSee)(a.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(a.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,l.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},oe={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ie=(t,n)=>{const r=String(n??'').toLowerCase(),a=i.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return a.find(t=>t.ref&&r.includes(t.ref.toLowerCase()))??a.find(t=>{const n=r.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=a.filter(t=>D(t.customerName??'').some(t=>D(r).includes(t)));return 1===t.length?t[0]:void 0})()},se={id:'order_status',apps:C,title:'Move an order on: accept, preparing, ready or collected',risk:'change',params:[{name:'order',type:'string',required:!0,description:'Order reference, number or customer name'},{name:'status',type:'string',required:!0,description:'accept, preparing, ready or collected',enum:['accept','preparing','ready','collected']}],keywords:[],description:'Accept a takeaway or table order, or mark it preparing, ready or collected (the same as the order buttons).',match:t=>k(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&k(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!k(t,/\b(read|any|list|what)\b/)?7:0,parse:t=>{const n=t.toLowerCase();return{order:t,status:/\baccept/.test(n)?'accept':/\b(collected|picked up)\b/.test(n)?'collected':/\bready\b/.test(n)?'ready':'preparing'}},preview:(t,n)=>{const r=ie(n.rid,t.order);return r?`Mark order ${r.ref} for ${r.customerName} as ${'accept'===t.status?'accepted':t.status}?`:'I couldn\u2019t find that order. Say the order number or the name.'},run:async(t,n)=>{const r=ie(n.rid,t.order),a=oe[String(t.status)];if(!r||!a)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===a){return await o.repo.orders.accept(r.id,w(n))?`Done: order ${r.ref} accepted.`:`Order ${r.ref} was already accepted.`}return await o.repo.orders.setStatus(r.id,a,w(n)),`Done: order ${r.ref} is ${a}.`}},de={id:'order_list_add',apps:C,title:'Add to an order list',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What we need'},{name:'qty',type:'integer',description:'How many (default 1)'},{name:'list',type:'string',description:'Which list (supplier), if said'}],keywords:[],description:'Add an item to an order list (or add to the quantity if it is already on it). Nothing is ordered from the supplier.',match:t=>k(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!k(t,/\b(chat|message|tell|text|post|shift|rota)\b/)?6:0,parse:t=>{const n=t.toLowerCase().replace(/[.?!]+$/,'').match(/\b(?:add|put|need(?: more)?)\s+(?:(\d+|an?|one|two|three|four|five|six|seven|eight|nine|ten|twelve|twenty)\s+)?(.+?)(?:\s+(?:to|on)\s+(?:the\s+)?(.+?)(?:\s+(?:order|list|order list))*)?$/);return n?{qty:S(n[1])??1,item:n[2].replace(/^(?:some|more)\s+/,'').trim(),list:n[3]?.replace(/\b(order|list|shopping)\b/g,'').trim()||void 0}:{item:t}},preview:(t,n)=>{const r=c.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),a=String(t.list??'').toLowerCase(),o=a&&r.find(t=>t.name.toLowerCase().includes(a))||r[0];return o?`Add ${t.qty??1} ${t.item} to ${o.name}? Nothing is ordered from the supplier.`:'There are no order lists yet. Set one up in Order lists.'},run:(t,n)=>{const r=c.useOrderLists.getState(),a=r.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&a.find(t=>t.name.toLowerCase().includes(o))||a[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(S(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:w(n)},u=r.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return u?(r.bump(u.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(r.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},le={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function ce(t,n,r){return{id:t,apps:I,title:le[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${le[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>k(t,r)?8:0,preview:()=>`${le[n]} now?`,run:async(t,r)=>{if(!r.whoId)return'Sign in to the Staff app first.';const a=y().toISOString(),o=await(0,b.clockAction)(n,{rid:r.rid,staffId:r.whoId,date:r.today,at:a});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(a).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ue=ce('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),be=ce('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),pe=ce('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),he=ce('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),me=t=>{const n=u.useOwner.getState().staff,r=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>D(r).includes(t)))?.id},ge=(t,n)=>{if(!(0,p.hasRecipeCards)())return;const r=D(String(n??''));let a;for(const n of(0,p.recipeCards)().list(t)){const t=D(n.dish).filter(t=>r.includes(t)).length;t&&t>(a?.s??0)&&(a={c:n,s:t})}return a?.c},fe=t=>{const n=m.ALLERGENS.filter(n=>t[n.id]).map(n=>('may'===t[n.id]?'may contain ':'')+n.label.toLowerCase());return n.length?n.join(', '):'none of the 14 allergens'},ye=[B,E,R,H,W,G,U,Y,J,K,X,re,ae,se,de,ue,be,pe,he,{id:'decide_leave',apps:['owner'],title:'Approve or decline a holiday request',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff member id or first name'},{name:'outcome',type:'string',required:!0,description:'approved or declined',enum:['approved','declined']}],keywords:[],description:'Approve or decline someone\u2019s waiting holiday (leave) request.',match:t=>k(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&k(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),r=u.useOwner.getState().staff.find(t=>t.active&&D(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:r?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status),o=n.staff.find(t=>t.id===r)?.name.replace(' (example)','');return a?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${f(a.from)}${a.to!==a.from?` to ${f(a.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=u.useOwner.getState(),r=me(t.staffId),a=n.leave.find(t=>t.staffId===r&&'pending'===t.status);return a?(n.setLeave(a.id,'declined'===t.outcome?'declined':'approved'),`Done: holiday ${'declined'===t.outcome?'declined':'approved'}.`):'Nothing changed: no waiting request found.'}},{id:'allergen_signoff',apps:['chef'],title:'Sign off a dish\u2019s allergens',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'}],keywords:[],description:'Head chef signs off a recipe card (its allergens). The allergens are read back first.',match:t=>k(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?`${r.dish} can\u2019t be signed off yet: ${a}`:`Sign off ${r.dish}? Allergens: ${fe(r.allergens)}.`},run:async(t,n)=>{const r=ge(n.rid,t.dish);if(!r)return'Nothing changed: I couldn\u2019t find that recipe card.';const a=(0,h.signOffBlock)(r);return a?'Nothing changed: '+a:(await(0,p.recipeCards)().signOff(r.id,{name:w(n),role:'head-chef'}),`Done: ${r.dish} signed off.`)}}]},1427,[982,1098,804,829,848,800,1014,981,983,1025,865,1071,856,832,830]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.spokenDate=j,Object.defineProperty(_e,"GAP_VOICE_ACTIONS",{enumerable:!0,get:function(){return be}});var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),i=_r(_d[5]),s=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),l=_r(_d[12]),f=_r(_d[13]),u=_r(_d[14]),m=_r(_d[15]),g=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),$=_r(_d[22]);const v=(e,t)=>t.test(e),I=e=>e.who??('display'===e.app?'Main Display':'Assistant'),N=e=>(e??'').replace(' (example)',''),A=e=>String(e).padStart(2,'0'),D=()=>{const e=(0,$.appNow)();return`${A(e.getHours())}:${A(e.getMinutes())}`},C=['owner','staff','display'],T=['owner'],q=['staff','owner'],O=['owner','chef'],_=e=>`\u201c${e}\u201d`,x=(e,t)=>n.useOwner.getState().sys(e,t,(0,$.appNow)().toISOString()),M=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],R=e=>`${A(Math.floor(e))}:${A(Math.round(e%1*60))}`,L=['january','february','march','april','may','june','july','august','september','october','november','december'];function j(e,t){const a=e.toLowerCase(),r=a.match(new RegExp(`\\b(\\d{1,2})(?:st|nd|rd|th)?(?:\\s+of)?\\s+(${L.join('|')})\\b`))??a.match(new RegExp(`\\b(${L.join('|')})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`));if(r){const e=Number(/\d/.test(r[1])?r[1]:r[2]),a=L.indexOf(/\d/.test(r[1])?r[2]:r[1]);let n=Number(t.slice(0,4));return`${n}-${A(a+1)}-${A(e)}`e.active)){const r=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),n=Math.min(...r.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));n<1/0&&a.push({s:e,at:n})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>n.useOwner.getState().staff.find(t=>t.id===e),E=e=>F(e)??W(String(e??''))[0],U=e=>a.useStore.getState().waitlist.filter(t=>t.restaurantId===e&&('waiting'===t.status||'notified'===t.status)).sort((e,t)=>e.number-t.number);function z(e,t){const a=String(t??'').toLowerCase(),r=U(e);if(!r.length)return;const n=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(n)return r.find(e=>e.number===Number(n[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=r.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===r.length?r[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const n=a.useStore.getState(),i=n.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=r.useFloor.getState(),c=d.plans[e]??(0,r.seedPlan)(e),h=n.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,n.orders.filter(t=>t.restaurantId===e),d.live[e]??{},s,i.settings.turnMins,p);return(0,b.suggestTable)(c,h.filter(e=>e.date===o),f,t,s,(0,b.turnFor)(t,i.settings.turnMins))?.table}const P=/\bwait ?(ing )?list\b|\bwaiting\b/,H=[{name:'who',type:'string',required:!0,description:'Waitlist number or name, as said (or "next")'}],K={id:'waitlist_seat',apps:C,title:'Seat someone from the waitlist',risk:'change',params:[...H,{name:'table',type:'string',required:!1,description:'Table (else the best free table)'}],keywords:[],description:'Seat a waiting party from the waitlist at a table (the suggested table unless one is said), like the Seat button.',match:e=>v(e,P)&&v(e,/\bseat\b|\bsit\b/)?9:0,parse:e=>({who:e,table:(0,$.tableIn)(e)}),preview:(e,t)=>{const a=z(t.rid,e.who);if(!a)return'I couldn\u2019t find that party on the waitlist. Say their number or name.';const r=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return r?`Seat ${Y(a)}, at table ${r}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const n=z(a.rid,e.who);if(!n)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,n.partySize);return i?(await t.repo.waitlist.setStatus(n.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,n.partySize,i,`From waitlist #${n.number}`),(0,r.tablesOf)(i).forEach(e=>r.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${n.number} seated at table ${i}.`):'Nothing changed: there\u2019s no free table for them. Say a table.'}};function V(e,t){if(!e.whoId)return;const a=n.useOwner.getState().shifts.filter(t=>t.staffId===e.whoId&&!1!==t.published&&t.date>=e.today).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),r=j(String(t??''),e.today);return r?a.find(e=>e.date===r):a[0]}const G=e=>`${(0,$.niceDay)(e.date)}, ${R(e.start)} to ${R(e.end)}`,Q=/\b(approve|accept|decline|reject|okay|ok)\b/,Z='I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d.';function J(e,t){const a=e.toLowerCase(),r=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(r){const e=j(r[1],t),a=j(r[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!r||e.kind===r)),s=W(String(e??'')).map(e=>e.id);return s.length?i.find(e=>s.includes(e.fromId)&&(!e.toId||1===s.length||s.includes(e.toId)))??i.find(e=>s.includes(e.fromId)||e.toId&&s.includes(e.toId)):1===i.length?i[0]:void 0}const ee=(t,a)=>'chef'!==a?.app||(0,e.chefCanSee)(a.rid,t)&&(0,e.chefCanSee)(a.rid,i.useSafety.getState().points.find(e=>e.id===t.pointId)),te=(e,t)=>{const a=i.useSafety.getState().entries.filter(a=>(0,l.ymdOf)(new Date(a.at))===e&&ee(a,t));return{n:a.length,bad:a.filter(e=>!e.ok).length,fixed:a.filter(e=>!e.ok&&e.corrective).length}},ae=/\b(food safety|safety diary|diary|haccp|safe methods|sfbb)\b/;function re(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),r=new Date(a+'T00:00:00').getTime(),n=r+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=r&&a!e.ok).length,actions:s.filter(e=>!e.ok&&e.corrective).length,daysSigned:o.filter(e=>{const t=new Date(e.date+'T00:00:00').getTime();return t>=r&&te.test(t))?.[1]??'Other',location:s?s[1].replace(/^the /,''):'Not said',firstAid:o?o[1]:'',what:e.trim().replace(/^(?:please\s+)?(?:record|log|report|add|write up|put in the accident book)\s+(?:an?\s+)?(?:accident|near miss|injury)?\s*(?:in the accident book)?\s*[:,-]?\s*/i,'').replace(/^\w/,e=>e.toUpperCase())||e.trim()}}function se(e,t){const a=(0,d.ukClock)((0,$.appNow)()),r=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),n=(0,$.tokensOf)(String(t??'')).filter(e=>!['tick','ticked','task','off','mark','done','did','finished','completed','ive','i\u2019ve','list'].includes(e)),i=e=>(0,$.tokensOf)(e).filter(e=>n.some(t=>t===e||t.length>3&&e.startsWith(t.slice(0,4)))).length,h=e.whoId?(0,o.tasksFor)((0,s.tasksOf)(e.rid,e.whoId),r):[];let p=h.map(e=>({t:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.t;const l='chef'===e.app?['all','kitchen']:'staff'===e.app?['all','foh']:['all','foh','kitchen'],f=p?void 0:c.useReminders.getState().reminders.filter(t=>t.rid===e.rid&&!t.removed&&!t.paused&&t.days.includes(a.dow)&&l.includes(t.audience)).map(e=>({r:e,s:i(e.text)})).filter(e=>e.s).sort((e,t)=>t.s-e.s)[0]?.r;return{ymd:a.ymd,task:p,rem:f}}const oe=e=>a.useStore.getState().menu.filter(t=>t.restaurantId===e);function de(e,t){const a=(0,$.tokensOf)(String(t??''));let r;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(r?.s??0)&&(r={m:t,s:e})}return r?.m}const ce=e=>{const t=e.match(/\xa3\s?(\d+(?:\.\d{1,2})?)|\b(\d+(?:\.\d{2}))\b|\b(\d+)\s*(?:pounds|quid)(?:\s*(\d{1,2}))?/i);if(t)return t[1]?Number(t[1]):t[2]?Number(t[2]):Number(t[3])+(t[4]?Number(t[4])/100:0)},he={gram:'g',grams:'g',g:'g',kilo:'kg',kilos:'kg',kg:'kg',ml:'ml',millilitres:'ml',litre:'l',litres:'l',l:'l',tablespoon:'tbsp',tablespoons:'tbsp',tbsp:'tbsp',teaspoon:'tsp',teaspoons:'tsp',tsp:'tsp',pinch:'pinch',slice:'slice',slices:'slices',whole:'whole'};function pe(e){const t=e.match(/\badd\s+(\d+(?:\.\d+)?|a|an|one|two|three|four|five|six|half)\s*(grams?|g|kilos?|kg|ml|millilitres|litres?|l|tablespoons?|tbsp|teaspoons?|tsp|pinch|slices?|whole)?\s+(?:of\s+)?(.+?)\s+(?:to|into|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*$/i);if(t)return{qty:String((0,$.num)(t[1])??t[1]),unit:t[2]?he[t[2].toLowerCase()]??t[2]:'',name:t[3].trim(),dish:t[4]}}const le={in:'Clock {n} in',out:'Clock {n} out',break_start:'Start a break for {n}',break_end:'End {n}\u2019s break'},fe=e=>null==e?'not entered':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,ue=e=>'owner'===e.app&&'staff'!==e.role,me=['sunday','monday','tuesday','wednesday','thursday','friday','saturday'];function ge(e){if(/\bweekdays?\b/.test(e))return[1,2,3,4,5];if(/\bweekends?\b/.test(e))return[0,6];const t=me.map((t,a)=>new RegExp(`\\b${t}s?\\b`).test(e)?a:-1).filter(e=>e>=0);return t.length?t:[0,1,2,3,4,5,6]}const ye={all:'everyone on shift',foh:'front of house',kitchen:'the kitchen'},be=[K,{id:'waitlist_remove',apps:C,title:'Take someone off the waitlist',risk:'change',params:H,keywords:[],description:'Take a party off the waitlist (they left or no longer need a table), like the Remove button. It stays in the records.',match:e=>v(e,P)&&v(e,/\b(remove|take .*off|cross .*off|strike .*off|gave up|have left|has left|left|gone)\b/)&&!v(e,/\b(seat|told|ready)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Take ${Y(a)}, off the waitlist?`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,a)=>{const r=z(a.rid,e.who);return r?(await t.repo.waitlist.setStatus(r.id,'removed'),`Done: number ${r.number} is off the waitlist.`):'Nothing changed: I couldn\u2019t find that party.'}},{id:'waitlist_told',apps:C,title:'Mark a waiting party as told their table is ready',risk:'change',params:H,keywords:[],description:'Record that a waiting party has been told their table is ready, like the Mark as told button. No text is sent.',match:e=>v(e,P)&&v(e,/\b(told|tell|let .* know|notif|ready|called)\b/)&&!v(e,/\b(seat|remove)\b/)?9:0,parse:e=>({who:e}),preview:(e,t)=>{const a=z(t.rid,e.who);return a?`Mark ${Y(a)}, as told their table is ready? No text is sent from here.`:'I couldn\u2019t find that party on the waitlist.'},run:async(e,n)=>{const i=z(n.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===n.rid);return r.useFloor.getState().logSms(n.rid,(0,$.appNow)().toISOString(),`#${i.number} ${i.partySize}: Your table at ${s?.name??'the restaurant'} is ready.`),await t.repo.waitlist.setStatus(i.id,'notified'),`Done: number ${i.number} marked as told. No text was sent.`}},{id:'request_cover',apps:q,title:'Ask for cover for my shift',risk:'change',params:[{name:'day',type:'string',required:!1,description:'Day or date of your shift (else your next shift)'}],keywords:[],description:'Ask the team to cover one of your own shifts, like the Ask for cover button. A \u201cCover needed\u201d note goes in the team chat.',match:e=>v(e,/\bcover\b/)&&v(e,/\b(my|me)\b/)&&v(e,/\b(shift|ask|need|someone|anyone|can)\b/)&&!v(e,Q)?9:0,parse:e=>({day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day);return a?`Ask for cover for your shift on ${G(a)}? A \u201cCover needed\u201d note goes in the team chat.`:Z},run:(e,t)=>{const a=V(t,e.day);return a&&t.whoId?n.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,kind:'cover',note:'Can anyone cover?'}),x('all',`Cover needed: ${M[a.day]} ${R(a.start)}\u2013${R(a.end)} (${N(F(t.whoId)?.name??t.who)})`),`Done: cover asked for ${G(a)}. A manager approves it once someone takes it.`):"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_swap',apps:q,title:'Ask to swap my shift with someone',risk:'change',params:[{name:'with',type:'string',required:!0,description:'Who you agreed to swap with (first name)'},{name:'day',type:'string',required:!1,description:'Day or date of your shift'}],keywords:[],description:'Ask a manager to approve swapping one of your shifts with a colleague you agreed it with, like the Swap with button.',match:e=>v(e,/\bswap\b/)&&!v(e,Q)?9:0,parse:(e,t)=>({with:W(e).find(e=>e.id!==t?.whoId)?.id,day:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I know whose shift it is.';const a=V(t,e.day),r=E(e.with);return r&&r.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(r.name)}? A manager still approves it.`:Z:'Who are you swapping with? Say their first name.'},run:(e,t)=>{const a=V(t,e.day),r=E(e.with);return a&&t.whoId?r&&r.id!==t.whoId?(n.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:r.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(r.name)} asked for. A manager approves it.`):'Nothing changed: say who you\u2019re swapping with.':"Nothing changed: I couldn\u2019t find a published shift of yours on that day. Say the day, for example \u201cFriday\u201d."}},{id:'request_holiday',apps:q,title:'Ask for holiday',risk:'change',params:[{name:'from',type:'string',required:!0,description:'First day off, YYYY-MM-DD'},{name:'to',type:'string',required:!0,description:'Last day off, YYYY-MM-DD'},{name:'reason',type:'string',required:!1,description:'Reason (default Holiday)'}],keywords:[],description:'Send your own holiday (time off) request to a manager, like the Send request button.',match:e=>v(e,/\b(holiday|time off|day off|days off|annual leave|leave)\b/)&&v(e,/\b(request|book|ask|want|need|like|have|put in|take|off)\b/)&&!v(e,Q)&&!v(e,/\b(who|how many|when is)\b/)?8:0,parse:(e,t)=>{const a=J(e,t?.today??(0,l.ymdOf)((0,$.appNow)())),r=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:r&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(r[1])?r[1]:void 0}},preview:(e,t)=>t.whoId?`Ask for ${e.reason??'holiday'} from ${(0,$.niceDay)(String(e.from))}${e.to!==e.from?` to ${(0,$.niceDay)(String(e.to))}`:''}? A manager approves it.`:'Sign in first so I know who\u2019s asking.',run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const a=e=>/^\d{4}-\d{2}-\d{2}$/.test(String(e));return!a(e.from)||!a(e.to)||String(e.to)v(e,Q)&&v(e,/\b(swap|cover|swaps)\b/)?9:0,parse:e=>({who:e,outcome:/\b(decline|reject|refuse|no)\b/i.test(e)?'declined':'approved'}),preview:e=>{const t=X(e.who);if(!t)return'I couldn\u2019t find that open swap or cover request. Say the name on it.';const a=n.useOwner.getState().shifts.find(e=>e.id===t.shiftId),r=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${r}\u2019s swap with ${i}`:t.toId?`${i} covering ${r}`:`${r}\u2019s cover request`;return'declined'===e.outcome||t.toId?`${'declined'===e.outcome?'Decline':'Approve'} ${s}${a?` for ${G(a)}`:''}?${'declined'===e.outcome?'':' The shift moves and a note goes in the team chat.'}`:`Nobody has taken ${r}\u2019s cover yet, so it can\u2019t be approved. You can decline it.`},run:e=>{const t=X(e.who);if(!t)return'Nothing changed: no open request found.';if('declined'!==e.outcome&&!t.toId)return'Nothing changed: nobody has taken that cover yet.';const a=n.useOwner.getState(),r=a.shifts.find(e=>e.id===t.shiftId);if(a.setSwap(t.id,'declined'===e.outcome?'declined':'approved'),'declined'===e.outcome)return'Done: request declined.';const i=e=>N(F(e)?.name);return x('all','swap'===t.kind?`Shift swap: ${i(t.fromId)} \u2194 ${i(t.toId)} approved`:`Cover approved: ${i(t.toId)} covers ${i(t.fromId)}${r?` (${M[r.day]} ${R(r.start)}\u2013${R(r.end)})`:''}`),'Done: approved and posted in the team chat.'}},{id:'sign_safety_day',apps:O,title:'Sign today\u2019s food safety diary',risk:'change',params:[],keywords:[],description:'Sign today\u2019s food safety diary: the opening and closing checks were done and the safe methods were followed, like the diary Sign button. Today only.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,ae)&&!v(e,/\bweek(ly)?\b/)?9:0,preview:(e,t)=>{const a=(i.useSafety.getState().daySigns??[]).find(e=>e.date===t.today);if(a)return`Today\u2019s diary is already signed by ${a.by}.`;const r=te(t.today,t);return`Sign today\u2019s food safety diary as ${I(t)}: the opening and closing checks were done and the safe methods were followed today? Today: ${r.n} checks, ${r.bad} out of range${r.bad?`, ${r.fixed} with an action`:''}.`},run:(e,t)=>'staff'===t.role?'Nothing changed: only a manager or the head chef signs the diary.':(i.useSafety.getState().daySigns??[]).some(e=>e.date===t.today)?'It\u2019s already signed today.':(i.useSafety.getState().signDay({date:t.today,by:N(I(t)),byId:t.whoId??'',at:(0,$.appNow)().toISOString()}),'Done: today\u2019s diary signed.')},{id:'sign_safety_week',apps:O,title:'Sign off this week\u2019s food safety review',risk:'change',params:[],keywords:[],description:'Weekly food safety review: reads the six statements back; Confirm means yes to all six. If any reading is out of range without an action, it must be done on screen with a note.',match:e=>v(e,/\bsign(ed|ing)?\b/)&&v(e,/\bweek(ly)?\b/)&&(v(e,ae)||v(e,/\b(review|safety|checks)\b/))?9:0,preview:(e,t)=>{const{week:a,summary:r}=re(t.today,t),n=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(n)return`This week is already signed off by ${n.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${r.entries} checks, ${r.outOfRange} out of range, ${r.actions} with an action, diary signed ${r.daysSigned} of 7 days.`;return r.actions`${t+1}. ${e}.`).join(' ')} Sign off the week?`},run:(e,t)=>{if('staff'===t.role)return'Nothing changed: only a manager or the head chef signs off the week.';const{week:a,summary:r}=re(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':r.actions!0),note:'Signed by voice: yes to all.',summary:r}),'Done: week signed off.')}},{id:'record_accident',title:'Record an accident or near miss',risk:'change',params:[{name:'what',type:'string',required:!0,description:'What happened, in the speaker\u2019s words'},{name:'person',type:'string',required:!1,description:'Who was hurt'},{name:'location',type:'string',required:!1,description:'Where'},{name:'injury',type:'string',required:!1,description:'The injury'},{name:'firstAid',type:'string',required:!1,description:'First aid given'}],keywords:[],description:'Add an entry to the accident book (accident or near miss) with what was said; every field is read back first.',match:e=>v(e,/\baccident book\b/)?10:v(e,/\b(accident|injur(y|ed)|near miss|hurt|cut (him|her|them|my)self|burn(ed|t)? (him|her|them|my)self|slipped|tripped|fell over|scalded)\b/)&&v(e,/\b(record|log|report|write|add|book|had|there was|has|have|just)\b/)&&!v(e,/\b(how many|show|read)\b/)?8:0,parse:e=>{const t=ie(e);return{what:t.what,person:t.person,location:t.location,firstAid:t.firstAid}},preview:e=>{const t=ie(String(e.what)),a=String(e.person??t.person),r=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${r}; type, ${t.category}; what happened, ${_(t.what)}; injury, ${e.injury?String(e.injury):'Near miss'===t.category?'none (near miss)':'not recorded'}; first aid, ${e.firstAid||t.firstAid||'none recorded'}; reported by you. Check it before you confirm; you can add more in the Accident book.`},run:(e,t)=>{const a=ie(String(e.what)),r='Near miss'===a.category,n=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(n)}T${D()}`,location:String(e.location??a.location),person:String(e.person??a.person),personType:a.personType,category:a.category,what:a.what,injury:String(e.injury??'')||(r?'None (near miss)':'Not recorded'),firstAid:String(e.firstAid||a.firstAid||'')||'None recorded',witnesses:'None',reportedBy:N(I(t)),reportedById:t.whoId??'',app:'staff'===t.app?'staff':'chef'===t.app?'chef':'managers'}),'Done: added to the accident book.'+(/(hospital|fracture|broke|unconscious|ambulance)/i.test(a.what)?' This may need reporting under RIDDOR; check the Accident book.':'')}},{id:'tick_task',apps:['staff','chef','owner'],title:'Tick off one of my tasks',risk:'change',params:[{name:'task',type:'string',required:!0,description:'The task or reminder, as said'}],keywords:[],description:'Tick off one of today\u2019s daily tasks (yours), or mark a venue reminder like \u201cchairs up\u201d as done, like the tick and Done buttons.',match:e=>v(e,/\btick(ed)?( off)?\b|\bmark .* (as )?done\b|\b(i'?ve|i have|we'?ve) (done|finished|completed)\b|\b(task|reminder) (is )?done\b|\bdone the\b/)&&!v(e,/\b(shift|break|order|table|booking|clock)\b/)?7:0,parse:e=>({task:e}),preview:(e,t)=>{if(!t.whoId)return'Sign in first so I tick your tasks.';const{ymd:a,task:r,rem:n}=se(t,e.task);return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?`${_(r.text)} is already ticked today.`:`Tick off today\u2019s task ${_(r.text)}?`:n?`Mark the reminder ${_(n.text)} as done for today?`:'I couldn\u2019t find that in today\u2019s tasks. Say a word from the task.'},run:(e,t)=>{if(!t.whoId)return'Nothing changed: sign in first.';const{ymd:a,task:r,rem:n}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return r?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,r.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,r.id,a,i),`Done: ${_(r.text)} ticked.`):n?(c.useReminders.getState().markDone({rid:t.rid,reminderId:n.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(n.text)} marked done.`):'Nothing changed: I couldn\u2019t find that task.'}},{id:'add_dish',apps:T,title:'Add a dish to the menu',risk:'change',params:[{name:'name',type:'string',required:!0,description:'Dish name'},{name:'section',type:'string',required:!1,description:'Menu section'},{name:'price',type:'string',required:!0,description:'Price in pounds'},{name:'description',type:'string',required:!1,description:'Short description'}],keywords:[],description:'Add a new dish to the menu, like Manage \u203a Add dish. It stays off the menu until the head chef signs off its recipe card.',match:e=>v(e,/\b(add|new|put)\b/)&&v(e,/\b(dish|menu item|to the menu|on the menu|onto the menu)\b/)&&!v(e,/\b(special|specials|sold out|order list)\b/)?8:0,parse:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),n=e.toLowerCase(),i=e.match(/\b(?:called|named)\s+(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i)??e.match(/\b(?:add|put)\s+(?:a |an |the )?(?:new )?(?:dish\s+)?(.+?)(?=\s+(?:to|in|on|under|at|for|priced|\xa3)\b|[,.]|$)/i),s=r?.sections.find(e=>n.includes(e.toLowerCase())||n.includes(e.toLowerCase().replace(/s$/,''))),o=ce(e);return{name:i?.[1]?.replace(/^(?:a |an )?(?:new )?dish\s*/i,'').trim(),section:s,price:null!=o?String(o):void 0}},preview:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=String(e.section??r?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${n} at \xa3${Number(e.price).toFixed(2)}${e.description?`, described as ${_(String(e.description))}`:''}? It stays off the menu until the head chef signs off its recipe card.`},run:(e,t)=>{const r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),n=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(n)||n<=0?'Nothing changed: I need a dish name and a price.':de(t.rid,i)?.name.toLowerCase()===i.toLowerCase()?'That dish is already on the menu.':(a.useStore.getState().addMenuItem({restaurantId:t.rid,section:String(e.section??r?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:n,dietary:[],allergens:{},prepMins:10,soldOut:!1,signOff:null}),`Done: ${i} added. The head chef needs to add its recipe card and sign off the allergens before it shows.`)}},{id:'edit_dish',apps:T,title:'Rename a dish or change its description',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name now'},{name:'field',type:'string',required:!0,description:'name or description',enum:['name','description']},{name:'value',type:'string',required:!0,description:'The new name or description'}],keywords:[],description:'Rename a dish or change its menu description, like Manage \u203a Save dish. Renaming changes its recipe card, so the head chef signs it off again.',match:e=>v(e,/\brename\b|\b(change|update|set|edit)\b.*\b(description|name)\b|\bdescri(be|ption)\b.*\bas\b/)&&!v(e,/\b(price|booking|special|my name)\b/)?8:0,parse:e=>{const t=e.match(/\brename\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i);if(t)return{dish:t[1],field:'name',value:t[2].trim()};const a=e.match(/\bname of\s+(?:the\s+)?(.+?)\s+to\s+(.+)$/i);if(a)return{dish:a[1],field:'name',value:a[2].trim()};const r=e.match(/\bdescription (?:of|for)\s+(?:the\s+)?(.+?)\s+(?:to|as)\s+(.+)$/i)??e.match(/\b(?:describe|change|update|set)\s+(?:the\s+)?(.+?)(?:'s|\u2019s)?\s+(?:description\s+)?(?:to|as)\s+(.+)$/i);return r?{dish:r[1],field:'description',value:r[2].trim()}:{dish:e}},preview:(e,t)=>{const a=de(t.rid,e.dish);return a?'name'===e.field?`Rename ${_(a.name)} to ${_(String(e.value))}? Its recipe card changes too, so the head chef signs it off again.`:`Change the description of ${a.name} to ${_(String(e.value))}?`:'I couldn\u2019t find that dish on the menu.'},run:(e,t)=>{const r=de(t.rid,e.dish),n=String(e.value??'').trim();return r?n.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(r.id,'name'===e.field?{name:n}:{description:n}),'name'===e.field?`Done: renamed to ${n}.`:`Done: description of ${r.name} changed.`):'Nothing changed: I couldn\u2019t find that dish.'}},{id:'add_recipe_ingredient',apps:['chef'],title:'Add an ingredient to a recipe card',risk:'change',params:[{name:'text',type:'string',required:!0,description:'e.g. add 50 grams of butter to the haggis'}],keywords:[],description:'Add an ingredient line to a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\badd\b/)&&v(e,/\b(ingredient|recipe|card)\b|\badd\s+\d+\s*(g|grams?|kg|ml|tbsp|tsp)\b/)&&!v(e,/\b(step|method|order list|special)\b/)?8:0,parse:e=>({text:e}),preview:(e,t)=>{const a=pe(String(e.text));if(!a)return'Say it like \u201cadd 50 grams of butter to the haggis\u201d.';const r=(0,$.findCard)(t.rid,a.dish);return r?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${r.dish}\u2019s recipe card?${r.signOff?' It\u2019s signed off now, so it will need signing off again.':''} Check its allergens on the card.`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=pe(String(e.text)),r=a&&(0,$.findCard)(t.rid,a.dish);return a&&r?(await(0,y.recipeCards)().update(r.id,{ingredients:[...r.ingredients,{id:(0,k.uuid)(),name:a.name,qty:a.qty,unit:a.unit}]},{name:N(I(t)),role:'head-chef'}),`Done: ${a.name} added to ${r.dish}.${r.signOff?' It needs signing off again.':''}`):'Nothing changed: I couldn\u2019t find that recipe card.'}},{id:'add_recipe_step',apps:['chef'],title:'Add a method step to a recipe card',risk:'change',params:[{name:'dish',type:'string',required:!0,description:'Dish name'},{name:'step',type:'string',required:!0,description:'The step wording'}],keywords:[],description:'Add a method step to the end of a recipe card. Changing a signed-off card means it must be signed off again.',match:e=>v(e,/\b(add|new)\b/)&&v(e,/\b(step|method)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:to|for)\s+(?:the\s+)?(.+?)(?:\s+(?:recipe|card|recipe card))?\s*[:,]\s*(.+)$/i)??e.match(/\bstep\s+(?:to|for)\s+(?:the\s+)?(.+?)\s+(?:saying|that says|reading)\s+(.+)$/i);return t?{dish:t[1],step:t[2].trim()}:{dish:e}},preview:(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0;return a?`Add step ${a.steps.length+1} to ${a.dish}: ${_(String(e.step))}?${a.signOff?' It will need signing off again.':''}`:'I couldn\u2019t find that recipe card.'},run:async(e,t)=>{const a=(0,y.hasRecipeCards)()?(0,$.findCard)(t.rid,e.dish):void 0,r=String(e.step??'').trim();return!a||r.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,r]},{name:N(I(t)),role:'head-chef'}),`Done: step added to ${a.dish}.`)}},{id:'manager_clock',apps:T,title:'Clock someone in or out (manager correction)',risk:'change',params:[{name:'staffId',type:'string',required:!0,description:'Staff first name or id'},{name:'action',type:'string',required:!0,description:'in, out, break_start or break_end',enum:['in','out','break_start','break_end']},{name:'reason',type:'string',required:!0,description:'Why (at least 3 letters)'}],keywords:[],description:'A manager clocks a member of staff in or out, or starts or ends their break, now, with a reason, like the Clock tab\u2019s manager buttons. It is marked as a manager correction.',match:e=>v(e,/\bclock\s+\w+\s+(in|out)\b|\bclock (in|out)\s+[a-z]+\b|\b(start|end)\s+(a |the )?break for\b|\b(end|finish)\s+\w+'?s break\b/)&&!v(e,/\b(me|myself|my|who|is|are|has)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=W(e)[0],r=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),n=/\bbreak\b/.test(t)?/\b(end|finish|back)\b/.test(t)?'break_end':'break_start':/\bout\b/.test(t)?'out':'in';return{staffId:a?.id,action:n,reason:r?.[1]?.trim()}},preview:e=>{const t=E(e.staffId);return t?`${le[e.action??'in'].replace('{n}',N(t.name))} now, at ${D()}? Reason: ${_(String(e.reason))}. It\u2019s marked as a manager correction.`:'Who? Say their first name.'},run:(e,t)=>{const a=E(e.staffId);if(!a)return'Nothing changed: I couldn\u2019t tell who.';const r=e.action??'in',n=(0,g.managerClockAction)(r,{rid:t.rid,staffId:a.id,date:t.today,at:(0,$.appNow)().toISOString()},{id:t.whoId??'manager',name:N(I(t))},String(e.reason??''));return n.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[r]} at ${D()}.${n.warn?' '+n.warn:''}`:'Nothing changed: '+n.message}},{id:'tips_pot',apps:T,title:'What\u2019s in the tips pot',risk:'look',params:[],keywords:[],description:'Managers only: the confirmed tips held for the team since the last payout (the Tips pot card).',match:e=>v(e,/\btips? (pot|jar|so far|held|this (period|fortnight|month|week))\b|\bin the tips\b|\bhow much (have we got |is there )?in tips\b|\bwhat are the tips\b|\bhow much (are|is) (the )?tips\b/)&&!v(e,/\b(pay|payout|split|share out)\b/)?8:0,preview:()=>'Tips pot',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const r=h.useCashUp.getState(),n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,n?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(r.tips.filter(e=>e.rid===t.rid),r.pot.filter(e=>e.rid===t.rid),(0,l.tipsPeriod)(i,t.today).start,t.today);return`The tips pot holds ${fe(s.total)} from ${(0,$.niceDay)(s.from)} to today, from ${s.days.length} confirmed cash-up${1===s.days.length?'':'s'}.${s.lastPayout?` Last paid out through ${(0,$.niceDay)(s.lastPayout.throughDate)}.`:''}`}},{id:'cash_up_summary',apps:T,title:'Read the latest cash-up',risk:'look',params:[{name:'day',type:'string',required:!1,description:'Day (else the latest)'}],keywords:[],description:'Managers only: the latest (or a named day\u2019s) cash-up: gross takings, tips and who confirmed it.',match:e=>v(e,/\bcash.?up\b|\btakings\b|\bhow much did we take\b/)&&!v(e,/\b(add|enter|start|do the|unlock|edit)\b/)?8:0,parse:(e,t)=>({day:j(e.replace(/\btonight\b/i,'today'),t?.today??(0,l.ymdOf)((0,$.appNow)()))??(/\b(last night|yesterday)\b/i.test(e)?'yesterday':void 0)}),preview:()=>'Cash-up read-out',run:(e,t)=>{if(!ue(t))return'That isn\u2019t shown here. Ask a manager in the Managers app.';const a=new Date(t.today+'T12:00:00');a.setDate(a.getDate()-1);const r='yesterday'===e.day?(0,l.ymdOf)(a):e.day,n=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!r||e.date===r)).sort((e,t)=>t.date.localeCompare(e.date)),i=n[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: gross takings ${fe((0,p.grossOf)(i.vals))}, tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:r?`There\u2019s no cash-up for ${(0,$.niceDay)(r)}.`:'There\u2019s no cash-up yet.'}},{id:'table_note',apps:C,title:'Add a note to a table',risk:'change',params:[{name:'table',type:'string',required:!0,description:'Table'},{name:'note',type:'string',required:!0,description:'The note (say \u201cclear\u201d to remove it)'}],keywords:[],description:'Put a short note on a table on the floor plan (e.g. \u201chigh chair\u201d, \u201cbirthday\u201d), like the table sheet\u2019s Note.',match:e=>v(e,/\btables?\s+\w+/)&&v(e,/\bnote\b/)&&!v(e,/\bshift note\b/)?9:0,parse:e=>{const t=e.match(/\bnote\b(?:\s+(?:on|for|to)\s+tables?\s+\w+)?\s*(?:[:,-]|saying|that says|that|says|reading)?\s*(.+)$/i),a=/\b(clear|remove|delete) (the )?note\b/i.test(e);return{table:(0,$.tableIn)(e),note:a?'clear':t?.[1]?.replace(/^(?:on|for|to)?\s*tables?\s+\w+\s*[:,-]?\s*/i,'').trim()}},preview:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);return a?'clear'===e.note?`Clear the note on table ${a}?`:`Note on table ${a}: ${_(String(e.note))}?`:'Which table?'},run:(e,t)=>{const a=(0,$.resolveTable)(t.rid,e.table);if(!a)return'Nothing changed: I couldn\u2019t find that table.';const n='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,r.tablesOf)(a).forEach(e=>r.useFloor.getState().setLive(t.rid,e,{note:n||void 0})),n?`Done: note on table ${a}.`:`Done: note cleared on table ${a}.`}},{id:'log_lost_property',apps:T,title:'Log lost property',risk:'change',params:[{name:'item',type:'string',required:!0,description:'What was found'},{name:'where',type:'string',required:!1,description:'Where it was found'}],keywords:[],description:'Add an item to the lost property log (held), like Extras \u203a Lost property \u203a Add.',match:e=>v(e,/\blost property\b|\b(found|someone left|left behind|handed in)\b\s+(a|an|some|their|his|her)\b|\b(a|an)\s+\w+(\s+\w+)?\s+(was )?(left behind|handed in)\b/)&&!v(e,/\b(how many|what'?s in|list|read|returned)\b/)?8:0,parse:e=>{const t=e.match(/\b(?:found|left(?: behind)?|handed in|log|add)\s+(?:a |an |some |their |his |her )?(.+?)(?=\s+(?:at|on|in|under|by|near|from)\s|[,.]|$)/i)??e.match(/\b(?:a|an)\s+(.+?)\s+(?:was )?(?:left behind|handed in)/i),a=e.match(/\s(?:at|on|in|under|by|near)\s+(?:the\s+)?(table\s+\w+|bar|toilets?|coat ?rack|cloakroom|door|entrance|terrace|garden|car park|dining room|booth\s+\w+|[a-z]+ table)\b/i);return{item:t?.[1]?.replace(/^(?:lost property|to lost property)\s*:?\s*/i,'').trim(),where:a?.[1]}},preview:e=>`Log lost property: ${_(String(e.item))}, found ${e.where?`at ${e.where}`:'(place not noted)'}, today at ${D()}? It\u2019s marked as held.`,run:(e,t)=>{const a=String(e.item??'').trim();if(a.length<2)return'Nothing changed: say what was found.';const r=(0,$.appNow)();return n.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(r)} ${D()}`,foundBy:N(I(t))}),`Done: ${a} logged as held.`}},{id:'add_reminder',apps:T,title:'Add a venue reminder for staff',risk:'change',params:[{name:'text',type:'string',required:!0,description:'What it says'},{name:'time',type:'string',required:!0,description:'HH:MM, UK time'},{name:'days',type:'string',required:!1,description:'Days (default every day)'},{name:'audience',type:'string',required:!1,description:'all, foh or kitchen',enum:['all','foh','kitchen']}],keywords:[],description:'Add a venue reminder shown to staff on shift at a time on chosen days, like Settings \u203a Advanced \u203a Reminders \u203a Add.',match:e=>v(e,/\b(remind|reminder)\b/)&&v(e,/\b(add|set|new|create|every|daily|weekdays?|weekends?|at \d)\b/)&&!v(e,/\b(me|my)\b/)?8:0,parse:e=>{const t=e.toLowerCase(),a=/\b(kitchen|chefs?)\b/.test(t)?'kitchen':/\b(front of house|foh|floor|waiters?|servers?)\b/.test(t)?'foh':'all',r=e.match(/\bremind(?:er)?\s+(?:for\s+)?(?:everyone|all staff|staff|the team|the kitchen|kitchen|front of house|foh|the floor|chefs?)?\s*(?:to|that|:)\s+(.+?)(?=\s+(?:at\s+\d|every\b|on\s+(?:mon|tue|wed|thu|fri|sat|sun)|daily|weekdays?|weekends?)|$)/i)??e.match(/\breminder\s*(?:saying|that says|:)\s*(.+?)(?=\s+(?:at\s+\d|every\b|daily)|$)/i),n=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:r?.[1]?.trim(),time:n?(0,$.hm)(n[1])??void 0:void 0,days:ge(t).join(','),audience:a}},preview:e=>{const t=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number),a=String(e.text??''),r=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(r)}, ${7===t.length?'every day':'every '+t.map(e=>me[e].replace(/^\w/,e=>e.toUpperCase())).join(', ')} at ${e.time} (UK time)?`},run:(e,t)=>{const a=String(e.text??'').trim(),r=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(r))return'Nothing changed: I need the wording and a time like 21:00.';const n=String(e.days??'0,1,2,3,4,5,6').split(',').map(Number).filter(e=>e>=0&&e<=6).sort();return c.useReminders.getState().ensure(t.rid),c.useReminders.getState().add(t.rid,{text:a.charAt(0).toUpperCase()+a.slice(1),days:n,time:r,audience:e.audience??'all'}),'Done: reminder added.'}}]},1428,[804,848,800,1014,865,1019,1029,1030,1002,1001,1024,13,1049,1050,1051,1020,1071,856,1079,1011,839,1429,1427]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=R,_e.findDish=E,_e.allergensSaid=M,_e.timeFrom=Y,_e.coversFrom=G,_e.dateFrom=Z,_e.nameFrom=$,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return X}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),i=_r(_d[6]),s=_r(_d[7]),d=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),p=_r(_d[11]),u=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]);const w=()=>{try{return(0,i.nowFrom)(i.useStore.getState().clock)}catch{return new Date}},v=e=>String(e).padStart(2,'0'),k=e=>e.getFullYear()+'-'+v(e.getMonth()+1)+'-'+v(e.getDate()),S=e=>{const[t,r,a]=e.split('-').map(Number);return new Date(t,r-1,a).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},N=(e,t)=>t.test(e),I=(e,t)=>e+' '+t+(1===e?'':'s'),A={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},T=e=>null==e?void 0:A[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),x=e=>e.who??('display'===e.app?'Main Display':'Assistant'),D={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},C=e=>D[e.app??'owner'],O=new Set(['the','and','with','our','for']),L=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!O.has(e));function R(e){const t=i.useStore.getState(),r=(0,c.resolveMenu)(t.menu.filter(t=>t.restaurantId===e&&!t.hidden)).map(e=>({kind:'menu',id:e.id,name:e.name,allergens:e.allergens,soldOut:e.soldOut,price:e.price,signedOff:!!e.signOff})),a=l.useSpecials.getState().current[e];return[...r,...(a?.items??[]).map(e=>({kind:'special',id:e.id,name:e.name,allergens:e.allergens,price:e.price,signedOff:!!a?.allergenCheck}))]}const _=e=>e.replace(/s$/,'');function E(e,t){const r=new Set(L(e).map(_)),a=e.toLowerCase();let n;for(const e of R(t)){const t=L(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(_(e))).length;if(!o)continue;const i=o/t.length+.25*o+(a.includes(e.name.toLowerCase())?2:0);(o>=Math.min(2,t.length)||t.length<=3)&&(!n||i>n.s)&&(n={d:e,s:i})}return n?.d}const F=[[/\b(gluten|wheat|coeliac|celiac|barley|rye)\b/,['gluten']],[/\bpeanuts?\b/,['peanuts']],[/\b(tree ?nuts?|almonds?|walnuts?|hazelnuts?|cashews?|pecans?|pistachios?)\b/,['treenuts']],[/\bnuts?\b/,['peanuts','treenuts']],[/\b(dairy|milk|lactose|cheese|cream|butter)\b/,['milk']],[/\beggs?\b/,['eggs']],[/\b(shellfish|crustaceans?|prawns?|crab|langoustines?)\b/,['crustaceans']],[/\b(molluscs?|mussels?|oysters?|squid|scallops?|clams?)\b/,['molluscs']],[/\bfish\b/,['fish']],[/\b(soya|soy)\b/,['soya']],[/\bcelery\b/,['celery']],[/\bmustard\b/,['mustard']],[/\bsesame\b/,['sesame']],[/\b(sulphites?|sulfites?|sulphur)\b/,['sulphites']],[/\blupin\b/,['lupin']]];function M(e){const t=new Set;for(const[r,a]of F)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const q=e=>p.ALLERGENS.find(t=>t.id===e)?.short??e,z='Always check the signed-off recipe card and tell the kitchen about any allergy.';function B(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=d.useSafety.getState().points.filter(t=>'chef'!==r?.app||(0,e.chefCanSee)(r.rid,t)),n=/\b(done|complete|completed|finished|ok|okay|checked)\b/i.test(t);return(0,f.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,f.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const j=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function H(e){const t=d.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,f.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,f.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,f.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function Y(e){const t=e.match(/\b(?:at|around|about)\s+(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})[:.](\d{2})\s*(am|pm)?\b/)??e.match(/\b(\d{1,2})()\s*(am|pm)\b/);if(!t){const t=e.match(new RegExp("\\bhalf (?:past )?(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b"));if(!t)return;let r=T(t[1])??0;return r>=1&&r<=10&&(r+=12),v(r)+':30'}let r=Number(t[1]);const a=Number(t[2]||0),n=t[3];return'pm'===n&&r<12&&(r+=12),'am'===n&&12===r&&(r=0),!n&&r>=1&&r<=10&&(r+=12),r>23||a>59?void 0:v(r)+':'+v(a)}function G(e){const r=e.match(new RegExp("\\b(?:table for|party of|for|of)\\s+(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))"))??e.match(new RegExp("\\b(\\d{1,3}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\\s*(?:covers|people|guests|adults|of us)\\b")),a=T(r?.[1]);return a&&(0,t.validParty)(a)?a:void 0}const P=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function Z(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),k(r);const a=P.findIndex(t=>e.includes(t));if(a>=0){const t=(r.getDay()+6)%7;return r.setDate(r.getDate()+((a-t+7)%7||(/\bnext\b/.test(e)?7:0))),k(r)}return t}function U(e,t,r,a){const n=i.useStore.getState(),o=n.restaurants.find(t=>t.id===e),d=s.useFloor.getState().plans[e]??(0,s.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(d,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const K=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return v(Math.floor(n/60))+':'+v(n%60)},W=e=>e.replace(/^\w/,e=>e.toUpperCase());function $(e){const t=e.match(/\b(?:under|name of|named|called)\s+([A-Za-z][A-Za-z'\u2019-]+(?:\s+[A-Z][A-Za-z'\u2019-]+)?)/i)??e.match(/\bname(?:'s| is)?\s+([A-Za-z][A-Za-z'\u2019-]+)/i);return t?W(t[1]):void 0}const J=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),V=e=>!['collected','served','closed','cancelled'].includes(e.status),Q=e=>e.toUpperCase().replace(/[\s-]/g,''),X=[{id:'next_table_free',title:'When is the next table free?',risk:'look',description:'Estimate when the next table frees up, and how long a walk-in for 2 or 4 would wait.',params:[],keywords:['next table','table free'],match:e=>N(e,/\b(next|soonest|first)\b.*\btables?\b.*\b(free|ready|available|clear)\b|\bhow long\b.*\b(wait|walk)|\bwait(ing)? (time|for a table)\b|\bwhen\b.*\btable\b.*\b(free|ready)\b/)?4:0,preview:()=>'Next table free',run:(e,t)=>{const r=i.useStore.getState(),a=w(),n=k(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const d=s.useFloor.getState(),l=d.plans[t.rid]??(0,s.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,m.closedAreasAt)(m.useBlocks.getState().blocks,t.rid,n,v(a.getHours())+':'+v(a.getMinutes())),f=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),d.live[t.rid]??{},a,o.settings.turnMins,p);return(0,h.nextFreeSentence)((0,h.nextTablesFree)(o,f,c.filter(e=>e.date===n),a,c),a)+' It\u2019s an estimate.'}},{id:'log_check',title:'Log a temperature or kitchen check',risk:'change',description:'Record fridge, freezer, cooking, cooling, hot-hold or delivery temperatures, or a cleaning or kitchen check, in the food safety log. Out-of-range readings are flagged.',params:[{name:'readings',type:'string',required:!0,description:'JSON list of {pointId, value in \xb0C or null, done for non-temperature checks}'}],keywords:['fridge','freezer','temperature','probe'],match:e=>J(e)&&N(e,/\b(fridges?|freezers?|walk.?in|cold room|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!N(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||N(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(B(e,t))}),preview:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(H).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cwalk-in fridge 3 degrees\u201d.'},run:(t,r)=>{const a=d.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=j(t).filter(e=>a.some(t=>t.id===e.pointId));if(!n.length)return'Nothing logged: I didn\u2019t catch which unit or check.';if(n.some(e=>{const t=a.find(t=>t.id===e.pointId);return!!t&&(0,f.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=w().toISOString(),i='chef'===r.app?'chef':'owner'===r.app?'managers':'staff',s=n.filter(e=>a.some(t=>t.id===e.pointId)).map(e=>{const t=a.find(t=>t.id===e.pointId),n=(0,f.isTempKind)(t.kind),s=n?(0,f.inRange)(t,e.value):!!e.done,d=['display'===r.app?'Logged on the Main Display.':'',s?'':'Out of range: add the corrective action.'].filter(Boolean).join(' ');return{pointId:t.id,name:t.name,kind:t.kind,at:o,by:x(r),byId:r.whoId??'voice-'+(r.app??'owner'),app:i,value:n?e.value:void 0,done:n?void 0:!!e.done,ok:s,source:'voice',note:d||void 0}});d.useSafety.getState().addEntries(s);const l=s.filter(e=>!e.ok);return l.length?'Logged. '+l.map(e=>e.name+' is OUT OF RANGE').join(', ')+'. Check it now and add what you did in the food safety log.':'Logged: '+s.map(e=>e.name+' '+(null!=e.value?e.value+'\xb0C':'done')).join(', ')+'. All fine.'}},{id:'allergen_info',title:'Allergen question',risk:'look',description:'Answer allergen questions from the recipe cards and the menu: what a dish contains or may contain, or which dishes are free of an allergen.',params:[{name:'dish',type:'string',description:'Dish name'},{name:'allergens',type:'string',description:'Comma-separated allergen ids'}],keywords:['allergen','allergy','contain'],match:e=>!N(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||N(e,/\b(sold out|price|draft)\b/)||N(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=E(e,t.rid);let a=e.toLowerCase();if(r)for(const e of L(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:M(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const r=R(t.rid),a=e.dish?r.find(t=>t.name===e.dish):void 0,n=String(e.allergens??'').split(',').filter(Boolean);if(a){const e=p.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=p.ALLERGENS.filter(e=>'may'===a.allergens[e.id]).map(e=>e.short);return(n.length?n.map(e=>'contains'===a.allergens[e]?a.name+' CONTAINS '+q(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+q(e)+'.':'No '+q(e)+' is listed for '+a.name+'.').join(' '):a.name+' contains '+(e.length?e.join(', '):'none of the 14 allergens')+(t.length?', and may contain '+t.join(', '):'')+'.')+(a.signedOff?'':' Its allergens are NOT signed off yet.')+' '+z}if(n.length){const e=r.filter(e=>!e.soldOut&&n.every(t=>!e.allergens[t])),t=r.filter(e=>n.some(t=>'contains'===e.allergens[t]));return e.length+(1===e.length?' dish has':' dishes have')+' no '+n.map(q).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+z}return'Which dish, or which allergen? For example \u201cdoes the fish supper contain gluten?\u201d.'}},{id:'set_sold_out',title:'Mark a dish sold out or back on',risk:'change',description:'Mark a menu dish sold out or back on. A reminder for staff: it shows on the Display and in the Sold out list.',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'soldOut',type:'string',required:!0,description:'yes = sold out, no = back on',enum:['yes','no']}],keywords:['sold out','back on','86'],match:e=>N(e,/\b(sold out|run out|ran out|out of stock|86|eighty.?six|back on|available again|back in stock|un.?86|none left)\b/)?4:0,parse:(e,t)=>{const r=E(e,t.rid),a=/\b(back on|available again|back in stock|un.?86)\b/i.test(e);return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,soldOut:a?'no':'yes'}},preview:e=>e.itemId?'Mark '+e.name+' '+('no'===e.soldOut?'back on':'sold out')+'?':e.name?e.name+' is on the Specials board; change it there.':'I couldn\u2019t find that dish on the menu.',run:async e=>e.itemId?(await o.repo.menu.updateItem(String(e.itemId),{soldOut:'no'!==e.soldOut}),'Done: '+e.name+' is '+('no'===e.soldOut?'back on':'sold out')+'.'):'Nothing changed: I couldn\u2019t find that dish on the menu.'},{id:'change_price',apps:['owner'],title:'Change a menu price',risk:'change',description:'Change the price of a menu dish (managers only).',params:[{name:'itemId',type:'string',required:!0,description:'Menu item id'},{name:'name',type:'string',description:'Dish name'},{name:'pence',type:'integer',required:!0,description:'New price in pence'}],keywords:['price'],match:e=>N(e,/\b(price|charge|cost)\b/)&&N(e,/(\xa3|\d|pound)/)&&!N(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=E(e,t.rid),a=e.match(/\b(?:to|at)\s*\xa3?\s*(\d{1,3})(?:[.:](\d{1,2}))?/i)??e.match(/\xa3\s*(\d{1,3})(?:\.(\d{1,2}))?/)??e.match(/(\d{1,3})\s*pounds?(?:\s*(\d{1,2}))?/i),n=a?100*Number(a[1])+Number((a[2]??'0').padEnd(2,'0')):void 0;return{itemId:'menu'===r?.kind?r.id:void 0,name:r?.name,pence:n,old:r?.price??void 0}},preview:e=>e.itemId?'Change '+e.name+' from '+(null!=e.old?(0,g.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,g.gbp)(Number(e.pence)):'?')+'?':'I couldn\u2019t find that dish on the menu.',run:async(e,t)=>{if(t.role&&!['owner','manager'].includes(t.role))return'Only managers can change prices.';const r=Number(e.pence);return e.itemId&&r>0&&r<1e5?(await o.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,g.gbp)(r)+'.'):'Nothing changed: I need the dish and a price.'}},{id:'draft_special',apps:['owner','chef'],title:'Draft a special',risk:'draft',description:'Save a special as a draft for the owner to approve. It goes on the Specials board only after its allergens are checked.',params:[{name:'text',type:'string',required:!0,description:'The special, e.g. \u201cHake with mussels, \xa318\u201d'}],keywords:['special'],match:e=>N(e,/\bspecials?\b/)&&N(e,/\b(add|new|put|draft|today'?s|tonight'?s|change|set)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\bspecials?\b(?:\s*(?:board|is|are|to|:))?\s*/i,'').trim()||e}),preview:e=>'Save a draft special: \u201c'+e.text+'\u201d. Its allergens get checked before it goes on the board.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'special',title:'New special',lines:[String(e.text),'Add its allergens and post it on the Specials board when approved.'],by:x(t),app:C(t)}),'Saved as a draft special for the owner to approve. It isn\u2019t on the board yet.')},{id:'check_availability',title:'Check table availability',risk:'look',description:'Check whether a table is free for a party at a date and time, and suggest nearby times if not.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'}],keywords:['availability','table for','free table'],match:e=>N(e,/\b(availability|available|space|room for|any room|got room|any tables?|got a table|free table|have we got|is there a table|can we fit|fit in)\b/)&&!N(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=U(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+S(n)+'. Best fit: table '+o[0].table+(o[0].area?' ('+o[0].area+')':'')+'.';const i=[];for(const e of[-30,30,-60,60,-90,90]){const o=K(a,e);if(U(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+S(n)+'.'+(i.length?' Free nearby: '+i.sort().join(', ')+'.':' Nothing free within 90 minutes either.')}},{id:'draft_booking',title:'Take a booking (draft)',risk:'draft',description:'Take a booking as a DRAFT for the owner to confirm in Bookings. The guest confirmation is only sent from there.',params:[{name:'covers',type:'integer',required:!0,description:'Party size'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'time',type:'time',required:!0,description:'HH:mm'},{name:'name',type:'string',description:'Guest name'}],keywords:['book','booking','reserve'],match:e=>N(e,/\b(book|booking|reserve|reservation)\b/)&&!N(e,/\b(availability|any tables?|have we got|is there|how many|move|cancel|booker)\b/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:G(r),date:Z(r,t.today),time:Y(r),name:$(e)}},preview:(e,t)=>{const r=e.covers&&e.time?U(t.rid,String(e.date??t.today),String(e.time),Number(e.covers)):[],a=e.covers&&e.time?r.length?' Table '+r[0].table+' is free.':' NO table is free then.':'';return'Draft booking: '+(e.name??'guest')+', '+(e.covers??'?')+' covers, '+(e.time??'?')+' on '+(e.date?S(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,r)=>(0,t.validParty)(Number(e.covers))?(b.useDrafts.getState().add({rid:r.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[S(String(e.date))+' at '+e.time,'Take their phone number when you confirm it in Bookings.'],data:{covers:e.covers,date:e.date,time:e.time,name:e.name},by:x(r),app:C(r)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${t.PARTY_RULE} How many people?`},{id:'add_waitlist',title:'Add to the waitlist',risk:'change',description:'Add a party to the waitlist. Nobody is messaged.',params:[{name:'name',type:'string',description:'Name'},{name:'covers',type:'integer',required:!0,description:'Party size'}],keywords:['waitlist','waiting list'],match:e=>N(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:$(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:G(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,r)=>{const a=Number(e.covers);if(!(0,t.validParty)(a))return`Nothing added: how many people? ${t.PARTY_RULE}`;return'Done: '+(await o.repo.waitlist.join(r.rid,String(e.name??'Guest'),a)).name+' is on the waitlist. Nobody has been messaged.'}},{id:'read_orders',title:'Read out orders',risk:'look',description:'Read out the live orders and takeaways.',params:[],keywords:['orders'],match:e=>N(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&N(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!N(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const a=i.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&V(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!a.length)return'No live orders right now.';const n=a.filter(e=>'takeaway'===e.type).length;return I(a.length,'live order')+' ('+n+' takeaway). '+a.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,r.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+I(e.lines.reduce((e,t)=>e+t.qty,0),'item')+', '+e.status+(e.slotTime?', due '+(t=e.slotTime,new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})):'')+(e.allergies.length?', HAS ALLERGIES':'');var t}).join('. ')+(a.length>6?'. And '+(a.length-6)+' more.':'.')}},{id:'day_numbers',title:'Covers, sales and forecast',risk:'look',description:'How many covers are booked today and tomorrow, sales through CoverCharge so far today, and the forecast for the rest of today.',params:[],keywords:['covers','sales','forecast'],match:e=>N(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!N(e,/\b(walk|seat|wait ?list|add|book (a|for|in))\b/)?3:0,preview:()=>'Today\u2019s covers, sales and forecast',run:(e,t)=>{const r=i.useStore.getState(),n=w(),o=k(n),s=r.restaurants.find(e=>e.id===t.rid),d=r.bookings.filter(e=>e.restaurantId===t.rid),l=d.filter(e=>e.date===o&&['confirmed','seated','finished'].includes(e.status)),c=l.reduce((e,t)=>e+t.partySize,0),p=l.filter(e=>e.walkIn).reduce((e,t)=>e+t.partySize,0),u=new Date(n);u.setDate(u.getDate()+1);const h=k(u),m=d.filter(e=>e.date===h&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),b=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=b.reduce((e,t)=>e+t.subtotal,0);let v='';if(s){const e=(0,a.forecastToday)(s,d,f,r.events,n);v=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,a.coversRange)(e.restOfDay.low,e.restOfDay.high,!1)+')'+(e.example?', example figures.':'.'):' No forecast yet: not enough history ('+e.restOfDay.booked+' covers booked for the rest of today).':''}return'Today: '+c+' covers booked or seated'+(p?', including '+p+' walk-in':'')+'. '+I(b.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,g.gbp)(y)+' before tips (till sales aren\u2019t included).')+v+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a Booker or Bidfood shopping list',risk:'draft',description:'Add items to a DRAFT shopping list for Booker or Bidfood for the owner to check and order on the supplier\u2019s site. Never places an order.',params:[{name:'supplier',type:'string',required:!0,description:'Supplier',enum:['booker','bidfood']},{name:'items',type:'string',required:!0,description:'Items separated by semicolons'}],keywords:['booker','bidfood','shopping list'],match:e=>N(e,/\b(booker|bidfood|bid food)\b/)?4:N(e,/\b(shopping list|order list|we need more|we'?re low on|running low)\b/)?3:0,parse:e=>({supplier:/\bbid ?food\b/i.test(e)?'bidfood':'booker',items:e.replace(/\b(to|on|onto)\s+(the\s+)?(booker|bidfood|bid food)?\s*(shopping\s+|order\s+)?list\b.*$/i,'').replace(/\b(from|at)\s+(booker|bidfood|bid food)\b/i,'').replace(/[,.]?\s*\b(put|add|stick)\s+(it|them|that|those)\b.*$/i,'').replace(/^.*?\b(add|need|order|get|put|low on)\b\s*/i,'').trim().split(/\s*(?:,|\band\b)\s*/i).map(e=>e.trim()).filter(Boolean).join('; ')}),preview:e=>'Add to the draft '+('bidfood'===e.supplier?'Bidfood':'Booker')+' list: '+String(e.items??'').split('; ').join(', ')+'. Nothing is ordered; the owner checks it and orders on the supplier\u2019s site.',run:(e,t)=>{const r=String(e.items??'').split('; ').filter(Boolean);if(!r.length)return'Nothing added: which items?';const a=b.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,x(t),C(t));return'Added to the draft '+a.title+' ('+I(a.lines.length,'item')+'). Nothing has been ordered.'}},{id:'draft_offer',title:'Draft an offer',risk:'draft',description:'Save an offer or promotion as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The offer'}],keywords:['offer','promotion'],match:e=>N(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&N(e,/\b(draft|create|make|set up|new|add|run|do)\b/)?3:0,parse:e=>({text:e.replace(/^.*?\b(?:offer|promotion|promo|deal)\b\s*(?:for|of|:)?\s*/i,'').trim()||e}),preview:e=>'Save a draft offer for the owner to approve: \u201c'+e.text+'\u201d. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:x(t),app:C(t)}),'Saved as a draft offer for the owner to approve. Nothing was published or sent.')},{id:'draft_event',title:'Draft an event',risk:'draft',description:'Save an event (quiz, live music, tasting night) as a draft for the owner to approve. Nothing is published or sent.',params:[{name:'text',type:'string',required:!0,description:'The event'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['event'],match:e=>N(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&N(e,/\b(draft|create|make|plan|set up|new|add|put on|run)\b/)?3:0,parse:(e,t)=>({text:e.replace(/^.*?\b(?:draft|create|make|plan|set up|add|put on|run)\b\s*(?:an?|the)?\s*(?:new\s+)?(?:event)?\s*(?:for|:)?\s*/i,'').trim()||e,date:/\b(tomorrow|monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/i.test(e)?Z(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+S(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(b.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[S(String(e.date))]:[]],data:{date:e.date},by:x(t),app:C(t)}),'Saved as a draft event for the owner to approve. Nothing was published or sent.')},{id:'card_balance',apps:['owner','chef'],title:'Gift card or stamp card balance',risk:'look',description:'Look up a gift card balance by its code, or a summary of stamp cards.',params:[{name:'code',type:'string',description:'Gift card code'},{name:'kind',type:'string',description:'gift or stamp',enum:['gift','stamp']}],keywords:['gift card','voucher','stamp card'],match:e=>N(e,/\b(gift ?cards?|gift vouchers?|vouchers?|stamp ?cards?|stamps|loyalty)\b/)?3:0,parse:e=>{const t=e.toUpperCase().replace(/\b(GIFT|CARDS?|VOUCHERS?|BALANCE|CHECK|WHAT'?S|WHAT|THE|ON|IS|CODE|FOR|OF|HOW|MUCH|LEFT|STAMPS?|A)\b/g,' ').match(/[A-Z0-9][A-Z0-9 -]{3,}[A-Z0-9]/);return{kind:/stamp|loyalty/i.test(e)?'stamp':'gift',code:t?Q(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=i.useStore.getState();if('stamp'===e.kind&&(0,n.staffServer)())return(0,n.loyaltySummary)().then(e=>I(e.members,'guest')+' have stamp cards here; '+I(e.rewardsReady,'reward')+' ready to use. To check one guest, open Stamp card and find or scan them.',()=>'I couldn\u2019t reach the stamp cards just now. Try again in a moment.');if('stamp'===e.kind){const e=r.stampCards.filter(e=>e.restaurantId===t.rid),a=e.reduce((e,t)=>e+t.rewardsAvailable,0);return I(e.length,'guest')+' have stamp cards here; '+I(a,'reward')+' ready to claim. To check one guest, scan their card in Stamp cards.'}if(!e.code)return'Read me the code on the gift card, letter by letter.';const a=String(e.code),o=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>Q(e.code)===a||a.length>=4&&Q(e.code).includes(a));return o?'Gift card '+o.code+': '+(0,g.gbp)(o.balance)+' left of '+(0,g.gbp)(o.initial)+'.':'I couldn\u2019t find a gift card with that code. Check it and try again.'}},{id:'feedback_summary',title:'Summarise feedback',risk:'look',description:'Summarise the last 7 days of guest ratings and comments.',params:[],keywords:['feedback','reviews'],match:e=>N(e,/\b(feedback|reviews?|ratings?|complaints?|comments?|what are (guests|people) saying)\b/)?3:0,preview:()=>'Summarise this week\u2019s feedback',run:(e,t)=>{const r=w().getTime()-6048e5,a=i.useStore.getState().ratings.filter(e=>e.restaurantId===t.rid&&new Date(e.createdAt).getTime()>=r);if(!a.length)return'No guest feedback in the last 7 days.';const n=a.reduce((e,t)=>e+t.stars,0)/a.length,o=a.filter(e=>e.stars<=3&&e.comment).slice(0,2),s=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return I(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(s.length?' Best: \u201c'+s[0].comment+'\u201d.':'')+(o.length?' To look at: '+o.map(e=>'\u201c'+e.comment+'\u201d ('+e.stars+' stars)').join('; ')+'.':' No low scores.')}},{id:'shift_note',title:'Leave a shift note',risk:'change',description:'Leave a note for the next shift.',params:[{name:'text',type:'string',required:!0,description:'The note'}],keywords:['shift note','handover'],match:e=>N(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!N(e,/\b(read|any notes|what notes)\b/)?4:0,parse:e=>({text:e.replace(/^.*?\b(?:shift note|leave a note|note for (?:the )?(?:next shift|tomorrow|tonight|morning|evening)|handover note|handover|tell the next shift|let the next shift know|note that)\b\s*(?:that|:|,|for the next shift)?\s*/i,'').trim()||e}),preview:e=>'Leave a shift note: \u201c'+e.text+'\u201d?',run:(e,t)=>(y.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:x(t),app:C(t)}),'Shift note saved. It shows on the Shift notes screen.')},{id:'read_shift_notes',title:'Read shift notes',risk:'look',description:'Read out the latest open shift notes.',params:[],keywords:['notes'],match:e=>N(e,/\b(read|any|what|latest)\b.*\b(shift notes?|notes|handover)\b/)?5:0,preview:()=>'Read the latest shift notes',run:(e,t)=>{const r=y.useShiftNotes.getState().notes.filter(e=>e.rid===t.rid&&!e.done).slice(0,5);return r.length?r.map(e=>e.by+', '+new Date(e.at).toLocaleString('en-GB',{weekday:'short',hour:'2-digit',minute:'2-digit'})+': '+e.text).join('. '):'No open shift notes.'}}]},1429,[804,1098,829,1120,1204,848,800,1014,1019,989,831,830,1079,1080,1011,1020,836,1430,1431]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1430,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1431,[808,815,818]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1432,[798,34,283,364,236,402,102,815,794,840,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1433,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1434,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STAFF_VOICE_ACTIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return x}});var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=r(_d[4]),n=r(_d[5]);const i=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},h=e=>String(e).padStart(2,'0'),c=e=>e.getFullYear()+'-'+h(e.getMonth()+1)+'-'+h(e.getDate()),d=e=>{const t=new Date(e);return h(t.getHours())+':'+h(t.getMinutes())},l=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return h(Math.floor(t/60))+':'+h(t%60)},u=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),h=new Date(i());return h.setDate(h.getDate()+1),e===c(h)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},m=(e,t)=>t.test(e),p=e=>(e??'').replace(' (example)',''),f=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),b=['staff'],k=[['kitchen',/\bkitchen\b/],['foh',/\b(front of house|foh|floor|bar)\b/],['managers',/\bmanagers?\b/],['all',/\b(all staff|everyone|whole team|team|group)\b/]],w={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function y(e,t){return'all'===e||(0,n.inChannel)(e,t)}function S(e,a){const s=e.toLowerCase().match(/\b(?:message|pm|private message|dm|text|tell)\s+([a-z' -]+?)(?:\s*[:,]|\s+(?:that|saying|to say)\b)/),o=(s?.[1]??'').trim();if(o&&!/^(the )?(team|everyone|kitchen|front of house|managers|group|all staff)$/.test(o))return t.useOwner.getState().staff.filter(e=>e.active&&e.id!==a.whoId).find(e=>(0,t.staffCalled)({name:p(e.name),nickname:e.nickname},o))}const v=[{id:'post_kitchen_chat',apps:['owner','chef'],title:'Post in the Kitchen chat',risk:'change',description:'Post a message in the pinned Kitchen chat (owners, managers, head chefs and kitchen staff).',params:[{name:'text',type:'string',required:!0,description:'The message'}],keywords:['kitchen chat'],match:e=>m(e,/\bkitchen (chat|group|channel)\b/)&&!m(e,/\b(read|any|unread|latest)\b/)?7:0,parse:e=>{const t=e.replace(/^.*?\bkitchen (?:chat|group|channel)\b\s*(?:[:,-]|\bthat\b|\bsaying\b)?\s*/i,'').trim();return{text:t.charAt(0).toUpperCase()+t.slice(1)}},preview:e=>'Post in the Kitchen chat: \u201c'+e.text+'\u201d?',run:(e,a)=>!e.text||String(e.text).length<2?'What should the message say?':(t.useOwner.getState().chatSend({ch:'kitchen',from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:b,title:'Post to the team chat or message one person',risk:'change',description:'Post a message in the team chat (All staff, Kitchen or Front of house), or a private message to one person. Read back first; posted only after Confirm.',params:[{name:'text',type:'string',required:!0,description:'The message'},{name:'ch',type:'string',required:!0,description:'Channel id or dm id'},{name:'to',type:'string',description:'Name of the person, for a private message'}],keywords:['team chat','group chat','message'],match:e=>m(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&m(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!m(e,/\b(read|any|unread|what did|latest|last)\b.*\b(messages?|chat)\b/)?5:0,parse:(e,t)=>{const a=t,s=e.toLowerCase(),o=S(e,a),n=e.replace(/^.*?(?:[:]|\b(?:saying|that|to say)\b)\s*/i,'').replace(/^\s*(?:(?:post|send|put|write)\s+(?:in|on|to)\s+(?:the\s+)?(?:team|group|kitchen|front of house|all staff)?\s*chat\s*)/i,'').trim(),i=n&&n!==e?n:e.replace(/^\s*(?:tell|message|post to|let)\s+(?:the\s+)?(?:team|everyone|group chat|team chat|kitchen|front of house)\s*(?:know\s*)?(?:that\s*)?/i,'').trim();if(o)return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:'dm:'+[String(a.whoId),o.id].sort().join(':'),to:p(o.name)};const h=k.find(([,e])=>e.test(s))?.[0]??'all';return{text:i.charAt(0).toUpperCase()+i.slice(1),ch:h}},preview:e=>e.to?'Private message to '+e.to+': \u201c'+e.text+'\u201d. Send it?':'Post in '+(w[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=f(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||y(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:i().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(w[s]??'the team chat')+'.'):'You can\u2019t post in '+(w[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:b,title:'Read out chat messages',risk:'look',description:'Read out unread messages (team chat and private messages), or the latest ones.',params:[],keywords:['messages','chat'],match:e=>m(e,/\b(read|any|unread|new|what did|latest|last|check)\b.*\b(messages?|chats?|pms?)\b|\bwhat.?s (been said|in the chat)\b/)?6:0,preview:()=>'Read out chat messages',run:(e,a)=>{const s=t.useOwner.getState(),o=f(a),n=String(a.whoId??''),i=s.chat.filter(e=>{return!e.removed&&e.text&&((t=e.ch).startsWith('dm:')?t.split(':').slice(1).includes(n):o?'all'===t||y(t,o):'all'===t);var t}).sort((e,t)=>e.at.localeCompare(t.at)),h=i.filter(e=>e.from!==n&&!e.seenBy.includes(n)),c=(h.length?h:i.filter(e=>'system'!==e.from)).slice(-5),l=e=>'system'===e.from?'CoverCharge':p(s.staff.find(t=>t.id===e.from)?.name??'Someone');return c.length?(h.length?h.length+' unread. ':'No unread messages. The latest: ')+c.map(e=>{return l(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(w[t]??t))+' at ')+d(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:b,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>m(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&m(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!m(e,/\b(break|clock)/)?5:0,preview:()=>'Your shifts',run:(e,a)=>{const s=a.today,o=t.useOwner.getState().shifts.filter(e=>e.staffId===a.whoId&&e.published&&e.date>=s).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start);if(!o.length)return'You have no published shifts coming up. Your manager publishes the rota in the app.';const n=i(),h=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>h)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+u(c.date,s)+', '+l(c.start)+' to '+l(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>u(e.date,s)+' '+l(e.start)+'\u2013'+l(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:b,title:'Am I clocked in?',risk:'look',description:'Whether you are clocked in, since when, and a reminder to clock in or out on the Clock tab.',params:[],keywords:['clock'],match:e=>m(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),h=a.today,c=o.getHours()+o.getMinutes()/60,u=s.shifts.find(e=>e.staffId===a.whoId&&e.published&&e.date===h);return n?'You\u2019re clocked in since '+d(n.in)+'.'+(u?' Your shift ends at '+l(u.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':u&&u.end>c?'You\u2019re not clocked in. Your shift today is '+l(u.start)+' to '+l(u.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(u?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:b,title:'My break',risk:'look',description:'Whether you are on a break, and how long your breaks have been today.',params:[],keywords:['break'],match:e=>m(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=i(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o);if(!n)return'You\u2019re not clocked in, so there\u2019s no break to show. Breaks are started and ended on the Clock tab.';const h=(0,t.loggedBreakMins)(n,o);if((0,t.isOnBreak)(n)){const e=n.breaks.find(e=>!e.end);return'You\u2019re on a break since '+d(e.start)+'. Breaks today: '+h+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return h?'You\u2019ve had '+h+' minutes of break today. Start a break on the Clock tab.':'No break taken yet today. Start one on the Clock tab.'}},{id:'todays_specials',apps:b,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>m(e,/\bspecials?\b/)&&!m(e,/\b(draft|add|new|make)\b/)?6:0,preview:()=>'Today\u2019s specials',run:(e,t)=>{const o=a.useSpecials.getState().current[t.rid]?.items??[];return o.length?'Today\u2019s specials: '+o.map(e=>e.name+(null!=e.price?', '+(0,s.gbp)(e.price):'')).join('; ')+'.':'There are no specials on the board today.'}},{id:'sold_out_list',apps:b,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>m(e,/\b(sold out|86(ed)?|run out|off the menu|unavailable)\b/)?6:0,preview:()=>'What\u2019s sold out',run:(e,t)=>{const a=(0,o.dishesFor)(t.rid).filter(e=>e.soldOut).map(e=>e.name);return a.length?'Sold out: '+a.join(', ')+'.':'Nothing is sold out right now.'}}],x=new Set(['log_check','allergen_info','next_table_free',...v.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1435,[800,865,989,836,1429,1032]); +__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1436,[]); +__d(function(g,r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_KEYTERMS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MAX_APP_KEYTERMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"VENUE_WORDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cleanTerm",{enumerable:!0,get:function(){return u}}),e.venueKeyterms=function(l){const b=[],f=new Set,h=t=>{const a=u(t??''),n=a.toLowerCase();a.length>=2&&!f.has(n)&&b.lengtht.active).forEach(t=>h(String(t.name).split(/\s+/)[0]))}catch{}try{(n.useFloor.getState().plans[l]??(0,n.seedPlan)(l)).areas.forEach(t=>h(t.name))}catch{}try{s.forEach(h)}catch{}try{a.useStore.getState().menu.filter(t=>!t.restaurantId||t.restaurantId===l).forEach(t=>h(t.name))}catch{}return b};var t=r(d[0]),a=r(d[1]),n=r(d[2]);const l=100,c=80,o=['walk-in','covers','table','seat','seated','clear','cleared','needs clearing','block','unblock','waitlist','lobster','crab','langoustines','scallops','sold out','no-show','Sitooterie','Beer Garden','Main Restaurant','party of','people'],s=['table one','table two','table three','table four','table five','table six','table seven','table eight','table nine','table ten','table eleven','table twelve'],u=t=>t.replace(/\([^)]*\)/g,' ').replace(/[^\p{L}\p{N} '&.-]/gu,' ').replace(/\s+/g,' ').trim().slice(0,50).trim()},1437,[865,800,1014]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1438,[815]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1439,[808,815,818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1440,[815]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.seedPitch=function(){const h='owner'===d.APP_VARIANT?'st-tracy':'chef'===d.APP_VARIANT?'st-bisto':'staff'===d.APP_VARIANT?'st-lenny':null;!h||i.useSession.getState().meId||/[?&]invite=/.test('undefined'!=typeof window?window.location.search:'')||i.useSession.getState().signIn(h);t.useStore.setState(t=>({bookings:t.bookings.map((t,e)=>t.phone||t.walkIn?t:{...t,phone:`07700 900${String(100+e).slice(-3)}`})}));const S=s.useOwner.getState();if(S.shifts.some(t=>t.id.startsWith('pitch-')))return;const p=(0,e.nowFrom)(t.useStore.getState().clock),y=u(p),m=p.getHours()+p.getMinutes()/60,w=(0,s.addDays)(y,-(0,s.weekdayOf)(y)),k=[],A=[];for(const[t,[e,n,i]]of Object.entries(l))if(o.ROSTER.some(e=>e.id===t))for(let o=-7;o<14;o++){const d=(0,s.addDays)(w,o),c=(0,s.weekdayOf)(d);if(i.includes(c))continue;k.push({id:`pitch-${t}-${d}`,staffId:t,date:d,day:c,start:e,end:n,published:o<7,breakAt:n-e>=6?e+3.5:void 0});const u='st-jack'===t?{auto:'rota'}:{};d=6?30:0,signOff:d<(0,s.addDays)(y,-1)?{by:'Alex',byId:'st-gordon',at:f(d,23.5)}:void 0,...u}):d===y&&e<=m&&A.push({id:`pitch-a-${t}-${d}`,staffId:t,date:d,in:f(d,u.auto?e:e-.05),inSite:!0,...u})}s.useOwner.setState({shifts:[...S.shifts.filter(t=>!k.some(e=>e.staffId===t.staffId&&e.date===t.date)),...k],attendance:[...S.attendance,...A]});const I=n.useCashUp.getState();for(let t=1;t<=10;t++){const e=(0,s.addDays)(y,-t);if([0,1].includes((0,s.weekdayOf)(e)))continue;if(I.cashUps.some(t=>t.rid===c&&t.date===e))continue;const n=1450+373*t%900,o=210+97*t%240;I.saveCashUp({rid:c,date:e,vals:{card:n,cash:o,float:200,cashTips:38+13*t%40,cardTips:92+29*t%70,overUnder:3===t?-2.5:0,notes:3===t?'Till 2 short \xa32.50, counted twice.':''},photos:[],confirmedBy:t%2?'Alex':'Priya',confirmedAt:f(e,23.25),readBy:null})}for(let t=1;t<=3;t++){const e=(0,s.addDays)(w,-7*t);if(I.sales.some(t=>t.rid===c&&t.weekStart===e))continue;const n=11800+640*t;I.saveSales({rid:c,weekStart:e,vals:{gross:n,net:Math.round(n/1.2),vat:Math.round(n-n/1.2),covers:610+22*t,discounts:140,refunds:35},categories:[{name:'Food',amount:Math.round(.62*n)},{name:'Drinks',amount:Math.round(.31*n)},{name:'Takeaway',amount:Math.round(.07*n)}],photos:[],confirmedBy:'Alex',confirmedAt:f((0,s.addDays)(e,7),11),readBy:null})}};var t=r(_d[0]),e=r(_d[1]),s=r(_d[2]),n=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]);const c='anchorage',u=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,f=(t,e)=>{const[s,n,o]=t.split('-').map(Number);return new Date(s,n-1,o,Math.floor(e),Math.round(e%1*60)).toISOString()},l={'st-gordon':[11,21,[0,1]],'st-bisto':[10,20.5,[0,1]],'st-agate':[16,22.5,[0,1,2]],'st-lenny':[11,19,[0,1,3]],'st-finn':[17,23,[0,1,4]],'st-eilidh':[12,18,[0,1,2]],'st-emily':[17,22,[0,1,3]],'st-lillie':[12,20,[0,1,5]],'st-jack':[16,22,[0,1,6]]}},1441,[848,800,865,1024,15,997,846]); +__d(function(e,s,o,p,t,a,f){"use strict";t.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1442,[]); +__d(function(s,o,e,p,t,c,d){"use strict";t.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1443,[]); +__d(function(o,s,e,f,p,t,d){"use strict";p.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1444,[]); +__d(function(o,s,p,t,d,e,n){"use strict";d.exports="/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1445,[]); +__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]})}},1446,[30,34,846,25]); +__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 t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},1447,[1448]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},1448,[25,1449,591]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},1449,[34,172]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1450,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},1451,[25,499,34,270,651]); __r(501); __r(21); __r(0); \ No newline at end of file diff --git a/staff-app/admin.html b/staff-app/admin.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/admin.html +++ b/staff-app/admin.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer.html b/staff-app/customer.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer.html +++ b/staff-app/customer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage.html b/staff-app/customer/anchorage.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage.html +++ b/staff-app/customer/anchorage.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/book.html b/staff-app/customer/anchorage/book.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/book.html +++ b/staff-app/customer/anchorage/book.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/feedback.html b/staff-app/customer/anchorage/feedback.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/feedback.html +++ b/staff-app/customer/anchorage/feedback.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/gift.html b/staff-app/customer/anchorage/gift.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/gift.html +++ b/staff-app/customer/anchorage/gift.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/lost.html b/staff-app/customer/anchorage/lost.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/lost.html +++ b/staff-app/customer/anchorage/lost.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/loyalty.html b/staff-app/customer/anchorage/loyalty.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/loyalty.html +++ b/staff-app/customer/anchorage/loyalty.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/merch.html b/staff-app/customer/anchorage/merch.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/merch.html +++ b/staff-app/customer/anchorage/merch.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/offers.html b/staff-app/customer/anchorage/offers.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/offers.html +++ b/staff-app/customer/anchorage/offers.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/refer.html b/staff-app/customer/anchorage/refer.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/refer.html +++ b/staff-app/customer/anchorage/refer.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/waitlist.html b/staff-app/customer/anchorage/waitlist.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/waitlist.html +++ b/staff-app/customer/anchorage/waitlist.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/anchorage/whatson.html b/staff-app/customer/anchorage/whatson.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/anchorage/whatson.html +++ b/staff-app/customer/anchorage/whatson.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/basket.html b/staff-app/customer/basket.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/basket.html +++ b/staff-app/customer/basket.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/customer/profile.html b/staff-app/customer/profile.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/customer/profile.html +++ b/staff-app/customer/profile.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/demo.html b/staff-app/demo.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/demo.html +++ b/staff-app/demo.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/display.html b/staff-app/display.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/display.html +++ b/staff-app/display.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/index.html b/staff-app/index.html index 8ce33d025d7d6cfc961c90933a684d9922b20285..29ee68b4dd4d5fe163284f76c255f2c1769bea51 100644 --- a/staff-app/index.html +++ b/staff-app/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/kitchen.html b/staff-app/kitchen.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/kitchen.html +++ b/staff-app/kitchen.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/owner.html b/staff-app/owner.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/owner.html +++ b/staff-app/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/staff.html b/staff-app/staff.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/staff.html +++ b/staff-app/staff.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/sw.js b/staff-app/sw.js index fd08ae52f191cbf20bf387b52d651daf63e08fe8..9f473aaf739bfd7b27be25b5b5cbe4f05995a7d1 100644 --- a/staff-app/sw.js +++ b/staff-app/sw.js @@ -1,7 +1,7 @@ // Anchorage Staff service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-staff-9cd70ee3ad"; +const V = "cc-staff-79c8c87c15"; const BASE = "/staff-app/"; -const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=9cd70ee3ad3989a108282edbad9d5cacdf03fe738db1dfb31a1e335d42d5b67e"]; +const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=79c8c87c159e314dc5dc1094c0ef4c0bc81619682d901f0a51dfe27486693fc1"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/staff-app/team.html b/staff-app/team.html index 4137037c8caac1e9049e017877d2c79a1ad3c4b2..7df0fb791c5436872d6631a1834759df08449b02 100644 --- a/staff-app/team.html +++ b/staff-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - +